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, utreexod,
and electrs instances from Rust code, useful in integration test contexts.
§Supported Implementations
| Implementation | Version | Feature Flag | Default Feature |
|---|---|---|---|
bitcoind | v31.0 | bitcoind_31_0 | Yes |
utreexod | v0.5.2 | utreexod_0_5_2 | Yes |
electrs | v0.11.1 | electrs_0_11_1 | No |
§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 - electrsd
- ElectrsD: spawn and interact with an
electrsprocess - 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
NodeA toNodeB. - connect_
and_ sync - Connect
NodeA toNodeB and wait for them to synchronize chains. - get_
available_ port - Ask the OS for an available port, immediately unbind and return it.
- wait_
for_ filter_ height - Poll a
Nodeuntil its Compact Block Filters reachheight. - wait_
for_ height - Poll a
Nodeuntil its chain reachesheight. - wait_
for_ height_ with_ timeout - Poll a
Nodeuntil its chain reachesheightwith a customtimeout.