From 49c1635843915f54ce78e6361e7086575285c819 Mon Sep 17 00:00:00 2001 From: rustaceanrob Date: Fri, 4 Jul 2025 11:00:57 +0100 Subject: [PATCH 1/2] dep: bump `bdk_kyoto` to recent patch Adding a patch to the DNS queries to make the results more reliable --- bdk-ffi/Cargo.lock | 8 ++++---- bdk-ffi/Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bdk-ffi/Cargo.lock b/bdk-ffi/Cargo.lock index a5f2aebe..0281b4fa 100644 --- a/bdk-ffi/Cargo.lock +++ b/bdk-ffi/Cargo.lock @@ -164,9 +164,9 @@ dependencies = [ [[package]] name = "bdk_kyoto" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adeefeb8b453b966761b2b965daeeed163b5ee6984f19daed969d7c90b3ead58" +checksum = "1bb33172976f7fa26115ad6842f7903a2af325544eac6ddf5a17099e3cd9df3c" dependencies = [ "bdk_wallet", "kyoto-cbf", @@ -577,9 +577,9 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "kyoto-cbf" -version = "0.13.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00ee7b57630516848fe664babc355b07e13a0dd026b8b5795db666908f37883a" +checksum = "805f16bcf1d4738529f230404e7d0ab6e9ecf9e265920c212d446a291a93297e" dependencies = [ "bip324", "bitcoin", diff --git a/bdk-ffi/Cargo.toml b/bdk-ffi/Cargo.toml index 51f579db..30133069 100644 --- a/bdk-ffi/Cargo.toml +++ b/bdk-ffi/Cargo.toml @@ -21,7 +21,7 @@ default = ["uniffi/cli"] bdk_wallet = { version = "2.0.0", features = ["all-keys", "keys-bip39", "rusqlite"] } bdk_esplora = { version = "0.22.0", default-features = false, features = ["std", "blocking", "blocking-https-rustls"] } bdk_electrum = { version = "0.23.0", default-features = false, features = ["use-rustls-ring"] } -bdk_kyoto = { version = "0.13.0" } +bdk_kyoto = { version = "0.13.1" } uniffi = { version = "=0.29.1" } thiserror = "1.0.58" From cd9b71ccb53d69dc7448d855ab47ee7fc94b1856 Mon Sep 17 00:00:00 2001 From: rustaceanrob Date: Sat, 5 Jul 2025 19:43:10 +0100 Subject: [PATCH 2/2] feat(kyoto): add avg feerate and connect Users may want to add a `Peer` while the node is running, perhaps after the user updates a list. This is easily done. Developers that are working on desktop or even server platforms may have less strict bandwidth requirements than in the mobile case. These users could make use of fetching the average fee rate for a block, which could be used in some cases to fall-back or roughly estimate fee rates with. --- bdk-ffi/src/kyoto.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bdk-ffi/src/kyoto.rs b/bdk-ffi/src/kyoto.rs index 852ff2a0..e836ddf5 100644 --- a/bdk-ffi/src/kyoto.rs +++ b/bdk-ffi/src/kyoto.rs @@ -23,6 +23,7 @@ use std::time::Duration; use tokio::sync::Mutex; +use crate::bitcoin::BlockHash; use crate::bitcoin::Transaction; use crate::error::{CbfBuilderError, CbfError}; use crate::types::Update; @@ -340,6 +341,27 @@ impl CbfClient { .map(|fee| Arc::new(FeeRate(fee))) } + /// Fetch the average fee rate for a block by requesting it from a peer. Not recommend for + /// resource-limited devices. + pub async fn average_fee_rate( + &self, + blockhash: Arc, + ) -> Result, CbfError> { + let fee_rate = self + .sender + .average_fee_rate(blockhash.0) + .await + .map_err(|_| CbfError::NodeStopped)?; + Ok(Arc::new(fee_rate.into())) + } + + /// Add another [`Peer`] to attempt a connection with. + pub fn connect(&self, peer: Peer) -> Result<(), CbfError> { + self.sender + .add_peer(peer) + .map_err(|_| CbfError::NodeStopped) + } + /// Query a Bitcoin DNS seeder using the configured resolver. /// /// This is **not** a generic DNS implementation. Host names are prefixed with a `x849` to filter