Skip to content

Commit 39a0bff

Browse files
committed
Other wallet may not be immediately updated
wait for it for 3 seconds in 100ms steps before checking the balance
1 parent 129b332 commit 39a0bff

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ mod test {
608608
Amount::from_btc(5000.0).unwrap(),
609609
bob.get_balances().unwrap().mine.immature
610610
);
611-
alice
611+
let _txid = alice
612612
.send_to_address(
613613
&bob_address,
614614
Amount::from_btc(1.0).unwrap(),
@@ -624,6 +624,14 @@ mod test {
624624
alice.get_balances().unwrap().mine.trusted < Amount::from_btc(49.0).unwrap()
625625
&& alice.get_balances().unwrap().mine.trusted > Amount::from_btc(48.9).unwrap()
626626
);
627+
628+
// bob wallet may not be immediately updated
629+
for _ in 0..30 {
630+
if bob.get_balances().unwrap().mine.untrusted_pending.as_sat() > 0 {
631+
break;
632+
}
633+
std::thread::sleep(std::time::Duration::from_millis(100));
634+
}
627635
assert_eq!(
628636
Amount::from_btc(1.0).unwrap(),
629637
bob.get_balances().unwrap().mine.untrusted_pending

0 commit comments

Comments
 (0)