Skip to content

Commit

Permalink
feat: bitcoin core v25 support
Browse files Browse the repository at this point in the history
  • Loading branch information
sander2 committed Jul 19, 2023
1 parent 59b771d commit be4a6b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion bitcoin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
8 changes: 5 additions & 3 deletions bitcoin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,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.
Expand Down Expand Up @@ -293,7 +293,7 @@ async fn connect(rpc: &Client, connection_timeout: Duration) -> Result<Network,
info!("Connected to {}", chain);
info!("Bitcoin version {}", version);

if version >= BITCOIN_CORE_VERSION_23 {
if version >= BITCOIN_CORE_VERSION_26 {
return Err(Error::IncompatibleVersion(version))
}

Expand Down Expand Up @@ -1003,7 +1003,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}");
Expand Down

0 comments on commit be4a6b8

Please sign in to comment.