Skip to content

Commit

Permalink
HOWTO
Browse files Browse the repository at this point in the history
  • Loading branch information
mraszyk committed Jan 17, 2025
1 parent e6411e4 commit f1671d2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/pocket-ic/HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f1671d2

Please sign in to comment.