File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -574,13 +574,19 @@ where
574574 let cur_height = sweeper_state. best_block . height ;
575575 let cur_hash = sweeper_state. best_block . block_hash ;
576576
577- let respend_descriptors : Vec < & SpendableOutputDescriptor > = sweeper_state
577+ let respend_descriptors_set : HashSet < & SpendableOutputDescriptor > = sweeper_state
578578 . outputs
579579 . iter ( )
580580 . filter ( |o| filter_fn ( * o, cur_height) )
581581 . map ( |o| & o. descriptor )
582582 . collect ( ) ;
583583
584+ // we first collect into a set to avoid duplicates and to "randomize" the order
585+ // in which outputs are spent. Then we collect into a vec as that is what
586+ // `spend_outputs` requires.
587+ let respend_descriptors: Vec < & SpendableOutputDescriptor > =
588+ respend_descriptors_set. into_iter ( ) . collect ( ) ;
589+
584590 // Generate the spending transaction and broadcast it.
585591 if !respend_descriptors. is_empty ( ) {
586592 let spending_tx = self
You can’t perform that action at this time.
0 commit comments