Skip to content

Commit 9bdbcf4

Browse files
committed
f
1 parent 85eac68 commit 9bdbcf4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lightning/src/chain/onchaintx.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -733,11 +733,10 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
733733
// outpoints to know if transaction is the original claim or a bumped one issued
734734
// by us.
735735
let mut are_sets_equal = true;
736-
// Do a linear search for each input (we don't expect large input sets to
737-
// exist) to ensure the request's input set is fully spent to be resilient
738-
// against the external claim reordering inputs.
736+
let mut tx_inputs = tx.input.iter().map(|input| &input.previous_output).collect::<Vec<_>>();
737+
tx_inputs.sort_unstable();
739738
for request_input in request.outpoints() {
740-
if tx.input.iter().find(|input| input.previous_output == *request_input).is_none() {
739+
if tx_inputs.binary_search(&request_input).is_err() {
741740
are_sets_equal = false;
742741
break;
743742
}

0 commit comments

Comments
 (0)