Function create_regtest_rpc

Source
pub async fn create_regtest_rpc(
    config: &mut TxSenderConfig,
) -> WithProcessCleanup
Expand description

Creates a Bitcoin regtest node for testing, waits for it to start and returns an RPC client.

§Environment Variables

  • BITCOIN_RPC_DEBUG: If set to a non-empty value, will use port 18443 and connect to an existing bitcoind instance when available.

§Returns

Returns a WithProcessCleanup which contains:

  • The bitcoind process handle (if a new instance was started)
  • An RPC client connected to the node
  • Path to the debug log file
  • A flag indicating whether to pause before cleanup

§Important

The returned value MUST NOT be dropped until the test is complete, as dropping it will terminate the bitcoind process and invalidate the RPC connection. The cleanup is handled automatically when the returned value is dropped.