Skip to content

Commit

Permalink
Add basic bitcoind test
Browse files Browse the repository at this point in the history
Add an initial test using the `bitcoind` crate and call the RPC command
`get_blockchain_info` to check it all works.
  • Loading branch information
tcharding committed Feb 5, 2024
1 parent 5bbcff6 commit 802907d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ core2 = { version = "0.3.2", default-features = false, features = ["alloc"], opt

[dev-dependencies]
anyhow = "1"
bitcoind = { version = "0.34.1", features = ["25_1"] }
serde_json = "1.0.0"
serde_test = "1.0.19"
serde_derive = "1.0.103"
Expand Down
8 changes: 8 additions & 0 deletions tests/bitcoind.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use bitcoind::bitcoincore_rpc;

#[test]
fn bitcoind_get_blockchain_info() {
use bitcoincore_rpc::RpcApi;
let bitcoind = bitcoind::BitcoinD::from_downloaded().expect("failed to init bitcoind");
assert_eq!(0, bitcoind.client.get_blockchain_info().unwrap().blocks);
}

0 comments on commit 802907d

Please sign in to comment.