]> Untitled Git - bdk-cli/commitdiff
fix(kyoto): remove conn requirement to send tx
authorrustaceanrob <rob.netzke@gmail.com>
Tue, 17 Jun 2025 12:36:59 +0000 (13:36 +0100)
committerrustaceanrob <rob.netzke@gmail.com>
Wed, 18 Jun 2025 10:24:50 +0000 (11:24 +0100)
Kyoto now holds on to a transaction internally until it is successfully
broadcast, so we can broadcast the transaction immediately once the node
starts up, and wait for a confirmation or 30 second timeout

src/handlers.rs

index e3f260558ab98b57ecb7752312334402be74681a..370681a3e27365ae6b026947f16cc48ad140991a 100644 (file)
@@ -576,19 +576,10 @@ pub(crate) async fn handle_online_wallet_subcommand(
                         }
                     });
                     let txid = tx.compute_txid();
-                    tracing::info!("Waiting for connections to broadcast...");
-                    while let Some(info) = info_subscriber.recv().await {
-                        match info {
-                            Info::ConnectionsMet => {
-                                requester
-                                    .broadcast_random(tx.clone())
-                                    .map_err(|e| Error::Generic(format!("{}", e)))?;
-                                break;
-                            }
-                            _ => tracing::info!("{info}"),
-                        }
-                    }
-                    tokio::time::timeout(tokio::time::Duration::from_secs(15), async move {
+                    requester
+                        .broadcast_random(tx.clone())
+                        .map_err(|e| Error::Generic(format!("{}", e)))?;
+                    tokio::time::timeout(tokio::time::Duration::from_secs(30), async move {
                         while let Some(info) = info_subscriber.recv().await {
                             match info {
                                 Info::TxGossiped(wtxid) => {
@@ -606,7 +597,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
                     .await
                     .map_err(|_| {
                         tracing::warn!("Broadcast was unsuccessful");
-                        Error::Generic("Transaction broadcast timed out after 15 seconds".into())
+                        Error::Generic("Transaction broadcast timed out after 30 seconds".into())
                     })?;
                     txid
                 }