Skip to main content

Module electrsd

Module electrsd 

Source
Expand description

§ElectrsD: spawn and interact with an electrs process

A utility crate for spinning up electrs processes connected to a local BitcoinD process in regtest, useful for integration testing Electrum consumers against a Bitcoin regtest chain.

§Quick Start

use halfin::bitcoind::BitcoinD;
use halfin::electrsd::ElectrsD;
use halfin::electrsd::wait_for_electrs_to_catch_up;

let bitcoind = BitcoinD::new().unwrap();
bitcoind.generate(10).unwrap();

let electrs = ElectrsD::new(&bitcoind).unwrap();
wait_for_electrs_to_catch_up(&electrs, &bitcoind).unwrap();

§Directory Handling

By default each ElectrsD instance uses a temporary directory that is cleaned up when the instance is dropped. Pass a staticdir in ElectrsDConf to keep data between runs.

Structs§

ElectrsD
A running electrs regtest indexer.
ElectrsDConf
Configuration for an ElectrsD instance.

Constants§

ELECTRS_INDEXING_TIMEOUT
The default timeout for ElectrsD indexing helpers.

Functions§

get_electrs_path
Return the path to the downloaded electrs binary.
wait_for_electrs_mempool_tx
Poll ElectrsD until txid appears as an unconfirmed transaction for script_pubkey.
wait_for_electrs_mempool_tx_with_timeout
Poll ElectrsD until txid appears as an unconfirmed transaction for script_pubkey with a custom timeout.
wait_for_electrs_tip
Poll ElectrsD until its Electrum header tip reaches expected_height.
wait_for_electrs_tip_with_timeout
Poll ElectrsD until its Electrum header tip reaches expected_height with a custom timeout.
wait_for_electrs_to_catch_up
Poll ElectrsD until its Electrum header tip matches BitcoinD’s tip.
wait_for_electrs_to_catch_up_with_timeout
Poll ElectrsD until its Electrum header tip matches BitcoinD’s tip with a custom timeout.