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: 4 additions & 4 deletions bdk-ffi/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 22 additions & 0 deletions bdk-ffi/src/kyoto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<BlockHash>,
) -> Result<Arc<FeeRate>, 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
Expand Down
Loading