From 7e085a86ddc7a14ffeb34bffcb4fa4b2825e5cb6 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Wed, 20 Oct 2021 20:09:31 -0700 Subject: [PATCH 1/9] Bump version to 0.13.0-rc.1 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7768ebb6..13dd8547 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bdk" -version = "0.12.1-dev" +version = "0.13.0-rc.1" edition = "2018" authors = ["Alekos Filini ", "Riccardo Casatta "] homepage = "https://bitcoindevkit.org" From b638039655e92d920b9e1f585443288d28f2a983 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Wed, 20 Oct 2021 20:14:10 -0700 Subject: [PATCH 2/9] Fix CHANGELOG for Unreleased, v0.13.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f548bc81..64f21ed0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Exposed `get_tx()` method from `Database` to `Wallet`. ## [v0.12.0] - [v0.11.0] - Activate `miniscript/use-serde` feature to allow consumers of the library to access it via the re-exported `miniscript` crate. - Add support for proxies in `EsploraBlockchain` - Added `SqliteDatabase` that implements `Database` backed by a sqlite database using `rusqlite` crate. -- Exposed `get_tx()` method from `Database` to `Wallet`. ## [v0.11.0] - [v0.10.0] From e106136227eea529cf035b4e18869c637c211fcb Mon Sep 17 00:00:00 2001 From: Alekos Filini Date: Thu, 21 Oct 2021 18:35:03 +0200 Subject: [PATCH 3/9] [ci] Update the stable version to 1.56 (cherry picked from commit a348dbdcfe2fa9abc92eab7286dde1177fef65bd) --- .github/workflows/cont_integration.yml | 4 ++-- examples/compiler.rs | 2 +- src/blockchain/compact_filters/mod.rs | 6 +++--- src/blockchain/compact_filters/peer.rs | 4 ++-- src/blockchain/compact_filters/store.rs | 4 ++-- src/blockchain/compact_filters/sync.rs | 2 +- src/blockchain/rpc.rs | 8 ++++---- src/keys/bip39.rs | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index 992b7ab3..09087a00 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: rust: - - 1.53.0 # STABLE + - 1.56.0 # STABLE - 1.46.0 # MSRV features: - default @@ -135,7 +135,7 @@ jobs: - run: sudo apt-get update || exit 1 - run: sudo apt-get install -y libclang-common-10-dev clang-10 libc6-dev-i386 || exit 1 - name: Set default toolchain - run: rustup default 1.53.0 # STABLE + run: rustup default 1.56.0 # STABLE - name: Set profile run: rustup set profile minimal - name: Add target wasm32 diff --git a/examples/compiler.rs b/examples/compiler.rs index e1af0211..0af034cb 100644 --- a/examples/compiler.rs +++ b/examples/compiler.rs @@ -70,7 +70,7 @@ fn main() -> Result<(), Box> { let policy_str = matches.value_of("POLICY").unwrap(); info!("Compiling policy: {}", policy_str); - let policy = Concrete::::from_str(&policy_str)?; + let policy = Concrete::::from_str(policy_str)?; let descriptor = match matches.value_of("TYPE").unwrap() { "sh" => Descriptor::new_sh(policy.compile()?)?, diff --git a/src/blockchain/compact_filters/mod.rs b/src/blockchain/compact_filters/mod.rs index e057d162..b513d378 100644 --- a/src/blockchain/compact_filters/mod.rs +++ b/src/blockchain/compact_filters/mod.rs @@ -254,7 +254,7 @@ impl Blockchain for CompactFiltersBlockchain { let total_cost = headers_cost + filters_cost + PROCESS_BLOCKS_COST; if let Some(snapshot) = sync::sync_headers( - Arc::clone(&first_peer), + Arc::clone(first_peer), Arc::clone(&self.headers), |new_height| { let local_headers_cost = @@ -275,7 +275,7 @@ impl Blockchain for CompactFiltersBlockchain { let buried_height = synced_height.saturating_sub(sync::BURIED_CONFIRMATIONS); info!("Synced headers to height: {}", synced_height); - cf_sync.prepare_sync(Arc::clone(&first_peer))?; + cf_sync.prepare_sync(Arc::clone(first_peer))?; let all_scripts = Arc::new( database @@ -294,7 +294,7 @@ impl Blockchain for CompactFiltersBlockchain { let mut threads = Vec::with_capacity(self.peers.len()); for peer in &self.peers { let cf_sync = Arc::clone(&cf_sync); - let peer = Arc::clone(&peer); + let peer = Arc::clone(peer); let headers = Arc::clone(&self.headers); let all_scripts = Arc::clone(&all_scripts); let last_synced_block = Arc::clone(&last_synced_block); diff --git a/src/blockchain/compact_filters/peer.rs b/src/blockchain/compact_filters/peer.rs index 683e25db..f415d285 100644 --- a/src/blockchain/compact_filters/peer.rs +++ b/src/blockchain/compact_filters/peer.rs @@ -262,7 +262,7 @@ impl Peer { let message_resp = { let mut lock = responses.write().unwrap(); let message_resp = lock.entry(wait_for).or_default(); - Arc::clone(&message_resp) + Arc::clone(message_resp) }; let (lock, cvar) = &*message_resp; @@ -379,7 +379,7 @@ impl Peer { let message_resp = { let mut lock = reader_thread_responses.write().unwrap(); let message_resp = lock.entry(in_message.cmd()).or_default(); - Arc::clone(&message_resp) + Arc::clone(message_resp) }; let (lock, cvar) = &*message_resp; diff --git a/src/blockchain/compact_filters/store.rs b/src/blockchain/compact_filters/store.rs index da30368e..e2564086 100644 --- a/src/blockchain/compact_filters/store.rs +++ b/src/blockchain/compact_filters/store.rs @@ -760,7 +760,7 @@ impl CfStore { let cf_headers: Vec = filter_hashes .into_iter() .scan(checkpoint, |prev_header, filter_hash| { - let filter_header = filter_hash.filter_header(&prev_header); + let filter_header = filter_hash.filter_header(prev_header); *prev_header = filter_header; Some(filter_header) @@ -801,7 +801,7 @@ impl CfStore { .zip(headers.into_iter()) .scan(checkpoint, |prev_header, ((_, filter_content), header)| { let filter = BlockFilter::new(&filter_content); - if header != filter.filter_header(&prev_header) { + if header != filter.filter_header(prev_header) { return Some(Err(CompactFiltersError::InvalidFilter)); } *prev_header = header; diff --git a/src/blockchain/compact_filters/sync.rs b/src/blockchain/compact_filters/sync.rs index 11bdf4dc..b12268dd 100644 --- a/src/blockchain/compact_filters/sync.rs +++ b/src/blockchain/compact_filters/sync.rs @@ -205,7 +205,7 @@ impl CfSync { let block_hash = self.headers_store.get_block_hash(height)?.unwrap(); // TODO: also download random blocks? - if process(&block_hash, &BlockFilter::new(&filter))? { + if process(&block_hash, &BlockFilter::new(filter))? { log::debug!("Downloading block {}", block_hash); let block = peer diff --git a/src/blockchain/rpc.rs b/src/blockchain/rpc.rs index e88dda45..6d1d94d0 100644 --- a/src/blockchain/rpc.rs +++ b/src/blockchain/rpc.rs @@ -156,7 +156,7 @@ impl Blockchain for RpcBlockchain { .iter() .map(|s| ImportMultiRequest { timestamp: ImportMultiRescanSince::Timestamp(0), - script_pubkey: Some(ImportMultiRequestScriptPubkey::Script(&s)), + script_pubkey: Some(ImportMultiRequestScriptPubkey::Script(s)), watchonly: Some(true), ..Default::default() }) @@ -238,7 +238,7 @@ impl Blockchain for RpcBlockchain { txid, confirmation_time ); known_tx.confirmation_time = confirmation_time; - db.set_tx(&known_tx)?; + db.set_tx(known_tx)?; } } else { //TODO check there is already the raw tx in db? @@ -427,13 +427,13 @@ where { //TODO check descriptors contains only public keys let descriptor = descriptor - .into_wallet_descriptor(&secp, network)? + .into_wallet_descriptor(secp, network)? .0 .to_string(); let mut wallet_name = get_checksum(&descriptor[..descriptor.find('#').unwrap()])?; if let Some(change_descriptor) = change_descriptor { let change_descriptor = change_descriptor - .into_wallet_descriptor(&secp, network)? + .into_wallet_descriptor(secp, network)? .0 .to_string(); wallet_name.push_str( diff --git a/src/keys/bip39.rs b/src/keys/bip39.rs index fbd6231f..c12da624 100644 --- a/src/keys/bip39.rs +++ b/src/keys/bip39.rs @@ -40,7 +40,7 @@ pub type MnemonicWithPassphrase = (Mnemonic, Option); #[cfg_attr(docsrs, doc(cfg(feature = "keys-bip39")))] impl DerivableKey for Seed { fn into_extended_key(self) -> Result, KeyError> { - Ok(bip32::ExtendedPrivKey::new_master(Network::Bitcoin, &self.as_bytes())?.into()) + Ok(bip32::ExtendedPrivKey::new_master(Network::Bitcoin, self.as_bytes())?.into()) } fn into_descriptor_key( From 5f5744e897f44e940e89af9f76d708829b257496 Mon Sep 17 00:00:00 2001 From: Alekos Filini Date: Thu, 21 Oct 2021 19:54:14 +0200 Subject: [PATCH 4/9] Pin version of `backtrace` to maintain our MSRV (cherry picked from commit 548e43d928d1492784dc465a28fa99b9ca263b9f) --- Cargo.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 13dd8547..06f9788d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,9 @@ lazy_static = { version = "1.4", optional = true } # MSRV is 1.46, to fix this until we update our MSRV or replace the tiny-bip39 # dependency https://github.com/bitcoindevkit/bdk/issues/399 we can only use an older version tiny-bip39 = { version = "< 0.8", optional = true } +# backtrace > 0.3.61 includes object v0.27 which doesn't compile on 1.46. this is used by +# tiny-bip39 +backtrace = { version = "=0.3.61", optional = true } bitcoinconsensus = { version = "0.19.0-3", optional = true } @@ -62,7 +65,7 @@ sqlite = ["rusqlite", "ahash"] compact_filters = ["rocksdb", "socks", "lazy_static", "cc"] key-value-db = ["sled"] all-keys = ["keys-bip39"] -keys-bip39 = ["tiny-bip39"] +keys-bip39 = ["tiny-bip39", "backtrace"] rpc = ["core-rpc"] # We currently provide mulitple implementations of `Blockchain`, all are From a2e26f1b57c5b110f7ef9f7d16965ec44341789c Mon Sep 17 00:00:00 2001 From: Alekos Filini Date: Fri, 22 Oct 2021 11:59:01 +0200 Subject: [PATCH 5/9] Pin version of `ureq` to maintain our MSRV (cherry picked from commit d75d221540a0d47b7538b456211f92cdb4d4da8c) --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 06f9788d..3a7097a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ electrum-client = { version = "0.8", optional = true } rusqlite = { version = "0.25.3", optional = true } ahash = { version = "=0.7.4", optional = true } reqwest = { version = "0.11", optional = true, features = ["json"] } -ureq = { version = "2.1", features = ["json"], optional = true } +ureq = { version = "~2.2.0", features = ["json"], optional = true } futures = { version = "0.3", optional = true } async-trait = { version = "0.1", optional = true } rocksdb = { version = "0.14", default-features = false, features = ["snappy"], optional = true } From ee8b992f8bb9f648b0593b9eead877ec1906d154 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Wed, 27 Oct 2021 13:42:01 -0700 Subject: [PATCH 6/9] Update dev-dependencies electrsd to 0.12 --- Cargo.toml | 8 ++++---- src/testutils/blockchain_tests.rs | 22 +++++++++------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3a7097a6..087d9ac5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ backtrace = { version = "=0.3.61", optional = true } bitcoinconsensus = { version = "0.19.0-3", optional = true } # Needed by bdk_blockchain_tests macro -core-rpc = { version = "0.14", optional = true } +bitcoincore-rpc = { version = "0.14", optional = true } # Platform-specific dependencies [target.'cfg(not(target_arch = "wasm32"))'.dependencies] @@ -66,7 +66,7 @@ compact_filters = ["rocksdb", "socks", "lazy_static", "cc"] key-value-db = ["sled"] all-keys = ["keys-bip39"] keys-bip39 = ["tiny-bip39", "backtrace"] -rpc = ["core-rpc"] +rpc = ["bitcoincore-rpc"] # We currently provide mulitple implementations of `Blockchain`, all are # blocking except for the `EsploraBlockchain` which can be either async or @@ -91,7 +91,7 @@ esplora = [] # Debug/Test features -test-blockchains = ["core-rpc", "electrum-client"] +test-blockchains = ["bitcoincore-rpc", "electrum-client"] test-electrum = ["electrum", "electrsd/electrs_0_8_10", "test-blockchains"] test-rpc = ["rpc", "electrsd/electrs_0_8_10", "test-blockchains"] test-esplora = ["electrsd/legacy", "electrsd/esplora_a33e97e1", "test-blockchains"] @@ -101,7 +101,7 @@ test-md-docs = ["electrum"] lazy_static = "1.4" env_logger = "0.7" clap = "2.33" -electrsd = { version= "0.10", features = ["trigger", "bitcoind_0_21_1"] } +electrsd = { version= "0.12", features = ["trigger", "bitcoind_0_21_1"] } [[example]] name = "address_validator" diff --git a/src/testutils/blockchain_tests.rs b/src/testutils/blockchain_tests.rs index 0d1b9167..085745b0 100644 --- a/src/testutils/blockchain_tests.rs +++ b/src/testutils/blockchain_tests.rs @@ -3,11 +3,11 @@ use bitcoin::consensus::encode::{deserialize, serialize}; use bitcoin::hashes::hex::{FromHex, ToHex}; use bitcoin::hashes::sha256d; use bitcoin::{Address, Amount, Script, Transaction, Txid}; +pub use bitcoincore_rpc::bitcoincore_rpc_json::AddressType; +pub use bitcoincore_rpc::{Auth, Client as RpcClient, RpcApi}; use core::str::FromStr; -pub use core_rpc::core_rpc_json::AddressType; -pub use core_rpc::{Auth, Client as RpcClient, RpcApi}; use electrsd::bitcoind::BitcoinD; -use electrsd::{bitcoind, Conf, ElectrsD}; +use electrsd::{bitcoind, ElectrsD}; pub use electrum_client::{Client as ElectrumClient, ElectrumApi}; #[allow(unused_imports)] use log::{debug, error, info, log_enabled, trace, Level}; @@ -24,19 +24,15 @@ pub struct TestClient { impl TestClient { pub fn new(bitcoind_exe: String, electrs_exe: String) -> Self { debug!("launching {} and {}", &bitcoind_exe, &electrs_exe); - let conf = bitcoind::Conf { - view_stdout: log_enabled!(Level::Debug), - ..Default::default() - }; + + let mut conf = bitcoind::Conf::default(); + conf.view_stdout = log_enabled!(Level::Debug); let bitcoind = BitcoinD::with_conf(bitcoind_exe, &conf).unwrap(); - let http_enabled = cfg!(feature = "test-esplora"); + let mut conf = electrsd::Conf::default(); + conf.view_stderr = log_enabled!(Level::Debug); + conf.http_enabled = cfg!(feature = "test-esplora"); - let conf = Conf { - http_enabled, - view_stderr: log_enabled!(Level::Debug), - ..Default::default() - }; let electrsd = ElectrsD::with_conf(electrs_exe, &bitcoind, &conf).unwrap(); let node_address = bitcoind.client.get_new_address(None, None).unwrap(); From 87815997403c3a4652f2ad295d44919f12e45241 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Wed, 27 Oct 2021 13:52:18 -0700 Subject: [PATCH 7/9] Switch back to rust-bitcoin/rust-bitcoincore-rpc --- src/blockchain/rpc.rs | 10 +++++----- src/error.rs | 4 ++-- src/lib.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/blockchain/rpc.rs b/src/blockchain/rpc.rs index 6d1d94d0..d4a5beca 100644 --- a/src/blockchain/rpc.rs +++ b/src/blockchain/rpc.rs @@ -38,13 +38,13 @@ use crate::database::{BatchDatabase, DatabaseUtils}; use crate::descriptor::{get_checksum, IntoWalletDescriptor}; use crate::wallet::utils::SecpCtx; use crate::{ConfirmationTime, Error, FeeRate, KeychainKind, LocalUtxo, TransactionDetails}; -use core_rpc::json::{ +use bitcoincore_rpc::json::{ GetAddressInfoResultLabel, ImportMultiOptions, ImportMultiRequest, ImportMultiRequestScriptPubkey, ImportMultiRescanSince, }; -use core_rpc::jsonrpc::serde_json::Value; -use core_rpc::Auth as RpcAuth; -use core_rpc::{Client, RpcApi}; +use bitcoincore_rpc::jsonrpc::serde_json::Value; +use bitcoincore_rpc::Auth as RpcAuth; +use bitcoincore_rpc::{Client, RpcApi}; use log::debug; use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; @@ -82,7 +82,7 @@ pub struct RpcConfig { pub skip_blocks: Option, } -/// This struct is equivalent to [core_rpc::Auth] but it implements [serde::Serialize] +/// This struct is equivalent to [bitcoincore_rpc::Auth] but it implements [serde::Serialize] /// To be removed once upstream equivalent is implementing Serialize (json serialization format /// should be the same), see [rust-bitcoincore-rpc/pull/181](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/pull/181) #[derive(Clone, Debug, Hash, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)] diff --git a/src/error.rs b/src/error.rs index d2875c81..a51fe215 100644 --- a/src/error.rs +++ b/src/error.rs @@ -139,7 +139,7 @@ pub enum Error { Sled(sled::Error), #[cfg(feature = "rpc")] /// Rpc client error - Rpc(core_rpc::Error), + Rpc(bitcoincore_rpc::Error), #[cfg(feature = "sqlite")] /// Rusqlite client error Rusqlite(rusqlite::Error), @@ -196,7 +196,7 @@ impl_error!(electrum_client::Error, Electrum); #[cfg(feature = "key-value-db")] impl_error!(sled::Error, Sled); #[cfg(feature = "rpc")] -impl_error!(core_rpc::Error, Rpc); +impl_error!(bitcoincore_rpc::Error, Rpc); #[cfg(feature = "sqlite")] impl_error!(rusqlite::Error, Rusqlite); diff --git a/src/lib.rs b/src/lib.rs index 6f2ee58d..37ab33db 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -236,7 +236,7 @@ extern crate bdk_macros; extern crate lazy_static; #[cfg(feature = "rpc")] -pub extern crate core_rpc; +pub extern crate bitcoincore_rpc; #[cfg(feature = "electrum")] pub extern crate electrum_client; From 5cb0726780640a25bcc194611dd69b4623d89267 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Thu, 28 Oct 2021 10:44:56 -0700 Subject: [PATCH 8/9] Bump version to 0.13.0 --- CHANGELOG.md | 5 ++++- Cargo.toml | 2 +- src/lib.rs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64f21ed0..94355f52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [v0.13.0] - [v0.12.0] + - Exposed `get_tx()` method from `Database` to `Wallet`. ## [v0.12.0] - [v0.11.0] @@ -385,4 +387,5 @@ final transaction is created by calling `finish` on the builder. [v0.9.0]: https://github.com/bitcoindevkit/bdk/compare/v0.8.0...v0.9.0 [v0.10.0]: https://github.com/bitcoindevkit/bdk/compare/v0.9.0...v0.10.0 [v0.11.0]: https://github.com/bitcoindevkit/bdk/compare/v0.10.0...v0.11.0 -[v0.12.0]: https://github.com/bitcoindevkit/bdk/compare/v0.11.0...v0.12.0 \ No newline at end of file +[v0.12.0]: https://github.com/bitcoindevkit/bdk/compare/v0.11.0...v0.12.0 +[v0.13.0]: https://github.com/bitcoindevkit/bdk/compare/v0.12.0...v0.13.0 \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 087d9ac5..a503f0e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bdk" -version = "0.13.0-rc.1" +version = "0.13.0" edition = "2018" authors = ["Alekos Filini ", "Riccardo Casatta "] homepage = "https://bitcoindevkit.org" diff --git a/src/lib.rs b/src/lib.rs index 37ab33db..ea1f2990 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,7 +40,7 @@ //! interact with the bitcoin P2P network. //! //! ```toml -//! bdk = "0.12.0" +//! bdk = "0.13.0" //! ``` #![cfg_attr( feature = "electrum", From f6f736609f7027ade9bf3837348c275fb04fc018 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Thu, 28 Oct 2021 13:38:39 -0700 Subject: [PATCH 9/9] Bump version to 0.13.1-dev --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a503f0e5..ea9e8e4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bdk" -version = "0.13.0" +version = "0.13.1-dev" edition = "2018" authors = ["Alekos Filini ", "Riccardo Casatta "] homepage = "https://bitcoindevkit.org"