Skip to content

Commit

Permalink
fix: Use bitcoin regtest rather than bitcoin testnet (#2243)
Browse files Browse the repository at this point in the history
# Description

For local bitcoin development, the replica needs to be initialized with the `bitcoin_regtest` subnet feature and not `bitcoin_testnet`.

This fix depends on [MR 5394](https://gitlab.com/dfinity-lab/public/ic/-/merge_requests/5394) in the replica, and should not be merged until that MR is merged.

# How Has This Been Tested?

* Built `ic-starter` and `replica` from the branch of the MR above.
* Used `DFX_REPLICA_PATH` and `DFX_IC_STARTER_PATH` to use these locally built binaries.
* Started bitcoind and generated some blocks
* Cloned this dfx project: https://github.com/ielashi/bitcoin-integration-demo
* Ran my locally modified dfx with `dfx start --enable-bitcoin --bitcoin-node 127.0.0.1:18444`, and then verified that the adapter and replica were syncing blocks correctly from bitcoind.
* Deployed the canister in my dfx project.
* Verified that the canister can read the balances/UTXOs of the bitcoin state.

# Checklist:

- [x] The title of this PR complies with [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
- [x] I have edited the CHANGELOG accordingly.
  • Loading branch information
ielashi authored Jul 8, 2022
1 parent 87ad3e3 commit 8f14d66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ a dfx process that is starting.

dfx ping now uses the anonymous identity, and no longer requires dfx.json to be present.


=== fix: Initialize replica with bitcoin regtest flag

When the bitcoin feature is enabled, dfx was launching the replica with the "bitcoin_testnet" feature.
The correct feature to use is "bitcoin_regtest".

=== dfx bootstrap now looks up the port of the local replica

`dfx replica` writes the port of the running replica to one of these locations:
Expand Down
2 changes: 1 addition & 1 deletion src/dfx/src/actors/replica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ fn replica_start_thread(
cmd.args(&["--http-port", &port.to_string()]);
}
if config.btc_adapter.enabled {
cmd.args(&["--subnet-features", "bitcoin_testnet"]);
cmd.args(&["--subnet-features", "bitcoin_regtest"]);
if let Some(socket_path) = config.btc_adapter.socket_path {
cmd.args(&[
"--bitcoin-testnet-uds-path",
Expand Down

0 comments on commit 8f14d66

Please sign in to comment.