Skip to content

Commit 2306238

Browse files
committed
update readme
1 parent 098b421 commit 2306238

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

Readme.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Utility to run a regtest bitcoind process, useful in integration testing environment.
44

5-
```
5+
```rust
66
use bitcoincore_rpc::RpcApi;
77
let bitcoind = bitcoind::BitcoinD::new("/usr/local/bin/bitcoind").unwrap();
88
assert_eq!(0, bitcoind.client.get_blockchain_info().unwrap().blocks);
@@ -15,3 +15,26 @@ assert_eq!(0, bitcoind.client.get_blockchain_info().unwrap().blocks);
1515
* Free ports are asked to the OS (a low probability race condition is still possible)
1616
* the process is killed when the struct goes out of scope no matter how the test finishes
1717
* allows easy spawning of dependent process like https://github.com/RCasatta/electrsd
18+
19+
## Cargo features
20+
21+
When a feature like `0_21_1` is selected, the build script will automatically download the bitcoin core version 0.21.1
22+
verifying the hashes and placing it in `${CARGO_HOME}`.
23+
Use utility function `downloaded_exe_path()` to have the downloaded executable path.
24+
25+
### Example
26+
27+
##### Cargo.toml
28+
29+
```toml
30+
31+
[dev-dependencies]
32+
bitcoind = { version = "0.12.0", features = "0_21_1" }
33+
```
34+
35+
#### In your tests
36+
37+
```rust
38+
let bitcoind = bitcoind::BitcoinD::new(bitcoind::downloaded_exe_path().unwrap()).unwrap();
39+
```
40+

0 commit comments

Comments
 (0)