Skip to content

Commit

Permalink
chore(PocketIC): retry in PocketIC bitcoin integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mraszyk committed Jan 17, 2025
1 parent ac71086 commit e6411e4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions rs/pocket_ic_server/tests/bitcoin_integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,16 @@ rpcauth=ic-btc-integration:cdf2741387f3a12438f69092f0fdad8e$62081498c98bee09a0dc

// `n` must be more than 100 (Coinbase maturity rule) so that the reward for the first block can be sent out
let mut n = 101;
btc_rpc
.generate_to_address(n, &Address::from_str(&bitcoin_address).unwrap())
.unwrap();
// retry generating blocks until the bitcoind is up and running
loop {
match btc_rpc.generate_to_address(n, &Address::from_str(&bitcoin_address).unwrap()) {
Ok(_) => break,
Err(bitcoincore_rpc::Error::JsonRpc(_)) => {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Err(err) => panic!("Unexpected error when talking to bitcoind: {}", err),
}
}

let reward = 50 * 100_000_000; // 50 BTC

Expand Down

0 comments on commit e6411e4

Please sign in to comment.