File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -733,11 +733,10 @@ impl<ChannelSigner: Sign> OnchainTxHandler<ChannelSigner> {
733
733
// outpoints to know if transaction is the original claim or a bumped one issued
734
734
// by us.
735
735
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 ( ) ;
739
738
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 ( ) {
741
740
are_sets_equal = false ;
742
741
break ;
743
742
}
You can’t perform that action at this time.
0 commit comments