Skip to content

Commit 0234637

Browse files
committed
Fix wait_for_tx exponential backoff
Backoff wasn't actually working and polling would happen without any delay at all.
1 parent 0f1d66c commit 0234637

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

tests/common/mod.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -437,16 +437,10 @@ pub(crate) fn wait_for_block<E: ElectrumApi>(electrs: &E, min_height: usize) {
437437
}
438438

439439
pub(crate) fn wait_for_tx<E: ElectrumApi>(electrs: &E, txid: Txid) {
440-
let mut tx_res = electrs.transaction_get(&txid);
441-
loop {
442-
if tx_res.is_ok() {
443-
break;
444-
}
445-
tx_res = exponential_backoff_poll(|| {
446-
electrs.ping().unwrap();
447-
Some(electrs.transaction_get(&txid))
448-
});
449-
}
440+
exponential_backoff_poll(|| {
441+
electrs.ping().unwrap();
442+
electrs.transaction_get(&txid).ok()
443+
});
450444
}
451445

452446
pub(crate) fn wait_for_outpoint_spend<E: ElectrumApi>(electrs: &E, outpoint: OutPoint) {

0 commit comments

Comments
 (0)