Skip to content

Commit a84a279

Browse files
testing: bitcoind wait for startup
Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent c8d6fac commit a84a279

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

testing/src/btc.rs

+15
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use port::Port;
77
use port_selector as port;
88
use tempfile::TempDir;
99

10+
use crate::wait_for;
11+
1012
pub mod macros {
1113
#[macro_export]
1214
macro_rules! bitcoind {
@@ -84,6 +86,19 @@ impl BtcNode {
8486
&format!("http://localhost:{port}"),
8587
Auth::UserPass(user.clone(), pass.clone()),
8688
)?;
89+
90+
wait_for!(async {
91+
let Ok(info) = rpc.get_blockchain_info() else {
92+
return Err(());
93+
};
94+
95+
if info.initial_block_download {
96+
return Err(());
97+
}
98+
99+
Ok(())
100+
});
101+
87102
let bg_process = vec![process];
88103
Ok(Self {
89104
inner: rpc,

0 commit comments

Comments
 (0)