diff --git a/packages/pocket-ic/HOWTO.md b/packages/pocket-ic/HOWTO.md index 8c9a10a8ea0..02280e8ad48 100644 --- a/packages/pocket-ic/HOWTO.md +++ b/packages/pocket-ic/HOWTO.md @@ -585,9 +585,16 @@ To mine blocks with rewards credited to a given `bitcoin_address: String`, you c .unwrap(); let mut n = 101; // must be more than 100 (Coinbase maturity rule) - 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), + } + } ``` For an example of a test canister that can be deployed to an application subnet of the PocketIC instance,