Drop vanished unconfirmed txs on electrs too
What changed, and why it matters
This commit fixes a bug where Stack Wallet could not clean up old unconfirmed transactions when connected to electrs servers. The wallet checks whether a transaction still exists on the server; it previously only recognized ElectrumX/Fulcrum's specific error wording and ignored electrs' simpler error message. As a result, a replaced or dropped transaction stayed in the wallet and blocked future refreshes, leaving the wallet unable to sync. The fix makes the check look for the simpler message that all server types share.
No immediate security response required; this is a bug-fix commit. Users relying on electrs servers should update to include this fix to avoid wallet sync stalls after RBF bumps or dropped transactions. Review other backend-specific string matches in the codebase for similar portability issues.
Security signals we found
Error-message parsing used for transaction lifecycle decision
Wallet state desynchronization due to backend-specific error handling
RBF/replaced transaction cleanup failure
Fix references existing test coverage (rbf_cpfp_test.dart)
Evidence from the diff
In paynym_interface.dart, updateTransactions re-fetches stored unconfirmed transactions and deletes any the server no longer reports. The deletion branch was gated on a string match for ElectrumX/Fulcrum’s wrapped error: “JSON-RPC error 2: daemon error: DaemonError({‘code’: -5, ‘message’: ‘No such mempool or blockchain transaction…”. electrs returns bitcoind’s error unwrapped, so the condition never matched and vanished transactions persisted locally, causing subsequent refreshes to fail. The patch matches only the shared bitcoind substring “No such mempool or blockchain transaction”, aligning with ElectrumXClient.request behavior. This is a robustness fix for RBF/replaced/dropped transaction handling on electrs backends.
Changed components
lib/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dartupdateTransactions methodelectrs server compatibility pathInspect captured patch +4 / −3
### lib/wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart
@@ -1738,10 +1738,11 @@ mixin PaynymInterface<T extends PaynymCurrencyInterface>
cryptoCurrency: cryptoCurrency,
);
} catch (e) {
- // tx no longer exists then delete from local db
+ // tx no longer exists then delete from local db. Match bitcoind's
+ // message alone: ElectrumX and Fulcrum wrap it in "daemon error:
+ // DaemonError(...)", electrs does not.
if (e.toString().contains(
- "JSON-RPC error 2: daemon error: DaemonError({'code': -5, "
- "'message': 'No such mempool or blockchain transaction",
+ "No such mempool or blockchain transaction",
)) {
await mainDB.isar.writeTxn(
() async => await mainDB.isar.transactionV2sWhy this scored 43/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.