From ee59fa07236bd8c1fcadd69824eafa49d0a77136 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Fri, 3 Apr 2026 22:40:08 +0300 Subject: [PATCH] fix(wallet-lib): fix broadcast retry not matching DAPI error message The wallet-lib retry logic for UTXO conflicts checked for an exact match against 'invalid transaction: bad-txns-inputs-missingorspent', but DAPI (both JS and Rust) returns 'Transaction is rejected: bad-txns-inputs-missingorspent'. The retry never triggered, causing faucet wallet funding to fail when UTXOs were still in the mempool. This caused 7 nightly test failures since ~Mar 16: 1 Data Contract funding failure + 6 cascading Contacts test failures. Fix: use .includes('bad-txns-inputs-missingorspent') which matches regardless of the message prefix. Co-Authored-By: Claude Opus 4.6 (1M context) --- NIGHTLY_STATUS.md | 6 ++++-- .../src/types/Account/methods/broadcastTransaction.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NIGHTLY_STATUS.md b/NIGHTLY_STATUS.md index 35a16c424c4..43efc08683f 100644 --- a/NIGHTLY_STATUS.md +++ b/NIGHTLY_STATUS.md @@ -37,11 +37,13 @@ These jobs only run on nightly if relevant files changed in the latest commit. T ### Test Suite: `bad-txns-inputs-missingorspent` (since ~Mar 16) -Two withdrawal-related tests fail because Core rejects a transaction whose inputs are missing or already spent. The local network starts and processes blocks normally -- the failure is specific to the withdrawal test scenario. +Seven tests fail because Core rejects faucet wallet funding transactions whose inputs are already in the mempool. The failures are in the Data Contract and Contacts test groups -- 1 `before all` hook failure cascades into 6 dependent Contacts tests. -- **63 tests pass**, 2 fail +- **65 tests pass**, 7 fail (1 Data Contract funding + 6 Contacts cascade) - Error: `InvalidRequestError: Transaction is rejected: bad-txns-inputs-missingorspent` +- **Root cause:** The wallet-lib retry logic at `broadcastTransaction.js:181` checks for `'invalid transaction: bad-txns-inputs-missingorspent'` but DAPI returns `'Transaction is rejected: bad-txns-inputs-missingorspent'` -- the retry never matches, so UTXO conflicts are not retried. - **Not caused by** the `ssh2`/`nan` compilation warnings (those are non-fatal) +- **Fix:** PR #3434 updates the check to use `.includes('bad-txns-inputs-missingorspent')` ### Functional tests: long-standing flakiness diff --git a/packages/wallet-lib/src/types/Account/methods/broadcastTransaction.js b/packages/wallet-lib/src/types/Account/methods/broadcastTransaction.js index 08fc2ddb4d5..814b311e594 100644 --- a/packages/wallet-lib/src/types/Account/methods/broadcastTransaction.js +++ b/packages/wallet-lib/src/types/Account/methods/broadcastTransaction.js @@ -178,7 +178,7 @@ async function broadcastTransaction(transaction, options = { } catch (error) { cancelMempoolSubscription(); - if (error.message === 'invalid transaction: bad-txns-inputs-missingorspent') { + if (error.message && error.message.includes('bad-txns-inputs-missingorspent')) { if (this.broadcastRetryAttempts === MAX_RETRY_ATTEMPTS) { throw error; }