From 7e67ca3ddf1174d42b02b15007b36ebb25b7e84a Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Fri, 2 Sep 2022 14:48:30 +0530 Subject: [PATCH] Update to bdk v0.22.0 This commit adds patches to update to bdk v0.22. Fixes some imports. Refers to bdk-reserve as the open PR that updates bdk-reserve to bdk v0.22.0. --- Cargo.lock | 10 ++++------ Cargo.toml | 9 +++++++-- src/utils.rs | 4 ++-- tests/integration.rs | 14 ++++++++++++-- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index db1c8e9..ad3d350 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,9 +97,8 @@ dependencies = [ [[package]] name = "bdk" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0becbf5a97855daca6717ff920c52a779cebf655b23ae1427e5366d2661e82" +version = "0.22.0-rc.1" +source = "git+https://github.com/bitcoindevkit/bdk?tag=0.22.0-rc.1#f2e12d0ccd83ac614eb1d2347cdade96dbfb0074" dependencies = [ "ahash", "async-trait", @@ -159,9 +158,8 @@ dependencies = [ [[package]] name = "bdk-reserves" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74853196bf39a8bbe3be5650c130c7e95b38fdaeae874df1dd100729d68ef4cf" +version = "0.22.0" +source = "git+https://github.com/bitcoindevkit/bdk-reserves.git?rev=refs/pull/11/head#dadb44ccb5a596154bd2ee159feeb8b4a3ebcaee" dependencies = [ "bdk", "bitcoinconsensus", diff --git a/Cargo.toml b/Cargo.toml index 8522b20..ebe868e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ readme = "README.md" license = "MIT" [dependencies] -bdk = { version = "0.20", default-features = false, features = ["all-keys"]} +bdk = { version = "0.22.0-rc.1", default-features = false, features = ["all-keys"]} bdk-macros = "0.6" structopt = "0.3" serde_json = "1.0" @@ -25,9 +25,14 @@ env_logger = "0.7" rustyline = { version = "~9.0", optional = true } fd-lock = { version = "=3.0.2", optional = true } regex = { version = "1", optional = true } -bdk-reserves = { version = "0.20", optional = true} +#bdk-reserves = { version = "0.22", optional = true} +bdk-reserves = { git = "https://github.com/bitcoindevkit/bdk-reserves.git", rev = "refs/pull/11/head", optional = true} electrsd = { version= "0.19", features = ["bitcoind_22_0"], optional = true} + +[patch.crates-io] +bdk = { git = "https://github.com/bitcoindevkit/bdk", tag = "0.22.0-rc.1"} + [features] default = ["repl", "sqlite-db"] diff --git a/src/utils.rs b/src/utils.rs index 1b8020e..775c611 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -28,7 +28,7 @@ use bdk::blockchain::compact_filters::{BitcoinPeerConfig, CompactFiltersBlockcha #[cfg(feature = "esplora")] use bdk::blockchain::esplora::EsploraBlockchainConfig; #[cfg(feature = "rpc")] -use bdk::blockchain::rpc::{Auth, RpcConfig}; +use bdk::blockchain::rpc::{Auth, RpcConfig, RpcSyncParams}; #[cfg(feature = "electrum")] use bdk::blockchain::ElectrumBlockchainConfig; #[cfg(any( @@ -458,7 +458,7 @@ pub(crate) fn new_blockchain( auth, network: _network, wallet_name, - skip_blocks: wallet_opts.rpc_opts.skip_blocks, + sync_params: Some(RpcSyncParams::default()), }; AnyBlockchainConfig::Rpc(rpc_config) diff --git a/tests/integration.rs b/tests/integration.rs index 52b9a59..01d7683 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -225,8 +225,18 @@ mod test { // Get the balance let balance_json = bdk_cli.wallet_exec(&["get_balance"]).unwrap(); - let balance = get_value(&balance_json, "satoshi").unwrap(); - assert_eq!(balance, "1000000000"); + let confirmed_balance = balance_json + .as_object() + .unwrap() + .get("satoshi") + .unwrap() + .as_object() + .unwrap() + .get("confirmed") + .unwrap() + .as_u64() + .unwrap(); + assert_eq!(confirmed_balance, 1000000000u64); } #[test]