From cfc5c104225d8cd06f913dc1a9fc6b8a74ff3af7 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Tue, 25 Aug 2026 14:13:19 +0000 Subject: [PATCH] fix(platform-wallet): use dash-spv's own acceptance timeout instead of a 30s override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SpvBroadcaster passed an explicit 30s deadline to broadcast_transaction_and_wait, which is shorter than dash-spv's own designed window of broadcast_acceptance_timeout (60s) + AWAIT_GRACE (5s). dash-spv deliberately does not return the mempool manager's interim Uncertain event early — a late echo can still upgrade the verdict to Accepted, so the wait runs to the caller's deadline. With a 30s deadline the wait always expires before the manager's own 60s acceptance timeout even fires, so every acceptance signal arriving after 30s was discarded and the send surfaced as TransactionBroadcastUnconfirmed. Pass None so the deadline defers to dash-spv's configured window. --- .../rs-platform-wallet/src/broadcaster.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/rs-platform-wallet/src/broadcaster.rs b/packages/rs-platform-wallet/src/broadcaster.rs index 633af12ae25..c9e5f4cd593 100644 --- a/packages/rs-platform-wallet/src/broadcaster.rs +++ b/packages/rs-platform-wallet/src/broadcaster.rs @@ -124,13 +124,6 @@ impl TransactionBroadcaster for DapiBroadcaster { } } -/// How long the SPV broadcast waits for a network-acceptance verdict before -/// reporting the outcome as unknown. Shorter than dash-spv's own default so a -/// user-facing send does not hang for a full minute. On live Dash networks -/// acceptance usually resolves in seconds via the InstantSend lock or the -/// withheld-peer echo, well inside this bound. -const SPV_ACCEPTANCE_TIMEOUT: Duration = Duration::from_secs(30); - /// The SPV broadcast channel: send through P2P peers and await dash-spv's /// network-acceptance verdict (rust-dashcore#913). #[async_trait] @@ -188,11 +181,7 @@ impl SpvBroadcaster { impl TransactionBroadcaster for SpvBroadcaster { async fn broadcast(&self, transaction: &Transaction) -> Result { let txid = transaction.txid(); - match self - .spv - .broadcast_and_wait(transaction, Some(SPV_ACCEPTANCE_TIMEOUT)) - .await - { + match self.spv.broadcast_and_wait(transaction, None).await { Ok(BroadcastResult::Accepted { relayed_by }) => { tracing::info!( txid = %txid, @@ -208,9 +197,9 @@ impl TransactionBroadcaster for SpvBroadcaster { // later echo/IS-lock/confirmation or the reservation-TTL // backstop reconciles the reservation. Ok(BroadcastResult::Uncertain) => Err(BroadcastError::MaybeSent { - reason: format!( - "SPV broadcast saw no acceptance signal within {SPV_ACCEPTANCE_TIMEOUT:?}" - ), + reason: + "SPV broadcast saw no acceptance signal before dash-spv's acceptance timeout" + .to_string(), }), // Provably never sent (per the SpvChannel error contract): no // bytes reached the network, so the reservation is safe to