Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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.13.0"
bdk_bitcoind_rpc = "0.20.0"
bdk_chain = { version = "0.23.0" }

[features]
default = ["std"]
Expand Down
19 changes: 14 additions & 5 deletions examples/common.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -38,15 +40,17 @@ 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
.apply_block_relevant(&event.block, event.block_height());
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(())
}

Expand All @@ -60,6 +64,7 @@ impl Wallet {
self.graph.graph().balance(
&self.chain,
self.chain.tip().block_id(),
CanonicalizationParams::default(),
outpoints,
|_, _| true,
)
Expand Down Expand Up @@ -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)))
}

Expand Down
12 changes: 9 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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]

Expand Down Expand Up @@ -32,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<K, V> = alloc::collections::BTreeMap<K, V>;
pub type HashSet<T> = alloc::collections::BTreeSet<T>;
pub use alloc::collections::*;
}

Expand Down