Expand description
§halfin
A bitcoin node and indexer running utility for integration testing.
A {regtest} bitcoin node runner 🏃♂️
This crate makes it simple to run regtest bitcoind, utreexod,
electrs, and electrumx instances from Rust code,
useful in integration test contexts.
§Supported Implementations
| Kind | Implementation | Version | Feature Flag | Default Feature |
|---|---|---|---|---|
| Node | bitcoind | v31.0 | bitcoind | Yes |
| Node | utreexod | v0.6.0 | utreexod | Yes |
| Indexer | electrs | v0.11.1 | electrs | No |
§Example
ⓘ
use halfin::bitcoind::BitcoinD;
use halfin::connect;
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 crate::error::Error;pub use serde_json;
Modules§
- bitcoind
BitcoinD: spawn and interact with abitcoindprocess- electrsd
ElectrsD: spawn and interact with anelectrsprocess- electrumxd
ElectrumxD: spawn and interact with anelectrumxprocess- error
- Error
- node
Nodetrait- utreexod
UtreexoD: spawn and interact with autreexodprocess
Enums§
- DataDir
- Owns a node’s working directory, either as a temporary or a persistent path.
Constants§
- CONNECTION_
INTERVAL - Period between successive attempts of
Nodeconnection. - CONNECTION_
TIMEOUT - Timeout for
Nodeconnection. - POLL_
INTERVAL - Period between polls for
connectandwait_for_height. - SPAWN_
ATTEMPTS - Maximum number of attempts at spawning a process.
- SPAWN_
INTERVAL - Period between attempts at spawning a process.
- WAIT_
TIMEOUT - Timeout for
connectandwait_for_height.
Functions§
- get_
available_ port - Ask the OS for an available port, immediately unbind and return it.