You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 26, 2024. It is now read-only.
Utility to run a regtest bitcoind process, useful in integration testing environment.
@@ -19,8 +15,7 @@ for bitcoin core 25.1, starting a regtest node is as simple as that:
19
15
```
20
16
21
17
The build script will automatically download the bitcoin core version 25.1 from [bitcoin core](https://bitcoincore.org),
22
-
verify the hashes and place it in the build directory for this crate. If you wish to download from an
23
-
alternate location, for example locally for CI, use the `BITCOIND_DOWNLOAD_ENDPOINT` env var.
18
+
verify the binary hash and place it in the build directory for this crate.
24
19
25
20
When you don't use the auto-download feature you have the following options:
26
21
@@ -37,22 +32,15 @@ if let Ok(exe_path) = bitcoind::exe_path() {
37
32
Startup options could be configured via the [`Conf`] struct using [`BitcoinD::with_conf`] or
38
33
[`BitcoinD::from_downloaded_with_conf`]
39
34
40
-
## Issues with traditional approach
41
-
42
-
I used integration testing based on external bash script launching needed external processes, there
43
-
are many issues with this approach like:
44
-
45
-
* External script may interfere with local development environment [1](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/blob/200fc8247c1896709a673b82a89ca0da5e7aa2ce/integration_test/run.sh#L9)
46
-
* Use of a single huge test to test everything [2](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/blob/200fc8247c1896709a673b82a89ca0da5e7aa2ce/integration_test/src/main.rs#L122-L203)
47
-
* If test are separated, a failing test may fail to leave a clean situation, causing other test to fail (because of the initial situation, not a real failure)
48
-
* bash script are hard, especially support different OS and versions
49
-
50
35
## Features
51
36
52
-
* It waits until bitcoind daemon become ready to accept RPC commands
53
-
*`bitcoind` use a temporary directory as datadir. You can specify the root of your temp directories so that you have node's datadir in a RAM disk (eg `/dev/shm`)
54
-
* Free ports are asked to the OS. Since you can't reserve the given port, a low probability race condition is still possible, for this reason the process is tried to be spawn 3 times with different ports.
55
-
* The process is killed when the struct goes out of scope no matter how the test finishes
37
+
* Waits until bitcoind daemon becomes ready to accept RPC commands
38
+
*`bitcoind` uses a temporary directory as datadir. You can specify the root of your temp
39
+
directories so that you have the node's datadir in a RAM disk (eg `/dev/shm`)
40
+
* Free ports are requested from the OS. Since you can't reserve the given port, a low probability
41
+
race condition is still possible, for this reason the process attempts spawning 3 times with
42
+
different ports.
43
+
* The process is killed when the struct goes out of scope no matter how the test finishes.
56
44
* Allows easy spawning of dependent processes like:
57
45
-[electrs](https://github.com/RCasatta/electrsd)
58
46
-[cln](https://github.com/RCasatta/lightningd)
@@ -85,28 +73,11 @@ Pinning in `Cargo.toml` is avoided because it could cause compilation issues dow
85
73
86
74
## Nix
87
75
88
-
For reproducibility reasons, Nix build scripts cannot hit the internet, but the
89
-
auto-download feature does exactly that. To successfully build under Nix the
90
-
user must provide the tarball locally and specify its location via the
91
-
`BITCOIND_TARBALL_FILE` env var.
92
-
93
-
Another option is to specify the `BITCOIND_SKIP_DOWNLOAD` env var and provide the
94
-
executable via the `PATH`.
95
-
96
-
Alternatively, use the dep without auto-download feature.
0 commit comments