Skip to content

Commit

Permalink
replace bitcoind with corpc-node crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Shourya742 committed Jan 23, 2025
1 parent e228c19 commit 2f5c8e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion roles/tests-integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"]

[dependencies]
async-channel = "1.5.1"
corepc-node = "0.5.0"
binary_sv2 = { path = "../../protocols/v2/binary-sv2/binary-sv2" }
bitcoind = "0.36.0"
codec_sv2 = { path = "../../protocols/v2/codec-sv2", features = ["noise_sv2"] }
const_sv2 = { path = "../../protocols/v2/const-sv2" }
flate2 = "1.0.32"
Expand Down
18 changes: 6 additions & 12 deletions roles/tests-integration/lib/template_provider.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bitcoind::{bitcoincore_rpc::RpcApi, BitcoinD, Conf};
use corepc_node::{Conf, Node};
use flate2::read::GzDecoder;
use std::{
env,
Expand Down Expand Up @@ -62,7 +62,7 @@ fn get_bitcoind_filename(os: &str, arch: &str) -> String {

#[derive(Debug)]
pub struct TemplateProvider {
bitcoind: BitcoinD,
bitcoind: Node,
}

impl TemplateProvider {
Expand Down Expand Up @@ -127,24 +127,18 @@ impl TemplateProvider {
}

env::set_var("BITCOIND_EXE", bitcoin_exe_home.join("bitcoind"));
let exe_path = bitcoind::exe_path().unwrap();
let exe_path = corepc_node::exe_path().unwrap();

let bitcoind = BitcoinD::with_conf(exe_path, &conf).unwrap();
let bitcoind = Node::with_conf(exe_path, &conf).unwrap();

TemplateProvider { bitcoind }
}

pub fn generate_blocks(&self, n: u64) {
let mining_address = self
.bitcoind
.client
.get_new_address(None, None)
.unwrap()
.require_network(bitcoind::bitcoincore_rpc::bitcoin::Network::Regtest)
.unwrap();
let mining_address = self.bitcoind.client.new_address().unwrap();
self.bitcoind
.client
.generate_to_address(n, &mining_address)
.generate_to_address(n as usize, &mining_address)
.unwrap();
}
}

0 comments on commit 2f5c8e9

Please sign in to comment.