Skip to content
Open
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
97 changes: 55 additions & 42 deletions Cargo.lock

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

11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ readme = "README.md"
license = "MIT"

[dependencies]
bdk_wallet = { version = "2.4.0", features = ["rusqlite", "keys-bip39", "compiler", "std"] }
bdk_wallet = { version = "3.1.0", features = ["rusqlite", "keys-bip39", "compiler", "std"] }
clap = { version = "4.6", features = ["derive","env"] }
clap_complete = "4.6"
dirs = { version = "6.0.0" }
Expand All @@ -32,14 +32,14 @@ tap = "1.0.1"
bdk_bitcoind_rpc = { version = "0.22.0", features = ["std"], optional = true }
bdk_electrum = { version = "0.24.0", optional = true }
bdk_esplora = { version = "0.22.2", features = ["async-https", "tokio"], optional = true }
bdk_kyoto = { version = "0.15.4", optional = true }
bdk_redb = { version = "0.1.1", optional = true }
bdk_kyoto = { version = "0.17.0", optional = true }
bdk_redb = { version = "0.2.0", optional = true }
bdk_sp = { version = "0.1.0", optional = true, git = "https://github.com/bitcoindevkit/bdk-sp", tag = "v0.1.0" }
shlex = { version = "1.3.0", optional = true }
payjoin = { version = "0.25.0", features = ["v1", "v2", "io", "_test-utils"], optional = true}
reqwest = { version = "0.13.2", default-features = false, features = ["rustls"], optional = true }
url = { version = "2.5.8", optional = true }
bdk_bip322 = { version = "0.1.0", optional = true }
# bdk_bip322 = { version = "0.1.0", optional = true }
bitcoin-payment-instructions = { version = "0.7.0", optional = true}

[features]
Expand All @@ -61,7 +61,7 @@ dns_payment = ["bitcoin-payment-instructions"]

# Internal features
_payjoin-dependencies = ["payjoin", "reqwest", "url", "sqlite"]
bip322 = ["bdk_bip322"]
# bip322 = ["bdk_bip322"]

# Use this to consensus verify transactions at sync time
verify = []
Expand All @@ -74,7 +74,6 @@ compiler = []
silent-payments = ["dep:bdk_sp"]

[dev-dependencies]
claims = "0.8.0"
predicates = "3.0"
tempfile = "3.8"
assert_cmd = "2.2.2"
Expand Down
37 changes: 13 additions & 24 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ use {
};

#[cfg(feature = "cbf")]
use {
crate::utils::trace_logger,
bdk_kyoto::{BuilderExt, LightClient},
};
use {crate::utils::trace_logger, bdk_kyoto::BuilderExt};

#[cfg(any(
feature = "electrum",
Expand Down Expand Up @@ -101,14 +98,10 @@ impl BlockchainClient {
#[cfg(feature = "cbf")]
Self::KyotoClient { client } => {
let txid = tx.compute_txid();
let wtxid = client
.requester
.broadcast_random(tx.clone())
.await
.map_err(|_| {
tracing::warn!("Broadcast was unsuccessful");
Error::Generic("Transaction broadcast timed out after 30 seconds".into())
})?;
let wtxid = client.requester.submit_package(tx).await.map_err(|_| {
tracing::warn!("Broadcast was unsuccessful");
Error::Generic("Transaction broadcast timed out after 30 seconds".into())
})?;
tracing::info!("Successfully broadcast WTXID: {wtxid}");
Ok(txid)
}
Expand Down Expand Up @@ -205,7 +198,8 @@ impl BlockchainClient {
#[cfg(feature = "cbf")]
pub struct KyotoClientHandle {
pub requester: bdk_kyoto::Requester,
pub update_subscriber: tokio::sync::Mutex<bdk_kyoto::UpdateSubscriber>,
pub update_subscriber:
tokio::sync::Mutex<bdk_kyoto::UpdateSubscriber<bdk_kyoto::wallets::Single>>,
}

#[cfg(any(
Expand Down Expand Up @@ -267,21 +261,16 @@ pub(crate) fn new_blockchain_client(
.data_dir(&_datadir)
.build_with_wallet(_wallet, scan_type)?;

let LightClient {
requester,
info_subscriber,
warning_subscriber,
update_subscriber,
node,
} = light_client;
let (client, logging, update_subscriber) = light_client.subscribe();
// `start()` spawns the node's run loop on a tokio task internally.
let requester = client.start().requester();

let subscriber = tracing_subscriber::FmtSubscriber::new();
let _ = tracing::subscriber::set_global_default(subscriber);

tokio::task::spawn(async move { node.run().await });
tokio::task::spawn(
async move { trace_logger(info_subscriber, warning_subscriber).await },
);
tokio::task::spawn(async move {
trace_logger(logging.info_subscriber, logging.warning_subscriber).await
});

BlockchainClient::KyotoClient {
client: Box::new(KyotoClientHandle {
Expand Down
Loading
Loading