From 45c17f652fd6df289e50aa9c444fef36141d6cfc Mon Sep 17 00:00:00 2001
From: Kohei Taniguchi
Date: Fri, 28 Nov 2025 14:56:27 +0900
Subject: [PATCH 1/7] Update electrum crate for working on tapyrus blockchain
---
crates/electrum/Cargo.toml | 2 +-
crates/electrum/src/bdk_electrum_client.rs | 2 +-
crates/electrum/tests/test_electrum.rs | 28 +++++++++++-----------
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/crates/electrum/Cargo.toml b/crates/electrum/Cargo.toml
index 1b962389..db4df2e5 100644
--- a/crates/electrum/Cargo.toml
+++ b/crates/electrum/Cargo.toml
@@ -13,7 +13,7 @@ readme = "README.md"
[dependencies]
tdk_chain = { path = "../chain", version = "0.15.0" }
-electrum-client = { version = "0.19" }
+electrum-client = { git = "https://github.com/chaintope/rust-electrum-client", branch = "work_on_tapyrus" }
#rustls = { version = "=0.21.1", optional = true, features = ["dangerous_configuration"] }
[dev-dependencies]
diff --git a/crates/electrum/src/bdk_electrum_client.rs b/crates/electrum/src/bdk_electrum_client.rs
index 53735518..b3a610d5 100644
--- a/crates/electrum/src/bdk_electrum_client.rs
+++ b/crates/electrum/src/bdk_electrum_client.rs
@@ -2,7 +2,7 @@ use core::str::FromStr;
use electrum_client::{ElectrumApi, Error, HeaderNotification};
use std::sync::{Arc, Mutex};
use tdk_chain::{
- bitcoin::{MalFixTxid, OutPoint, ScriptBuf, Transaction},
+ tapyrus::{MalFixTxid, OutPoint, ScriptBuf, Transaction},
collections::{BTreeMap, HashMap, HashSet},
local_chain::CheckPoint,
spk_client::{FullScanRequest, FullScanResult, SyncRequest, SyncResult},
diff --git a/crates/electrum/tests/test_electrum.rs b/crates/electrum/tests/test_electrum.rs
index 241855d5..7d42c501 100644
--- a/crates/electrum/tests/test_electrum.rs
+++ b/crates/electrum/tests/test_electrum.rs
@@ -1,13 +1,13 @@
use bdk_electrum::BdkElectrumClient;
use tdk_chain::{
- bitcoin::{hashes::Hash, Address, Amount, ScriptBuf, WScriptHash},
+ tapyrus::{hashes::Hash, Address, Amount, ScriptBuf, WScriptHash},
keychain::Balance,
local_chain::LocalChain,
spk_client::SyncRequest,
tapyrus::script::color_identifier::ColorIdentifier,
ConfirmationTimeHeightAnchor, IndexedTxGraph, SpkTxOutIndex,
};
-use tdk_testenv::{anyhow, bitcoincore_rpc::RpcApi, TestEnv};
+use tdk_testenv::{anyhow, tapyruscore_rpc::RpcApi, TestEnv};
fn get_balance(
recv_chain: &LocalChain,
@@ -31,7 +31,7 @@ fn get_balance(
/// 4. Check [`Balance`] to ensure tx is confirmed.
#[test]
fn scan_detects_confirmed_tx() -> anyhow::Result<()> {
- const SEND_AMOUNT: Amount = Amount::from_sat(10_000);
+ const SEND_AMOUNT: Amount = Amount::from_tap(10_000);
let env = TestEnv::new()?;
let electrum_client = electrum_client::Client::new(env.electrsd.electrum_url.as_str())?;
@@ -39,15 +39,15 @@ fn scan_detects_confirmed_tx() -> anyhow::Result<()> {
// Setup addresses.
let addr_to_mine = env
- .bitcoind
+ .tapyrusd
.client
- .get_new_address(None, None)?
+ .get_new_address(None)?
.assume_checked();
let spk_to_track = ScriptBuf::new_p2wsh(&WScriptHash::all_zeros());
- let addr_to_track = Address::from_script(&spk_to_track, tdk_chain::bitcoin::Network::Regtest)?;
+ let addr_to_track = Address::from_script(&spk_to_track, tdk_chain::tapyrus::Network::Dev)?;
// Setup receiver.
- let (mut recv_chain, _) = LocalChain::from_genesis_hash(env.bitcoind.client.get_block_hash(0)?);
+ let (mut recv_chain, _) = LocalChain::from_genesis_hash(env.tapyrusd.client.get_block_hash(0)?);
let mut recv_graph = IndexedTxGraph::::new({
let mut recv_index = SpkTxOutIndex::default();
recv_index.insert_spk((), spk_to_track.clone());
@@ -96,9 +96,9 @@ fn scan_detects_confirmed_tx() -> anyhow::Result<()> {
.calculate_fee(&tx.tx)
.expect("fee must exist");
- // Retrieve the fee in the transaction data from `bitcoind`.
+ // Retrieve the fee in the transaction data from `tapyrusd`.
let tx_fee = env
- .bitcoind
+ .tapyrusd
.client
.get_transaction(&tx.txid, None)
.expect("Tx must exist")
@@ -124,7 +124,7 @@ fn scan_detects_confirmed_tx() -> anyhow::Result<()> {
#[test]
fn tx_can_become_unconfirmed_after_reorg() -> anyhow::Result<()> {
const REORG_COUNT: usize = 8;
- const SEND_AMOUNT: Amount = Amount::from_sat(10_000);
+ const SEND_AMOUNT: Amount = Amount::from_tap(10_000);
let env = TestEnv::new()?;
let electrum_client = electrum_client::Client::new(env.electrsd.electrum_url.as_str())?;
@@ -132,15 +132,15 @@ fn tx_can_become_unconfirmed_after_reorg() -> anyhow::Result<()> {
// Setup addresses.
let addr_to_mine = env
- .bitcoind
+ .tapyrusd
.client
- .get_new_address(None, None)?
+ .get_new_address(None)?
.assume_checked();
let spk_to_track = ScriptBuf::new_p2wsh(&WScriptHash::all_zeros());
- let addr_to_track = Address::from_script(&spk_to_track, tdk_chain::bitcoin::Network::Regtest)?;
+ let addr_to_track = Address::from_script(&spk_to_track, tdk_chain::tapyrus::Network::Dev)?;
// Setup receiver.
- let (mut recv_chain, _) = LocalChain::from_genesis_hash(env.bitcoind.client.get_block_hash(0)?);
+ let (mut recv_chain, _) = LocalChain::from_genesis_hash(env.tapyrusd.client.get_block_hash(0)?);
let mut recv_graph = IndexedTxGraph::::new({
let mut recv_index = SpkTxOutIndex::default();
recv_index.insert_spk((), spk_to_track.clone());
From 4dc164a66342c28950ede196615bf7ff4687f62a Mon Sep 17 00:00:00 2001
From: Kohei Taniguchi
Date: Fri, 28 Nov 2025 16:22:58 +0900
Subject: [PATCH 2/7] Update electrum clate name
---
crates/electrum/Cargo.toml | 4 ++--
crates/electrum/src/lib.rs | 4 ++--
crates/electrum/tests/test_electrum.rs | 2 +-
crates/testenv/README.md | 2 +-
crates/wallet/README.md | 4 ++--
example-crates/example_electrum/Cargo.toml | 2 +-
example-crates/example_electrum/src/main.rs | 2 +-
example-crates/wallet_electrum/Cargo.toml | 2 +-
example-crates/wallet_electrum/src/main.rs | 4 ++--
9 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/crates/electrum/Cargo.toml b/crates/electrum/Cargo.toml
index db4df2e5..6a4f07f8 100644
--- a/crates/electrum/Cargo.toml
+++ b/crates/electrum/Cargo.toml
@@ -1,10 +1,10 @@
[package]
-name = "bdk_electrum"
+name = "tdk_electrum"
version = "0.14.0"
edition = "2021"
homepage = "https://bitcoindevkit.org"
repository = "https://github.com/bitcoindevkit/bdk"
-documentation = "https://docs.rs/bdk_electrum"
+documentation = "https://docs.rs/tdk_electrum"
description = "Fetch data from electrum in the form BDK accepts"
license = "MIT OR Apache-2.0"
readme = "README.md"
diff --git a/crates/electrum/src/lib.rs b/crates/electrum/src/lib.rs
index 6209ff12..32fd995e 100644
--- a/crates/electrum/src/lib.rs
+++ b/crates/electrum/src/lib.rs
@@ -15,8 +15,8 @@
#![warn(missing_docs)]
-mod bdk_electrum_client;
-pub use bdk_electrum_client::*;
+mod tdk_electrum_client;
+pub use tdk_electrum_client::*;
pub use electrum_client;
pub use tdk_chain;
diff --git a/crates/electrum/tests/test_electrum.rs b/crates/electrum/tests/test_electrum.rs
index 7d42c501..ade4bcb1 100644
--- a/crates/electrum/tests/test_electrum.rs
+++ b/crates/electrum/tests/test_electrum.rs
@@ -1,4 +1,4 @@
-use bdk_electrum::BdkElectrumClient;
+use tdk_electrum::BdkElectrumClient;
use tdk_chain::{
tapyrus::{hashes::Hash, Address, Amount, ScriptBuf, WScriptHash},
keychain::Balance,
diff --git a/crates/testenv/README.md b/crates/testenv/README.md
index ab300675..6ef9b407 100644
--- a/crates/testenv/README.md
+++ b/crates/testenv/README.md
@@ -2,5 +2,5 @@
This crate sets up a regtest environment with a single [`bitcoind`] node
connected to an [`electrs`] instance. This framework provides the infrastructure
-for testing chain source crates, e.g., [`tdk_chain`], [`bdk_electrum`],
+for testing chain source crates, e.g., [`tdk_chain`], [`tdk_electrum`],
[`tdk_esplora`], etc.
\ No newline at end of file
diff --git a/crates/wallet/README.md b/crates/wallet/README.md
index 61d64dea..f260e758 100644
--- a/crates/wallet/README.md
+++ b/crates/wallet/README.md
@@ -45,7 +45,7 @@ that the `Wallet` can use to update its view of the chain.
**Blockchain Data Sources**
* [`tdk_esplora`]: Grabs blockchain data from Esplora for updating BDK structures.
-* [`bdk_electrum`]: Grabs blockchain data from Electrum for updating BDK structures.
+* [`tdk_electrum`]: Grabs blockchain data from Electrum for updating BDK structures.
* [`bdk_bitcoind_rpc`]: Grabs blockchain data from Bitcoin Core for updating BDK structures.
**Examples**
@@ -223,7 +223,7 @@ conditions.
[`PersistBackend`]: https://docs.rs/tdk_chain/latest/tdk_chain/trait.PersistBackend.html
[`tdk_chain`]: https://docs.rs/tdk_chain/latest
[`tdk_file_store`]: https://docs.rs/tdk_file_store/latest
-[`bdk_electrum`]: https://docs.rs/bdk_electrum/latest
+[`tdk_electrum`]: https://docs.rs/tdk_electrum/latest
[`bdk_esplora`]: https://docs.rs/bdk_esplora/latest
[`bdk_bitcoind_rpc`]: https://docs.rs/bdk_bitcoind_rpc/latest
[`rust-miniscript`]: https://docs.rs/miniscript/latest/miniscript/index.html
diff --git a/example-crates/example_electrum/Cargo.toml b/example-crates/example_electrum/Cargo.toml
index b189bd5b..2ef331d2 100644
--- a/example-crates/example_electrum/Cargo.toml
+++ b/example-crates/example_electrum/Cargo.toml
@@ -7,5 +7,5 @@ edition = "2021"
[dependencies]
tdk_chain = { path = "../../crates/chain", features = ["serde"] }
-bdk_electrum = { path = "../../crates/electrum" }
+tdk_electrum = { path = "../../crates/electrum" }
example_cli = { path = "../example_cli" }
diff --git a/example-crates/example_electrum/src/main.rs b/example-crates/example_electrum/src/main.rs
index 9e8c79aa..dd93c70b 100644
--- a/example-crates/example_electrum/src/main.rs
+++ b/example-crates/example_electrum/src/main.rs
@@ -3,7 +3,7 @@ use std::{
sync::Mutex,
};
-use bdk_electrum::{
+use tdk_electrum::{
electrum_client::{self, Client, ElectrumApi},
BdkElectrumClient,
};
diff --git a/example-crates/wallet_electrum/Cargo.toml b/example-crates/wallet_electrum/Cargo.toml
index 760e77bd..c7f99c43 100644
--- a/example-crates/wallet_electrum/Cargo.toml
+++ b/example-crates/wallet_electrum/Cargo.toml
@@ -5,6 +5,6 @@ edition = "2021"
[dependencies]
tdk_wallet = { path = "../../crates/wallet" }
-bdk_electrum = { path = "../../crates/electrum" }
+tdk_electrum = { path = "../../crates/electrum" }
tdk_file_store = { path = "../../crates/file_store" }
anyhow = "1"
diff --git a/example-crates/wallet_electrum/src/main.rs b/example-crates/wallet_electrum/src/main.rs
index 2a8ecc82..409bac11 100644
--- a/example-crates/wallet_electrum/src/main.rs
+++ b/example-crates/wallet_electrum/src/main.rs
@@ -6,8 +6,8 @@ const BATCH_SIZE: usize = 5;
use std::io::Write;
use std::str::FromStr;
-use bdk_electrum::electrum_client;
-use bdk_electrum::BdkElectrumClient;
+use tdk_electrum::electrum_client;
+use tdk_electrum::BdkElectrumClient;
use tdk_file_store::Store;
use tdk_wallet::bitcoin::{Address, Amount};
use tdk_wallet::chain::collections::HashSet;
From 83749cf2b348bfe38483744a74334f1897541bc6 Mon Sep 17 00:00:00 2001
From: Kohei Taniguchi
Date: Fri, 6 Feb 2026 16:57:52 +0900
Subject: [PATCH 3/7] Update MSRV to 1.88.0
---
.github/workflows/cont_integration.yml | 6 +++---
README.md | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml
index 56167ef8..7d2f2957 100644
--- a/.github/workflows/cont_integration.yml
+++ b/.github/workflows/cont_integration.yml
@@ -15,7 +15,7 @@ jobs:
rust:
- version: stable
clippy: true
- - version: 1.85.0 # MSRV
+ - version: 1.88.0 # MSRV
features:
- --no-default-features --features tapyrus/no-std,miniscript/no-std,hashbrown,blocking,async
- --all-features --features miniscript/std
@@ -31,7 +31,7 @@ jobs:
- name: Rust Cache
uses: Swatinem/rust-cache@v2.2.1
- name: Pin dependencies for MSRV
- if: matrix.rust.version == '1.85.0'
+ if: matrix.rust.version == '1.88.0'
run: |
cargo update -p home --precise "0.5.11"
- name: Build
@@ -122,7 +122,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
- toolchain: 1.85.0
+ toolchain: 1.88.0
components: clippy
override: true
- name: Rust Cache
diff --git a/README.md b/README.md
index d96ffcf0..33d5f8c4 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
-
+
@@ -63,7 +63,7 @@ Fully working examples of how to use these components are in `/example-crates`:
[`tdk_chain`]: https://docs.rs/bdk-chain/
## Minimum Supported Rust Version (MSRV)
-This library should compile with any combination of features with Rust 1.85.0.
+This library should compile with any combination of features with Rust 1.88.0.
To build with the MSRV you will need to pin dependencies as follows:
From 9999c5f384dfce6208351aafef7d38082e1b3d8b Mon Sep 17 00:00:00 2001
From: Kohei Taniguchi
Date: Fri, 6 Feb 2026 17:01:12 +0900
Subject: [PATCH 4/7] fmt
---
...electrum_client.rs => tdk_electrum_client.rs} | 2 +-
crates/electrum/tests/test_electrum.rs | 16 ++++------------
example-crates/example_electrum/src/main.rs | 8 ++++----
3 files changed, 9 insertions(+), 17 deletions(-)
rename crates/electrum/src/{bdk_electrum_client.rs => tdk_electrum_client.rs} (100%)
diff --git a/crates/electrum/src/bdk_electrum_client.rs b/crates/electrum/src/tdk_electrum_client.rs
similarity index 100%
rename from crates/electrum/src/bdk_electrum_client.rs
rename to crates/electrum/src/tdk_electrum_client.rs
index b3a610d5..5ef153d5 100644
--- a/crates/electrum/src/bdk_electrum_client.rs
+++ b/crates/electrum/src/tdk_electrum_client.rs
@@ -2,10 +2,10 @@ use core::str::FromStr;
use electrum_client::{ElectrumApi, Error, HeaderNotification};
use std::sync::{Arc, Mutex};
use tdk_chain::{
- tapyrus::{MalFixTxid, OutPoint, ScriptBuf, Transaction},
collections::{BTreeMap, HashMap, HashSet},
local_chain::CheckPoint,
spk_client::{FullScanRequest, FullScanResult, SyncRequest, SyncResult},
+ tapyrus::{MalFixTxid, OutPoint, ScriptBuf, Transaction},
tx_graph::TxGraph,
BlockId, ConfirmationHeightAnchor, ConfirmationTimeHeightAnchor,
};
diff --git a/crates/electrum/tests/test_electrum.rs b/crates/electrum/tests/test_electrum.rs
index ade4bcb1..7c3c44af 100644
--- a/crates/electrum/tests/test_electrum.rs
+++ b/crates/electrum/tests/test_electrum.rs
@@ -1,12 +1,12 @@
-use tdk_electrum::BdkElectrumClient;
use tdk_chain::{
- tapyrus::{hashes::Hash, Address, Amount, ScriptBuf, WScriptHash},
keychain::Balance,
local_chain::LocalChain,
spk_client::SyncRequest,
tapyrus::script::color_identifier::ColorIdentifier,
+ tapyrus::{hashes::Hash, Address, Amount, ScriptBuf, WScriptHash},
ConfirmationTimeHeightAnchor, IndexedTxGraph, SpkTxOutIndex,
};
+use tdk_electrum::BdkElectrumClient;
use tdk_testenv::{anyhow, tapyruscore_rpc::RpcApi, TestEnv};
fn get_balance(
@@ -38,11 +38,7 @@ fn scan_detects_confirmed_tx() -> anyhow::Result<()> {
let client = BdkElectrumClient::new(electrum_client);
// Setup addresses.
- let addr_to_mine = env
- .tapyrusd
- .client
- .get_new_address(None)?
- .assume_checked();
+ let addr_to_mine = env.tapyrusd.client.get_new_address(None)?.assume_checked();
let spk_to_track = ScriptBuf::new_p2wsh(&WScriptHash::all_zeros());
let addr_to_track = Address::from_script(&spk_to_track, tdk_chain::tapyrus::Network::Dev)?;
@@ -131,11 +127,7 @@ fn tx_can_become_unconfirmed_after_reorg() -> anyhow::Result<()> {
let client = BdkElectrumClient::new(electrum_client);
// Setup addresses.
- let addr_to_mine = env
- .tapyrusd
- .client
- .get_new_address(None)?
- .assume_checked();
+ let addr_to_mine = env.tapyrusd.client.get_new_address(None)?.assume_checked();
let spk_to_track = ScriptBuf::new_p2wsh(&WScriptHash::all_zeros());
let addr_to_track = Address::from_script(&spk_to_track, tdk_chain::tapyrus::Network::Dev)?;
diff --git a/example-crates/example_electrum/src/main.rs b/example-crates/example_electrum/src/main.rs
index dd93c70b..8dace5ab 100644
--- a/example-crates/example_electrum/src/main.rs
+++ b/example-crates/example_electrum/src/main.rs
@@ -3,10 +3,6 @@ use std::{
sync::Mutex,
};
-use tdk_electrum::{
- electrum_client::{self, Client, ElectrumApi},
- BdkElectrumClient,
-};
use example_cli::{
anyhow::{self, Context},
clap::{self, Parser, Subcommand},
@@ -21,6 +17,10 @@ use tdk_chain::{
spk_client::{FullScanRequest, SyncRequest},
Append, ConfirmationHeightAnchor,
};
+use tdk_electrum::{
+ electrum_client::{self, Client, ElectrumApi},
+ BdkElectrumClient,
+};
const DB_MAGIC: &[u8] = b"bdk_example_electrum";
const DB_PATH: &str = ".bdk_example_electrum.db";
From d7111451abc6a0a7de117b14e9ff4abaa8e5e240 Mon Sep 17 00:00:00 2001
From: Kohei Taniguchi
Date: Fri, 6 Feb 2026 17:22:39 +0900
Subject: [PATCH 5/7] fix ci
---
crates/electrum/tests/test_electrum.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/crates/electrum/tests/test_electrum.rs b/crates/electrum/tests/test_electrum.rs
index 7c3c44af..d41a4a4c 100644
--- a/crates/electrum/tests/test_electrum.rs
+++ b/crates/electrum/tests/test_electrum.rs
@@ -3,7 +3,7 @@ use tdk_chain::{
local_chain::LocalChain,
spk_client::SyncRequest,
tapyrus::script::color_identifier::ColorIdentifier,
- tapyrus::{hashes::Hash, Address, Amount, ScriptBuf, WScriptHash},
+ tapyrus::{hashes::Hash, Address, Amount, ScriptBuf, ScriptHash},
ConfirmationTimeHeightAnchor, IndexedTxGraph, SpkTxOutIndex,
};
use tdk_electrum::BdkElectrumClient;
@@ -39,7 +39,7 @@ fn scan_detects_confirmed_tx() -> anyhow::Result<()> {
// Setup addresses.
let addr_to_mine = env.tapyrusd.client.get_new_address(None)?.assume_checked();
- let spk_to_track = ScriptBuf::new_p2wsh(&WScriptHash::all_zeros());
+ let spk_to_track = ScriptBuf::new_p2sh(&ScriptHash::all_zeros());
let addr_to_track = Address::from_script(&spk_to_track, tdk_chain::tapyrus::Network::Dev)?;
// Setup receiver.
@@ -128,7 +128,7 @@ fn tx_can_become_unconfirmed_after_reorg() -> anyhow::Result<()> {
// Setup addresses.
let addr_to_mine = env.tapyrusd.client.get_new_address(None)?.assume_checked();
- let spk_to_track = ScriptBuf::new_p2wsh(&WScriptHash::all_zeros());
+ let spk_to_track = ScriptBuf::new_p2sh(&ScriptHash::all_zeros());
let addr_to_track = Address::from_script(&spk_to_track, tdk_chain::tapyrus::Network::Dev)?;
// Setup receiver.
From 2a7b74fe591a6590afff9491ae03889165ec8e62 Mon Sep 17 00:00:00 2001
From: Kohei Taniguchi
Date: Sat, 7 Feb 2026 10:47:05 +0900
Subject: [PATCH 6/7] fix clippy warnings in tdk_chain
Inline format args and fix doc comment indentation to pass clippy with -D warnings.
Co-Authored-By: Claude Opus 4.6
---
crates/chain/src/keychain/txout_index.rs | 2 +-
crates/chain/src/tx_graph.rs | 7 +++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/crates/chain/src/keychain/txout_index.rs b/crates/chain/src/keychain/txout_index.rs
index e6151067..9d1b00d8 100644
--- a/crates/chain/src/keychain/txout_index.rs
+++ b/crates/chain/src/keychain/txout_index.rs
@@ -579,7 +579,7 @@ impl KeychainTxOutIndex {
next_store_index..next_reveal_index + lookahead,
) {
let _inserted = self.inner.insert_spk((descriptor_id, new_index), new_spk);
- debug_assert!(_inserted, "replenish lookahead: must not have existing spk: keychain={:?}, lookahead={}, next_store_index={}, next_reveal_index={}", keychain, lookahead, next_store_index, next_reveal_index);
+ debug_assert!(_inserted, "replenish lookahead: must not have existing spk: keychain={keychain:?}, lookahead={lookahead}, next_store_index={next_store_index}, next_reveal_index={next_reveal_index}");
}
}
}
diff --git a/crates/chain/src/tx_graph.rs b/crates/chain/src/tx_graph.rs
index b8380341..e00aa286 100644
--- a/crates/chain/src/tx_graph.rs
+++ b/crates/chain/src/tx_graph.rs
@@ -192,8 +192,7 @@ impl fmt::Display for CalculateFeeError {
match self {
CalculateFeeError::MissingTxOut(outpoints) => write!(
f,
- "missing `TxOut` for one or more of the inputs of the tx: {:?}",
- outpoints
+ "missing `TxOut` for one or more of the inputs of the tx: {outpoints:?}"
),
CalculateFeeError::NegativeFee(fee) => write!(
f,
@@ -388,7 +387,7 @@ impl TxGraph {
/// The supplied closure takes in two inputs `(depth, ancestor_tx)`:
///
/// * `depth` is the distance between the starting `Transaction` and the `ancestor_tx`. I.e., if
- /// the `Transaction` is spending an output of the `ancestor_tx` then `depth` will be 1.
+ /// the `Transaction` is spending an output of the `ancestor_tx` then `depth` will be 1.
/// * `ancestor_tx` is the `Transaction`'s ancestor which we are considering to walk.
///
/// The supplied closure returns an `Option`, allowing the caller to map each `Transaction`
@@ -406,7 +405,7 @@ impl TxGraph {
/// The supplied closure takes in two inputs `(depth, descendant_txid)`:
///
/// * `depth` is the distance between the starting `txid` and the `descendant_txid`. I.e., if the
- /// descendant is spending an output of the starting `txid` then `depth` will be 1.
+ /// descendant is spending an output of the starting `txid` then `depth` will be 1.
/// * `descendant_txid` is the descendant's txid which we are considering to walk.
///
/// The supplied closure returns an `Option`, allowing the caller to map each node it visits
From 1dd1828840b795d67309c5fcc4e8b11837d1f644 Mon Sep 17 00:00:00 2001
From: Kohei Taniguchi
Date: Sat, 7 Feb 2026 10:51:18 +0900
Subject: [PATCH 7/7] fix clippy warnings in tdk_chain test files
Inline format args in test assertions and format! calls.
Co-Authored-By: Claude Opus 4.6
---
crates/chain/tests/test_indexed_tx_graph.rs | 2 +-
crates/chain/tests/test_local_chain.rs | 5 ++---
crates/chain/tests/test_tx_graph.rs | 4 ++--
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/crates/chain/tests/test_indexed_tx_graph.rs b/crates/chain/tests/test_indexed_tx_graph.rs
index c80e451b..56601996 100644
--- a/crates/chain/tests/test_indexed_tx_graph.rs
+++ b/crates/chain/tests/test_indexed_tx_graph.rs
@@ -255,7 +255,7 @@ fn test_list_owned_txouts() {
let chain_tip = local_chain
.get(height)
.map(|cp| cp.block_id())
- .unwrap_or_else(|| panic!("block must exist at {}", height));
+ .unwrap_or_else(|| panic!("block must exist at {height}"));
let txouts = graph
.graph()
.filter_chain_txouts(&local_chain, chain_tip, graph.index.outpoints())
diff --git a/crates/chain/tests/test_local_chain.rs b/crates/chain/tests/test_local_chain.rs
index 64f32f4a..8bd88f20 100644
--- a/crates/chain/tests/test_local_chain.rs
+++ b/crates/chain/tests/test_local_chain.rs
@@ -375,10 +375,9 @@ fn local_chain_insert_block() {
assert_eq!(
chain.insert_block(t.insert.into()),
t.expected_result,
- "[{}] unexpected result when inserting block",
- i,
+ "[{i}] unexpected result when inserting block",
);
- assert_eq!(chain, t.expected_final, "[{}] unexpected final chain", i,);
+ assert_eq!(chain, t.expected_final, "[{i}] unexpected final chain",);
}
}
diff --git a/crates/chain/tests/test_tx_graph.rs b/crates/chain/tests/test_tx_graph.rs
index b29cb84a..275d5cef 100644
--- a/crates/chain/tests/test_tx_graph.rs
+++ b/crates/chain/tests/test_tx_graph.rs
@@ -535,7 +535,7 @@ fn test_calculate_fee_on_coinbase() {
fn test_walk_ancestors() {
let local_chain = LocalChain::from_blocks(
(0..=20)
- .map(|ht| (ht, BlockHash::hash(format!("Block Hash {}", ht).as_bytes())))
+ .map(|ht| (ht, BlockHash::hash(format!("Block Hash {ht}").as_bytes())))
.collect(),
)
.expect("must contain genesis hash");
@@ -872,7 +872,7 @@ fn test_descendants_no_repeat() {
fn test_chain_spends() {
let local_chain = LocalChain::from_blocks(
(0..=100)
- .map(|ht| (ht, BlockHash::hash(format!("Block Hash {}", ht).as_bytes())))
+ .map(|ht| (ht, BlockHash::hash(format!("Block Hash {ht}").as_bytes())))
.collect(),
)
.expect("must have genesis hash");