Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 41 additions & 78 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions extractors/log/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use log_extractor::Args;
use shared::{
async_nats,
bitcoin::{Block, consensus::Decodable, hashes::Hash, hex::FromHex},
corepc_node,
bitcoind,
futures::StreamExt,
log::{Level, LevelFilter, info},
nats_util::NatsArgs,
Expand Down Expand Up @@ -128,19 +128,19 @@ fn make_test_args(nats_port: u16, bitcoind_pipe: String) -> Args {
/// Starts a regtest `bitcoind` node with the given configuration.
///
/// The binary is resolved from the `BITCOIND_EXE` environment variable
/// (via `corepc_node::exe_path`); if unset, a pre-built binary is
/// (via `bitcoind::exe_path`); if unset, a pre-built binary is
/// downloaded automatically.
fn setup_node(conf: corepc_node::Conf) -> corepc_node::Node {
fn setup_node(conf: bitcoind::Conf) -> bitcoind::BitcoinD {
info!("env BITCOIND_EXE={:?}", std::env::var("BITCOIND_EXE"));
info!("exe_path={:?}", corepc_node::exe_path());
info!("exe_path={:?}", bitcoind::exe_path());

if let Ok(exe_path) = corepc_node::exe_path() {
if let Ok(exe_path) = bitcoind::exe_path() {
info!("Using bitcoind at '{}'", exe_path);
return corepc_node::Node::with_conf(exe_path, &conf).unwrap();
return bitcoind::BitcoinD::with_conf(exe_path, &conf).unwrap();
}

info!("Trying to download a bitcoind..");
corepc_node::Node::from_downloaded_with_conf(&conf).unwrap()
bitcoind::BitcoinD::from_downloaded_with_conf(&conf).unwrap()
}

/// Creates a two-node regtest topology:
Expand All @@ -149,18 +149,18 @@ fn setup_node(conf: corepc_node::Conf) -> corepc_node::Node {
///
/// `node1_args` are appended as extra `bitcoind` CLI flags (e.g. `-debug=validation`) so tests
/// can enable the specific logging needed to trigger the events they want to observe.
fn setup_two_connected_nodes(node1_args: Vec<&str>) -> (corepc_node::Node, corepc_node::Node) {
fn setup_two_connected_nodes(node1_args: Vec<&str>) -> (bitcoind::BitcoinD, bitcoind::BitcoinD) {
// node1 listens for p2p connections
let mut node1_conf = corepc_node::Conf::default();
node1_conf.p2p = corepc_node::P2P::Yes;
let mut node1_conf = bitcoind::Conf::default();
node1_conf.p2p = bitcoind::P2P::Yes;
for arg in node1_args {
info!("Running node1 with arg: {}", arg);
node1_conf.args.push(arg);
}
let node1 = setup_node(node1_conf);

// node2 connects to node1
let mut node2_conf = corepc_node::Conf::default();
let mut node2_conf = bitcoind::Conf::default();
node2_conf.p2p = node1.p2p_connect(true).unwrap();
let node2 = setup_node(node2_conf);

Expand Down Expand Up @@ -193,7 +193,7 @@ fn setup_two_connected_nodes(node1_args: Vec<&str>) -> (corepc_node::Node, corep
/// exit before returning.
async fn check(
args: Vec<&str>,
test_setup: fn(&corepc_node::Client),
test_setup: fn(&bitcoind::Client),
check_event: fn(PeerObserverEvent) -> bool,
) {
setup();
Expand Down
20 changes: 10 additions & 10 deletions extractors/p2p/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use shared::{
async_nats,
bitcoin::{self, Amount},
corepc_node::{self},
bitcoind::{self},
futures::StreamExt,
log::{self, info},
nats_util::NatsArgs,
Expand Down Expand Up @@ -72,21 +72,21 @@ fn make_test_args(
)
}

fn setup_node(conf: corepc_node::Conf) -> corepc_node::Node {
fn setup_node(conf: bitcoind::Conf) -> bitcoind::BitcoinD {
info!("env BITCOIND_EXE={:?}", std::env::var("BITCOIND_EXE"));
info!("exe_path={:?}", corepc_node::exe_path());
info!("exe_path={:?}", bitcoind::exe_path());

if let Ok(exe_path) = corepc_node::exe_path() {
if let Ok(exe_path) = bitcoind::exe_path() {
info!("Using bitcoind at '{}'", exe_path);
return corepc_node::Node::with_conf(exe_path, &conf).unwrap();
return bitcoind::BitcoinD::with_conf(exe_path, &conf).unwrap();
}

info!("Trying to download a bitcoind..");
corepc_node::Node::from_downloaded_with_conf(&conf).unwrap()
bitcoind::BitcoinD::from_downloaded_with_conf(&conf).unwrap()
}

fn configure_node() -> corepc_node::Node {
let mut node_conf = corepc_node::Conf::default();
fn configure_node() -> bitcoind::BitcoinD {
let mut node_conf = bitcoind::Conf::default();
node_conf.args = vec![
"-regtest",
"-debug=net",
Expand All @@ -100,7 +100,7 @@ fn configure_node() -> corepc_node::Node {
// enabling this is useful for debugging, but enabling this by default will
// be quite spammy.
node_conf.view_stdout = false;
node_conf.p2p = corepc_node::P2P::Yes;
node_conf.p2p = bitcoind::P2P::Yes;

setup_node(node_conf)
}
Expand All @@ -110,7 +110,7 @@ async fn check(
disable_addrv2: bool,
disable_invs: bool,
disable_feefilter: bool,
test_setup: fn(&corepc_node::Node),
test_setup: fn(&bitcoind::BitcoinD),
mut check_expected: impl FnMut(PeerObserverEvent) -> bool,
) {
setup();
Expand Down
6 changes: 3 additions & 3 deletions extractors/rpc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use shared::bitcoind::mtype::{
GetBlockchainInfo, GetChainTxStats, GetNetworkInfo, GetOrphanTxsVerboseTwo,
};
use shared::clap::{ArgGroup, Parser};
use shared::corepc_client::client_sync::Auth;
use shared::corepc_client::client_sync::v30::{Client, FeeEstimateMode};
use shared::corepc_node::mtype::{
GetBlockchainInfo, GetChainTxStats, GetNetworkInfo, GetOrphanTxsVerboseTwo,
};
use shared::log;
use shared::nats_subjects::Subject;
use shared::nats_util::{self, NatsArgs};
Expand Down
20 changes: 10 additions & 10 deletions extractors/rpc/tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use shared::{
corepc_node,
bitcoind,
log::{self, info},
nats_util::NatsArgs,
simple_logger::SimpleLogger,
Expand Down Expand Up @@ -148,27 +148,27 @@ pub fn make_test_args(
)
}

pub fn setup_node(conf: corepc_node::Conf) -> corepc_node::Node {
pub fn setup_node(conf: bitcoind::Conf) -> bitcoind::BitcoinD {
info!("env BITCOIND_EXE={:?}", std::env::var("BITCOIND_EXE"));
info!("exe_path={:?}", corepc_node::exe_path());
info!("exe_path={:?}", bitcoind::exe_path());

if let Ok(exe_path) = corepc_node::exe_path() {
if let Ok(exe_path) = bitcoind::exe_path() {
info!("Using bitcoind at '{}'", exe_path);
return corepc_node::Node::with_conf(exe_path, &conf).unwrap();
return bitcoind::BitcoinD::with_conf(exe_path, &conf).unwrap();
}

info!("Trying to download a bitcoind..");
corepc_node::Node::from_downloaded_with_conf(&conf).unwrap()
bitcoind::BitcoinD::from_downloaded_with_conf(&conf).unwrap()
}

pub fn setup_two_connected_nodes() -> (corepc_node::Node, corepc_node::Node) {
pub fn setup_two_connected_nodes() -> (bitcoind::BitcoinD, bitcoind::BitcoinD) {
// node1 listens for p2p connections
let mut node1_conf = corepc_node::Conf::default();
node1_conf.p2p = corepc_node::P2P::Yes;
let mut node1_conf = bitcoind::Conf::default();
node1_conf.p2p = bitcoind::P2P::Yes;
let node1 = setup_node(node1_conf);

// node2 connects to node1
let mut node2_conf = corepc_node::Conf::default();
let mut node2_conf = bitcoind::Conf::default();
node2_conf.p2p = node1.p2p_connect(true).unwrap();
let node2 = setup_node(node2_conf);

Expand Down
Loading
Loading