@@ -448,16 +448,10 @@ pub(crate) fn wait_for_block<E: ElectrumApi>(electrs: &E, min_height: usize) {
448
448
}
449
449
450
450
pub ( crate ) fn wait_for_tx < E : ElectrumApi > ( electrs : & E , txid : Txid ) {
451
- let mut tx_res = electrs. transaction_get ( & txid) ;
452
- loop {
453
- if tx_res. is_ok ( ) {
454
- break ;
455
- }
456
- tx_res = exponential_backoff_poll ( || {
457
- electrs. ping ( ) . unwrap ( ) ;
458
- Some ( electrs. transaction_get ( & txid) )
459
- } ) ;
460
- }
451
+ exponential_backoff_poll ( || {
452
+ electrs. ping ( ) . unwrap ( ) ;
453
+ electrs. transaction_get ( & txid) . ok ( )
454
+ } ) ;
461
455
}
462
456
463
457
pub ( crate ) fn wait_for_outpoint_spend < E : ElectrumApi > ( electrs : & E , outpoint : OutPoint ) {
@@ -500,9 +494,13 @@ where
500
494
pub ( crate ) fn premine_and_distribute_funds < E : ElectrumApi > (
501
495
bitcoind : & BitcoindClient , electrs : & E , addrs : Vec < Address > , amount : Amount ,
502
496
) {
497
+ println ! ( "JOOST: Premining..." ) ;
503
498
premine_blocks ( bitcoind, electrs) ;
504
499
500
+ println ! ( "JOOST: Distributing funds..." ) ;
505
501
distribute_funds_unconfirmed ( bitcoind, electrs, addrs, amount) ;
502
+
503
+ println ! ( "JOOST: Generate blocks and wait..." ) ;
506
504
generate_blocks_and_wait ( bitcoind, electrs, 1 ) ;
507
505
}
508
506
@@ -530,6 +528,8 @@ pub(crate) fn distribute_funds_unconfirmed<E: ElectrumApi>(
530
528
. parse ( )
531
529
. unwrap ( ) ;
532
530
531
+ println ! ( "JOOST: wait for txid {}" , txid) ;
532
+
533
533
wait_for_tx ( electrs, txid) ;
534
534
535
535
txid
0 commit comments