Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- compact_filters
- esplora,key-value-db,electrum
- compiler
- rpc
steps:
- name: checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -85,6 +86,9 @@ jobs:
- name: esplora
container: bitcoindevkit/esplora
start: /root/electrs --network regtest -vvv --cookie admin:passw --jsonrpc-import --electrum-rpc-addr=0.0.0.0:60401 --http-addr 0.0.0.0:3002
- name: rpc
container: bitcoindevkit/electrs
start: /root/electrs --network regtest --jsonrpc-import
container: ${{ matrix.blockchain.container }}
env:
BDK_RPC_AUTH: USER_PASS
Expand Down Expand Up @@ -120,7 +124,7 @@ jobs:
- name: start ${{ matrix.blockchain.name }}
run: nohup ${{ matrix.blockchain.start }} & sleep 5
- name: Test
run: $HOME/.cargo/bin/cargo test --features ${{ matrix.blockchain.name }},test-blockchains --no-default-features ${{ matrix.blockchain.name }}::bdk_blockchain_tests
run: $HOME/.cargo/bin/cargo test --features test-${{ matrix.blockchain.name }},test-blockchains --no-default-features ${{ matrix.blockchain.name }}::bdk_blockchain_tests

check-wasm:
name: Check WASM
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added an option that must be explicitly enabled to allow signing using non-`SIGHASH_ALL` sighashes (#350)
#### Changed
`get_address` now returns an `AddressInfo` struct that includes the index and derefs to `Address`.
#### Added
- Bitcoin core RPC added as blockchain backend

## [v0.7.0] - [v0.6.0]

Expand Down
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ lazy_static = { version = "1.4", optional = true }
tiny-bip39 = { version = "^0.8", optional = true }

# Needed by bdk_blockchain_tests macro
bitcoincore-rpc = { version = "0.13", optional = true }
bitcoincore-rpc = { version = "0.13", optional = true }
serial_test = { version = "0.4", optional = true }

# Platform-specific dependencies
Expand All @@ -56,9 +56,14 @@ key-value-db = ["sled"]
async-interface = ["async-trait"]
all-keys = ["keys-bip39"]
keys-bip39 = ["tiny-bip39"]
rpc = ["bitcoincore-rpc"]


# Debug/Test features
test-blockchains = ["bitcoincore-rpc", "electrum-client"]
test-electrum = ["electrum"]
test-rpc = ["rpc"]
test-esplora = ["esplora"]
test-md-docs = ["electrum"]

[dev-dependencies]
Expand All @@ -67,6 +72,7 @@ env_logger = "0.7"
base64 = "^0.11"
clap = "2.33"
serial_test = "0.4"
bitcoind = "0.10.0"

[[example]]
name = "address_validator"
Expand Down
8 changes: 6 additions & 2 deletions run_blockchain_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ usage() {
cat <<'EOF'
Script for running the bdk blockchain tests for a specific blockchain by starting up the backend in docker.

Usage: ./run_blockchain_tests.sh [esplora|electrum] [test name].
Usage: ./run_blockchain_tests.sh [esplora|electrum|rpc] [test name].

EOF
}
Expand Down Expand Up @@ -37,6 +37,10 @@ case "$blockchain" in
id="$(docker run -d -p 127.0.0.1:18443-18444:18443-18444/tcp -p 127.0.0.1:60401:60401/tcp -p 127.0.0.1:3002:3002/tcp bitcoindevkit/esplora)"
export BDK_ESPLORA_URL=http://127.0.0.1:3002
;;
rpc)
eprintln "starting electrs docker container"
id="$(docker run -d -p 127.0.0.1:18443-18444:18443-18444/tcp -p 127.0.0.1:60401:60401/tcp bitcoindevkit/electrs)"
;;
*)
usage;
exit 1;
Expand All @@ -61,4 +65,4 @@ while ! cli getwalletinfo >/dev/null; do sleep 1; done
# sleep again for good measure!
sleep 1;

cargo test --features "test-blockchains,$blockchain" --no-default-features "$blockchain::bdk_blockchain_tests::$test_name"
cargo test --features "test-blockchains,test-$blockchain" --no-default-features "$blockchain::bdk_blockchain_tests::$test_name"
8 changes: 8 additions & 0 deletions src/blockchain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ pub use self::electrum::ElectrumBlockchain;
#[cfg(feature = "electrum")]
pub use self::electrum::ElectrumBlockchainConfig;

#[cfg(feature = "rpc")]
pub mod rpc;
#[cfg(feature = "rpc")]
pub use self::rpc::RpcBlockchain;
#[cfg(feature = "rpc")]
pub use self::rpc::RpcConfig;
Comment on lines +46 to +51
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new RPC variant should be added to src/blockchain/any.rs as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, right, but I think we need to defer this (maybe following PR) until rust-bitcoin/rust-bitcoincore-rpc#181 is merged and released (initial work for reference d13b925)


#[cfg(feature = "esplora")]
#[cfg_attr(docsrs, doc(cfg(feature = "esplora")))]
pub mod esplora;
Expand All @@ -52,6 +59,7 @@ pub use self::esplora::EsploraBlockchain;
#[cfg(feature = "compact_filters")]
#[cfg_attr(docsrs, doc(cfg(feature = "compact_filters")))]
pub mod compact_filters;

#[cfg(feature = "compact_filters")]
pub use self::compact_filters::CompactFiltersBlockchain;

Expand Down
Loading