From 6c371b191c97a50e6b567e1ff628c4a7dced1e92 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Thu, 31 Mar 2022 20:36:14 -0700 Subject: [PATCH] Update bdk-reserves to 0.17 and re-enable ci tests --- .github/workflows/cont_integration.yml | 10 ++--- Cargo.lock | 61 ++++++++++++-------------- Cargo.toml | 2 +- src/lib.rs | 31 ++++++++----- 4 files changed, 53 insertions(+), 51 deletions(-) diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index 3a0745a..6582732 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -19,11 +19,11 @@ jobs: - esplora-reqwest - compiler - compact_filters -# - reserves -# - reserves,electrum -# - reserves,esplora-ureq -# - reserves,compact_filters -# - reserves,rpc + - reserves + - reserves,electrum + - reserves,esplora-ureq + - reserves,compact_filters + - reserves,rpc - rpc - electrum,verify steps: diff --git a/Cargo.lock b/Cargo.lock index 5b03c27..aff727e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -78,24 +78,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "bdk" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3face7de38293a2f7e2a9f69a48b442f28e864da0fc7a6a977388e31bdc367d7" -dependencies = [ - "async-trait", - "bdk-macros", - "bitcoin", - "js-sys", - "log", - "miniscript", - "rand", - "serde", - "serde_json", - "tokio", -] - [[package]] name = "bdk" version = "0.17.0" @@ -131,7 +113,7 @@ name = "bdk-cli" version = "0.5.0" dependencies = [ "base64 0.11.0", - "bdk 0.17.0", + "bdk", "bdk-macros", "bdk-reserves", "clap", @@ -159,12 +141,12 @@ dependencies = [ [[package]] name = "bdk-reserves" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85397162a769b6162033c4ed8edc6285d347006eac5299dd186dee7bd77e8c88" +checksum = "caf154487aa14256d6f3769baf6c80b56c945a0a1c825a7f3132878acbc8ede0" dependencies = [ "base64 0.11.0", - "bdk 0.16.1", + "bdk", "bitcoinconsensus", "log", ] @@ -640,9 +622,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "h2" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62eeb471aa3e3c9197aa4bfeabfe02982f6dc96f750486c0bb0009ac58b26d2b" +checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" dependencies = [ "bytes", "fnv", @@ -862,10 +844,11 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ + "autocfg", "scopeguard", ] @@ -1158,18 +1141,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae183fc1b06c149f0c1793e1eb447c8b04bfe46d48e9e48bfb8d2d7ed64ecf0" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7776223e2696f1aa4c6b0170e83212f47296a00424305117d013dfe86fb0fe55" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom 0.2.6", "redox_syscall", @@ -1576,16 +1559,16 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.9" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" +checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" dependencies = [ "bytes", "futures-core", "futures-sink", - "log", "pin-project-lite", "tokio", + "tracing", ] [[package]] @@ -1602,9 +1585,21 @@ checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" dependencies = [ "cfg-if", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" version = "0.1.23" diff --git a/Cargo.toml b/Cargo.toml index de9f7f2..0ed9caa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ dirs-next = { version = "2.0", optional = true } env_logger = { version = "0.7", optional = true } clap = { version = "2.33", optional = true } regex = { version = "1", optional = true } -bdk-reserves = { version = "0.16", optional = true} +bdk-reserves = { version = "0.17", optional = true} [features] default = ["cli", "repl"] diff --git a/src/lib.rs b/src/lib.rs index 6c8c19d..d5d37c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -124,7 +124,15 @@ use bdk::bitcoin::secp256k1::Secp256k1; use bdk::bitcoin::util::bip32::{DerivationPath, ExtendedPrivKey, KeySource}; use bdk::bitcoin::util::psbt::PartiallySignedTransaction; use bdk::bitcoin::{Address, Network, OutPoint, Script, Txid}; -#[cfg(feature = "reserves")] +#[cfg(all( + feature = "reserves", + any( + feature = "electrum", + feature = "esplora", + feature = "compact_filters", + feature = "rpc" + ) +))] use bdk::blockchain::Capability; #[cfg(any( feature = "electrum", @@ -1136,12 +1144,11 @@ where } => { let psbt = base64::decode(&psbt).unwrap(); let psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap(); - let current_height = wallet.client().get_height()?; + let current_height = blockchain.get_height()?; let max_confirmation_height = if confirmations == 0 { None } else { - if !wallet - .client() + if !blockchain .get_capabilities() .contains(&Capability::GetAnyTx) { @@ -1421,14 +1428,14 @@ mod test { use bdk::miniscript::bitcoin::network::constants::Network::Testnet; #[cfg(all(feature = "reserves", feature = "electrum"))] use bdk::{ - blockchain::{noop_progress, ElectrumBlockchain}, - database::MemoryDatabase, - electrum_client::Client, - Wallet, + blockchain::ElectrumBlockchain, database::MemoryDatabase, electrum_client::Client, Wallet, }; use std::str::{self, FromStr}; use structopt::StructOpt; + #[cfg(all(feature = "reserves", feature = "electrum",))] + use crate::bdk::SyncOptions; + #[test] fn test_parse_wallet_get_new_address() { let cli_args = vec!["bdk-cli", "--network", "bitcoin", "wallet", @@ -2279,16 +2286,16 @@ mod test { let message = "Those coins belong to Satoshi Nakamoto"; let client = Client::new("ssl://electrum.blockstream.info:60002").unwrap(); + let blockchain = ElectrumBlockchain::from(client); let wallet = Wallet::new( &descriptor, None, Network::Testnet, MemoryDatabase::default(), - ElectrumBlockchain::from(client), ) .unwrap(); - wallet.sync(noop_progress(), None).unwrap(); + wallet.sync(&blockchain, SyncOptions::default()).unwrap(); let balance = wallet.get_balance().unwrap(); let addr = wallet.get_address(bdk::wallet::AddressIndex::New).unwrap(); @@ -2317,7 +2324,7 @@ mod test { } => online_subcommand, _ => panic!("unexpected subcommand"), }; - let result = handle_online_wallet_subcommand(&wallet, wallet_subcmd).unwrap(); + let result = handle_online_wallet_subcommand(&wallet, &blockchain, wallet_subcmd).unwrap(); let psbt: PartiallySignedTransaction = serde_json::from_str(&result.as_object().unwrap().get("psbt").unwrap().to_string()) .unwrap(); @@ -2355,7 +2362,7 @@ mod test { } => online_subcommand, _ => panic!("unexpected subcommand"), }; - let result = handle_online_wallet_subcommand(&wallet, wallet_subcmd).unwrap(); + let result = handle_online_wallet_subcommand(&wallet, &blockchain, wallet_subcmd).unwrap(); let spendable = result .as_object() .unwrap()