Skip to content

Commit 0ecbe62

Browse files
committed
Use u16 for ConstructedTransaction::shared_input_index
The number of inputs allowed during an interactive-tx construction session is limited to 4096, so a u16 can be used instead of u32 when serializing ConstructedTransaction.
1 parent dc672f1 commit 0ecbe62

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lightning/src/ln/interactivetxs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ pub(crate) struct ConstructedTransaction {
199199
input_metadata: Vec<TxInMetadata>,
200200
output_metadata: Vec<TxOutMetadata>,
201201
tx: Transaction,
202-
shared_input_index: Option<u32>,
202+
shared_input_index: Option<u16>,
203203
shared_output_index: u16,
204204
}
205205

@@ -279,7 +279,7 @@ impl ConstructedTransaction {
279279
.position(|txin| {
280280
txin.previous_output == shared_funding_input.input.previous_output
281281
})
282-
.map(|position| position as u32)
282+
.map(|position| position as u16)
283283
});
284284

285285
let shared_output_index = output
@@ -455,7 +455,7 @@ impl ConstructedTransaction {
455455
self.holder_is_initiator
456456
}
457457

458-
pub fn shared_input_index(&self) -> Option<u32> {
458+
pub fn shared_input_index(&self) -> Option<u16> {
459459
self.shared_input_index
460460
}
461461
}

0 commit comments

Comments
 (0)