From ecbeeb843f5c6dd1c48d54e747e6d4e8859e6b34 Mon Sep 17 00:00:00 2001 From: Sander Bosma Date: Wed, 19 Jul 2023 17:53:27 +0200 Subject: [PATCH] feat: bitcoin core v25 support --- Cargo.lock | 4 ++-- bitcoin/Cargo.toml | 2 +- bitcoin/src/lib.rs | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 43eb513de..1fb08192e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -406,7 +406,7 @@ dependencies = [ [[package]] name = "bitcoincore-rpc" version = "0.17.0" -source = "git+https://github.com/rust-bitcoin/rust-bitcoincore-rpc?rev=7bd815f1e1ae721404719ee8e6867064b7c68494#7bd815f1e1ae721404719ee8e6867064b7c68494" +source = "git+https://github.com/interlay/rust-bitcoincore-rpc?rev=671a78f638179c8951c9932061fd2bb348313a2c#671a78f638179c8951c9932061fd2bb348313a2c" dependencies = [ "bitcoin-private", "bitcoincore-rpc-json", @@ -419,7 +419,7 @@ dependencies = [ [[package]] name = "bitcoincore-rpc-json" version = "0.17.0" -source = "git+https://github.com/rust-bitcoin/rust-bitcoincore-rpc?rev=7bd815f1e1ae721404719ee8e6867064b7c68494#7bd815f1e1ae721404719ee8e6867064b7c68494" +source = "git+https://github.com/interlay/rust-bitcoincore-rpc?rev=671a78f638179c8951c9932061fd2bb348313a2c#671a78f638179c8951c9932061fd2bb348313a2c" dependencies = [ "bitcoin 0.30.1", "bitcoin-private", diff --git a/bitcoin/Cargo.toml b/bitcoin/Cargo.toml index e4a0195ea..253422993 100644 --- a/bitcoin/Cargo.toml +++ b/bitcoin/Cargo.toml @@ -13,7 +13,7 @@ light-client = [] [dependencies] thiserror = "1.0" -bitcoincore-rpc = { git = "https://github.com/rust-bitcoin/rust-bitcoincore-rpc", rev = "7bd815f1e1ae721404719ee8e6867064b7c68494" } +bitcoincore-rpc = { git = "https://github.com/interlay/rust-bitcoincore-rpc", rev = "671a78f638179c8951c9932061fd2bb348313a2c" } hex = "0.4.2" async-trait = "0.1.40" tokio = { version = "1.0", features = ["full"] } diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs index fe5148c30..e2c7719d1 100644 --- a/bitcoin/src/lib.rs +++ b/bitcoin/src/lib.rs @@ -74,7 +74,7 @@ pub const DEFAULT_MAX_TX_COUNT: usize = 100_000_000; /// the bitcoin core version. /// See https://github.com/bitcoin/bitcoin/blob/833add0f48b0fad84d7b8cf9373a349e7aef20b4/src/rpc/net.cpp#L627 /// and https://github.com/bitcoin/bitcoin/blob/833add0f48b0fad84d7b8cf9373a349e7aef20b4/src/clientversion.h#L33-L37 -pub const BITCOIN_CORE_VERSION_23: usize = 230_000; +pub const BITCOIN_CORE_VERSION_26: usize = 260_000; const NOT_IN_MEMPOOL_ERROR_CODE: i32 = BitcoinRpcError::RpcInvalidAddressOrKey as i32; // Time to sleep before retry on startup. @@ -283,7 +283,7 @@ async fn connect(rpc: &Client, connection_timeout: Duration) -> Result= BITCOIN_CORE_VERSION_23 { + if version >= BITCOIN_CORE_VERSION_26 { return Err(Error::IncompatibleVersion(version)) } @@ -1052,7 +1052,9 @@ impl BitcoinCoreApi for BitcoinCore { } else { info!("Creating wallet {wallet_name}..."); // wallet does not exist, create - let result = self.rpc.create_wallet(wallet_name, None, None, None, None)?; + let result = self + .rpc + .create_wallet(wallet_name, None, None, None, None, Some(false))?; if let Some(warning) = result.warning { if !warning.is_empty() { warn!("Received warning while creating wallet {wallet_name}: {warning}");