};
use bdk_testenv::{
anyhow,
- corepc_node::{Input, Output},
+ bitcoind::{Input, Output},
TestEnv,
};
use bitcoin::{hashes::Hash, Block, Network, ScriptBuf, WScriptHash};
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;
mod common;
fn testenv() -> anyhow::Result<TestEnv> {
- 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 {
};
use bdk_testenv::{
anyhow::{self},
- block_id,
- corepc_node::{Input, Output},
- hash,
+ bitcoind::{Input, Output},
+ block_id, hash,
utils::{new_tx, DESCRIPTORS},
TestEnv,
};
use bdk_electrum::BdkElectrumClient;
use bdk_testenv::{
anyhow,
- corepc_node::{Input, Output},
+ bitcoind::{Input, Output},
TestEnv,
};
use core::time::Duration;
// 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)?
// 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)?
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};
// 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
// 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)?
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};
// 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
// 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)?
[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]
[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"]
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>,
}
/// 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;
pub fn new_with_config(config: Config) -> anyhow::Result<Self> {
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,
}
/// 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
}
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.