From effba3d160a47a3f3c8716829d16a8d63fcba247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=97=E5=AE=87?= Date: Wed, 14 May 2025 15:28:22 +1000 Subject: [PATCH 1/4] chore: Update `Cargo.toml` for initial release --- Cargo.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9caf3c9..5ee0ff5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,8 @@ edition = "2021" rust-version = "1.63" homepage = "https://bitcoindevkit.org" repository = "https://github.com/bitcoindevkit/bdk-tx" +documentation = "https://docs.rs/bdk_tx" +description = "Bitcoin transaction building library." license = "MIT OR Apache-2.0" readme = "README.md" @@ -16,9 +18,9 @@ bdk_coin_select = "0.4.0" anyhow = "1" bdk_tx = { path = "." } bitcoin = { version = "0.32", features = ["rand-std"] } -bdk_testenv = "0.11.1" -bdk_bitcoind_rpc = "0.18.0" -bdk_chain = { version = "0.21" } +bdk_testenv = "0.12" +bdk_bitcoind_rpc = "0.19" +bdk_chain = { version = "0.22" } [features] default = ["std"] From 0954b39836a071b0bd504cdcfc943180bf40166d Mon Sep 17 00:00:00 2001 From: valued mammal Date: Thu, 15 May 2025 11:26:14 -0400 Subject: [PATCH 2/4] Bump deps and update example code --- Cargo.toml | 6 +++--- examples/common.rs | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5ee0ff5..bc5f5be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,9 +18,9 @@ bdk_coin_select = "0.4.0" anyhow = "1" bdk_tx = { path = "." } bitcoin = { version = "0.32", features = ["rand-std"] } -bdk_testenv = "0.12" -bdk_bitcoind_rpc = "0.19" -bdk_chain = { version = "0.22" } +bdk_testenv = "0.13.0" +bdk_bitcoind_rpc = "0.20.0" +bdk_chain = { version = "0.23.0" } [features] default = ["std"] diff --git a/examples/common.rs b/examples/common.rs index 27ef00c..cebda98 100644 --- a/examples/common.rs +++ b/examples/common.rs @@ -1,7 +1,9 @@ use std::sync::Arc; -use bdk_bitcoind_rpc::Emitter; -use bdk_chain::{bdk_core, Anchor, Balance, ChainPosition, ConfirmationBlockTime}; +use bdk_bitcoind_rpc::{Emitter, NO_EXPECTED_MEMPOOL_TXIDS}; +use bdk_chain::{ + bdk_core, Anchor, Balance, CanonicalizationParams, ChainPosition, ConfirmationBlockTime, +}; use bdk_testenv::{bitcoincore_rpc::RpcApi, TestEnv}; use bdk_tx::{CanonicalUnspents, Input, InputCandidates, RbfParams, TxStatus, TxWithStatus}; use bitcoin::{absolute, Address, BlockHash, OutPoint, Transaction, Txid}; @@ -38,7 +40,7 @@ impl Wallet { pub fn sync(&mut self, env: &TestEnv) -> anyhow::Result<()> { let client = env.rpc_client(); let last_cp = self.chain.tip(); - let mut emitter = Emitter::new(client, last_cp, 0); + let mut emitter = Emitter::new(client, last_cp, 0, NO_EXPECTED_MEMPOOL_TXIDS); while let Some(event) = emitter.next_block()? { let _ = self .graph @@ -46,7 +48,9 @@ impl Wallet { let _ = self.chain.apply_update(event.checkpoint); } let mempool = emitter.mempool()?; - let _ = self.graph.batch_insert_relevant_unconfirmed(mempool); + let _ = self + .graph + .batch_insert_relevant_unconfirmed(mempool.new_txs); Ok(()) } @@ -60,6 +64,7 @@ impl Wallet { self.graph.graph().balance( &self.chain, self.chain.tip().block_id(), + CanonicalizationParams::default(), outpoints, |_, _| true, ) @@ -121,7 +126,11 @@ impl Wallet { } self.graph .graph() - .list_canonical_txs(&self.chain, self.chain.tip().block_id()) + .list_canonical_txs( + &self.chain, + self.chain.tip().block_id(), + CanonicalizationParams::default(), + ) .map(|c_tx| (c_tx.tx_node.tx, status_from_position(c_tx.chain_position))) } From ea61aff252f3194b2801341775a61db6de1148f4 Mon Sep 17 00:00:00 2001 From: valued mammal Date: Fri, 30 May 2025 09:20:29 -0400 Subject: [PATCH 3/4] fix: temporarily allow clippy lints - `large_enum_variant` - `result_large_error` These are planned to be addressed in a future PR. --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 2e52602..bc72429 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,8 @@ //! `bdk_tx` +// FIXME: try to remove clippy "allows" +#![allow(clippy::large_enum_variant)] +#![allow(clippy::result_large_err)] #![warn(missing_docs)] #![no_std] From d7eae73bc1e8c122e65d745cb2ad7810cb73213c Mon Sep 17 00:00:00 2001 From: valued mammal Date: Fri, 30 May 2025 09:30:19 -0400 Subject: [PATCH 4/4] Fix crate collections for no-std Add missing type alias for `HashSet`, and better separation of cfg feature attributes. --- src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index bc72429..bcdf894 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,14 +35,17 @@ pub use selection::*; pub use selector::*; pub use signer::*; +#[cfg(feature = "std")] pub(crate) mod collections { #![allow(unused)] - - #[cfg(feature = "std")] pub use std::collections::*; +} - #[cfg(not(feature = "std"))] +#[cfg(not(feature = "std"))] +pub(crate) mod collections { + #![allow(unused)] pub type HashMap = alloc::collections::BTreeMap; + pub type HashSet = alloc::collections::BTreeSet; pub use alloc::collections::*; }