diff --git a/crates/bitcoind_rpc/tests/test_emitter.rs b/crates/bitcoind_rpc/tests/test_emitter.rs index cbde85d6e..b75d474ca 100644 --- a/crates/bitcoind_rpc/tests/test_emitter.rs +++ b/crates/bitcoind_rpc/tests/test_emitter.rs @@ -9,7 +9,7 @@ use bdk_chain::{ }; use bdk_testenv::{ anyhow, - corepc_node::{Input, Output}, + bitcoind::{Input, Output}, TestEnv, }; use bitcoin::{hashes::Hash, Block, Network, ScriptBuf, WScriptHash}; diff --git a/crates/bitcoind_rpc/tests/test_filter_iter.rs b/crates/bitcoind_rpc/tests/test_filter_iter.rs index e45e53311..d6136ecfb 100644 --- a/crates/bitcoind_rpc/tests/test_filter_iter.rs +++ b/crates/bitcoind_rpc/tests/test_filter_iter.rs @@ -1,6 +1,6 @@ use bdk_bitcoind_rpc::bip158::{Error, FilterIter}; use bdk_core::CheckPoint; -use bdk_testenv::{anyhow, corepc_node, TestEnv}; +use bdk_testenv::{anyhow, bitcoind, TestEnv}; use bitcoin::{Address, Amount, Network, ScriptBuf}; use bitcoincore_rpc::RpcApi; @@ -9,7 +9,7 @@ use crate::common::ClientExt; mod common; fn testenv() -> anyhow::Result { - let mut conf = corepc_node::Conf::default(); + let mut conf = bitcoind::Conf::default(); conf.args.push("-blockfilterindex=1"); conf.args.push("-peerblockfilters=1"); TestEnv::new_with_config(bdk_testenv::Config { diff --git a/crates/chain/tests/test_indexed_tx_graph.rs b/crates/chain/tests/test_indexed_tx_graph.rs index 18d1ff1bf..2a33f3b1c 100644 --- a/crates/chain/tests/test_indexed_tx_graph.rs +++ b/crates/chain/tests/test_indexed_tx_graph.rs @@ -15,9 +15,8 @@ use bdk_chain::{ }; use bdk_testenv::{ anyhow::{self}, - block_id, - corepc_node::{Input, Output}, - hash, + bitcoind::{Input, Output}, + block_id, hash, utils::{new_tx, DESCRIPTORS}, TestEnv, }; diff --git a/crates/electrum/tests/test_electrum.rs b/crates/electrum/tests/test_electrum.rs index 84bd7d869..ef94c62f3 100644 --- a/crates/electrum/tests/test_electrum.rs +++ b/crates/electrum/tests/test_electrum.rs @@ -13,7 +13,7 @@ use bdk_core::bitcoin::{ use bdk_electrum::BdkElectrumClient; use bdk_testenv::{ anyhow, - corepc_node::{Input, Output}, + bitcoind::{Input, Output}, TestEnv, }; use core::time::Duration; @@ -141,7 +141,7 @@ pub fn detect_receive_tx_cancel() -> anyhow::Result<()> { // Create and sign the `send_tx` that sends funds to the receiver address. let send_tx_outputs = [Output::new( receiver_addr, - selected_utxo.amount.to_unsigned()? - SEND_TX_FEE, + selected_utxo.amount - SEND_TX_FEE, )]; let send_tx = rpc_client .create_raw_transaction(&inputs, &send_tx_outputs)? @@ -156,7 +156,7 @@ pub fn detect_receive_tx_cancel() -> anyhow::Result<()> { // address. let undo_send_outputs = [Output::new( sender_addr, - selected_utxo.amount.to_unsigned()? - UNDO_SEND_TX_FEE, + selected_utxo.amount - UNDO_SEND_TX_FEE, )]; let undo_send_tx = rpc_client .create_raw_transaction(&inputs, &undo_send_outputs)? diff --git a/crates/esplora/tests/async_ext.rs b/crates/esplora/tests/async_ext.rs index 29d532d08..e6903591c 100644 --- a/crates/esplora/tests/async_ext.rs +++ b/crates/esplora/tests/async_ext.rs @@ -4,7 +4,7 @@ use bdk_chain::spk_client::{FullScanRequest, SyncRequest}; use bdk_chain::spk_txout::SpkTxOutIndex; use bdk_chain::{ConfirmationBlockTime, IndexedTxGraph, TxGraph}; use bdk_esplora::EsploraAsyncExt; -use bdk_testenv::corepc_node::{Input, Output}; +use bdk_testenv::bitcoind::{Input, Output}; use bdk_testenv::{anyhow, TestEnv}; use esplora_client::{self, Builder}; use std::collections::{BTreeSet, HashSet}; @@ -62,7 +62,7 @@ pub async fn detect_receive_tx_cancel() -> anyhow::Result<()> { // Create and sign the `send_tx` that sends funds to the receiver address. let address = receiver_addr; - let value = selected_utxo.amount.to_unsigned()? - SEND_TX_FEE; + let value = selected_utxo.amount - SEND_TX_FEE; let send_tx_outputs = Output::new(address, value); let send_tx = rpc_client @@ -78,7 +78,7 @@ pub async fn detect_receive_tx_cancel() -> anyhow::Result<()> { // address. let undo_send_outputs = [Output::new( sender_addr, - selected_utxo.amount.to_unsigned()? - UNDO_SEND_TX_FEE, + selected_utxo.amount - UNDO_SEND_TX_FEE, )]; let undo_send_tx = rpc_client .create_raw_transaction(&inputs, &undo_send_outputs)? diff --git a/crates/esplora/tests/blocking_ext.rs b/crates/esplora/tests/blocking_ext.rs index c63ef3f00..4619901cc 100644 --- a/crates/esplora/tests/blocking_ext.rs +++ b/crates/esplora/tests/blocking_ext.rs @@ -4,7 +4,7 @@ use bdk_chain::spk_client::{FullScanRequest, SyncRequest}; use bdk_chain::spk_txout::SpkTxOutIndex; use bdk_chain::{ConfirmationBlockTime, IndexedTxGraph, TxGraph}; use bdk_esplora::EsploraExt; -use bdk_testenv::corepc_node::{Input, Output}; +use bdk_testenv::bitcoind::{Input, Output}; use bdk_testenv::{anyhow, TestEnv}; use esplora_client::{self, Builder}; use std::collections::{BTreeSet, HashSet}; @@ -63,7 +63,7 @@ pub fn detect_receive_tx_cancel() -> anyhow::Result<()> { // Create and sign the `send_tx` that sends funds to the receiver address. let send_tx_outputs = [Output::new( receiver_addr, - selected_utxo.amount.to_unsigned()? - SEND_TX_FEE, + selected_utxo.amount - SEND_TX_FEE, )]; let send_tx = rpc_client @@ -79,7 +79,7 @@ pub fn detect_receive_tx_cancel() -> anyhow::Result<()> { // address. let undo_send_outputs = [Output::new( sender_addr, - selected_utxo.amount.to_unsigned()? - UNDO_SEND_TX_FEE, + selected_utxo.amount - UNDO_SEND_TX_FEE, )]; let undo_send_tx = rpc_client .create_raw_transaction(&inputs, &undo_send_outputs)? diff --git a/crates/testenv/Cargo.toml b/crates/testenv/Cargo.toml index d24ae7e5f..6cedcf4d3 100644 --- a/crates/testenv/Cargo.toml +++ b/crates/testenv/Cargo.toml @@ -17,7 +17,7 @@ workspace = true [dependencies] bdk_chain = { path = "../chain", version = "0.23.1", default-features = false } -electrsd = { version = "0.36.1", features = [ "legacy" ], default-features = false } +electrsd = { version = "0.38.0", features = [ "legacy" ], default-features = false } bitcoin = { version = "0.32.0", default-features = false } [dev-dependencies] @@ -25,7 +25,7 @@ bdk_testenv = { path = "." } [features] default = ["std", "download"] -download = ["electrsd/corepc-node_28_2", "electrsd/esplora_a33e97e1"] +download = ["electrsd/bitcoind_download", "electrsd/bitcoind_28_2", "electrsd/esplora_a33e97e1"] std = ["bdk_chain/std", "bitcoin/rand-std"] serde = ["bdk_chain/serde"] diff --git a/crates/testenv/src/lib.rs b/crates/testenv/src/lib.rs index eec99efa8..3c3f8a6f4 100644 --- a/crates/testenv/src/lib.rs +++ b/crates/testenv/src/lib.rs @@ -11,28 +11,28 @@ use bdk_chain::CheckPoint; use bitcoin::address::NetworkChecked; use bitcoin::hex::HexToBytesError; use core::time::Duration; -use electrsd::corepc_node::mtype::GetBlockTemplate; -use electrsd::corepc_node::{TemplateRequest, TemplateRules}; +use electrsd::bitcoind::mtype::GetBlockTemplate; +use electrsd::bitcoind::{TemplateRequest, TemplateRules}; pub use electrsd; +pub use electrsd::bitcoind; +pub use electrsd::bitcoind::anyhow; pub use electrsd::corepc_client; -pub use electrsd::corepc_node; -pub use electrsd::corepc_node::anyhow; pub use electrsd::electrum_client; use electrsd::electrum_client::ElectrumApi; /// Struct for running a regtest environment with a single `bitcoind` node with an `electrs` /// instance connected to it. pub struct TestEnv { - pub bitcoind: electrsd::corepc_node::Node, + pub bitcoind: electrsd::bitcoind::BitcoinD, pub electrsd: electrsd::ElectrsD, } /// Configuration parameters. #[derive(Debug)] pub struct Config<'a> { - /// [`corepc_node::Conf`] - pub bitcoind: corepc_node::Conf<'a>, + /// [`bitcoind::Conf`] + pub bitcoind: bitcoind::Conf<'a>, /// [`electrsd::Conf`] pub electrsd: electrsd::Conf<'a>, } @@ -42,7 +42,7 @@ impl Default for Config<'_> { /// which is required for testing `bdk_esplora`. fn default() -> Self { Self { - bitcoind: corepc_node::Conf::default(), + bitcoind: bitcoind::Conf::default(), electrsd: { let mut conf = electrsd::Conf::default(); conf.http_enabled = true; @@ -88,11 +88,11 @@ impl TestEnv { pub fn new_with_config(config: Config) -> anyhow::Result { let bitcoind_exe = match std::env::var("BITCOIND_EXE") { Ok(path) => path, - Err(_) => corepc_node::downloaded_exe_path().context( + Err(_) => bitcoind::downloaded_exe_path().context( "you need to provide an env var BITCOIND_EXE or specify a bitcoind version feature", )?, }; - let bitcoind = corepc_node::Node::with_conf(bitcoind_exe, &config.bitcoind)?; + let bitcoind = bitcoind::BitcoinD::with_conf(bitcoind_exe, &config.bitcoind)?; let electrs_exe = match std::env::var("ELECTRS_EXE") { Ok(path) => path, @@ -110,7 +110,7 @@ impl TestEnv { } /// Exposes the RPC calls from [`corepc_client`]. - pub fn rpc_client(&self) -> &corepc_node::Client { + pub fn rpc_client(&self) -> &bitcoind::Client { &self.bitcoind.client } @@ -428,7 +428,7 @@ mod test { use bdk_chain::bitcoin::opcodes::OP_TRUE; use bdk_chain::bitcoin::Amount; use core::time::Duration; - use electrsd::corepc_node::anyhow::Result; + use electrsd::bitcoind::anyhow::Result; use std::collections::BTreeSet; /// This checks that reorgs initiated by `bitcoind` is detected by our `electrsd` instance.