File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
Utility to run a regtest bitcoind process, useful in integration testing environment.
4
4
5
- ```
5
+ ``` rust
6
6
use bitcoincore_rpc :: RpcApi ;
7
7
let bitcoind = bitcoind :: BitcoinD :: new (" /usr/local/bin/bitcoind" ). unwrap ();
8
8
assert_eq! (0 , bitcoind . client. get_blockchain_info (). unwrap (). blocks);
@@ -15,3 +15,26 @@ assert_eq!(0, bitcoind.client.get_blockchain_info().unwrap().blocks);
15
15
* Free ports are asked to the OS (a low probability race condition is still possible)
16
16
* the process is killed when the struct goes out of scope no matter how the test finishes
17
17
* 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
+
You can’t perform that action at this time.
0 commit comments