From 6ade62b011765d039a57149953c81cfea1463239 Mon Sep 17 00:00:00 2001 From: Capri Date: Tue, 11 Aug 2026 00:42:55 +0000 Subject: [PATCH] net: fall back when Dandelion destination is unavailable --- src/node/transaction.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp index 9632c63..e65e244 100644 --- a/src/node/transaction.cpp +++ b/src/node/transaction.cpp @@ -129,8 +129,23 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t auto embargo_timeout = std::chrono::duration_cast(nEmbargo - current_time).count(); LogPrint(BCLog::DANDELION, "dandeliontx %s embargoed for %d seconds\n", txid.ToString(), embargo_timeout); CInv embargoTx(MSG_DANDELION_TX, txid); - node.connman->localDandelionDestinationPushInventory(embargoTx); - return TransactionError::OK; + if (node.connman->localDandelionDestinationPushInventory(embargoTx)) { + return TransactionError::OK; + } + + // No Dandelion destination is currently available. Remove the + // embargo, accept the transaction into the normal mempool, and + // fall back to normal transaction relay. + node.connman->removeDandelionEmbargo(txid); + + { + LOCK(cs_main); + const MempoolAcceptResult result = AcceptToMemoryPool( + node.chainman->ActiveChainstate(), *node.mempool, tx, false, false); + if (result.m_result_type != MempoolAcceptResult::ResultType::VALID) { + return HandleATMPError(result.m_state, err_string); + } + } } node.peerman->RelayTransaction(txid, wtxid); }