File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ use crate::payment::{
6363} ;
6464use crate :: runtime:: Runtime ;
6565use crate :: types:: { Broadcaster , PaymentStore , PendingPaymentStore } ;
66+ use crate :: util:: random_range;
6667use crate :: { ChainSource , Error } ;
6768
6869pub ( crate ) enum OnchainSendAmount {
@@ -326,7 +327,7 @@ impl Wallet {
326327 }
327328
328329 if !unconfirmed_outbound_txids. is_empty ( ) {
329- let txs_to_broadcast: Vec < Transaction > = {
330+ let mut txs_to_broadcast: Vec < Transaction > = {
330331 let locked_wallet = self . inner . lock ( ) . expect ( "lock" ) ;
331332 unconfirmed_outbound_txids
332333 . iter ( )
@@ -337,6 +338,10 @@ impl Wallet {
337338 } )
338339 . collect ( )
339340 } ;
341+ for i in ( 1 ..txs_to_broadcast. len ( ) ) . rev ( ) {
342+ let j = random_range ( 0 , i as u64 ) as usize ;
343+ txs_to_broadcast. swap ( i, j) ;
344+ }
340345
341346 if !txs_to_broadcast. is_empty ( ) {
342347 let tx_count = txs_to_broadcast. len ( ) ;
You can’t perform that action at this time.
0 commit comments