Expand description
§Halfin
A bitcoin node running utility for integration testing.
A {regtest} bitcoin node runner 🏃♂️
This crate makes it simple to run regtest bitcoind
and utreexod instances from Rust code, useful in
integration test contexts.
Pretty much bitcoind with
utreexod support.
§Supported Implementations
| Implementation | Version | Feature Flag | Default Feature |
|---|---|---|---|
bitcoind | v31.0 | bitcoind_31_0 | Yes |
utreexod | v0.5.1 | utreexod_0_5_1 | Yes |
§Example
use halfin::connect;
use halfin::bitcoind::BitcoinD;
use halfin::utreexod::UtreexoD;
let bitcoind = BitcoinD::new().unwrap();
bitcoind.generate(10).unwrap();
assert_eq!(bitcoind.get_chain_tip().unwrap(), 10);
let utreexod = UtreexoD::new().unwrap();
utreexod.generate(10).unwrap();
assert_eq!(utreexod.get_chain_tip().unwrap(), 10);
connect(&bitcoind, &utreexod).unwrap();Re-exports§
pub use serde_json;
Modules§
- bitcoind
- BitcoinD: spawn and interact with a
bitcoindprocess - utreexod
- UtreexoD: spawn and interact with a
utreexodprocess
Enums§
Constants§
- CONNECTION_
INTERVAL - The interval
Durationbetween successive attempts of node connection. - CONNECTION_
TIMEOUT - The timeout
Durationfor node connection. - NODE_
BUILDING_ INTERVAL - The
Durationbetween attempts at instantiating aNode. - NODE_
BUILDING_ MAX_ RETRIES - The maximum number of attempts at instantiating a
BitcoinD/UtreexoD. - POLL_
INTERVAL - The
Durationinterval between polls forconnectandwait_for_height. - WAIT_
TIMEOUT - The timeout
Durationforconnectandwait_for_height.
Traits§
Functions§
- connect
- Connect node
ato nodeb. - get_
available_ port - Ask the OS for an available port, immediately unbind and return it.
- wait_
for_ height - Poll a
Nodeuntil its chain reachesheight. - wait_
for_ height_ with_ timeout - Poll a
Nodeuntil its chain reachesheightwith a customtimeout.