wallet: remove erroneous-on-reorg Assume()
What changed, and why it matters
This commit removes a single internal safety check (an 'Assume' assertion) in Bitcoin Core's wallet code. The assertion could incorrectly fail during a blockchain reorganization, causing the wallet process to abort unexpectedly. Removing it prevents a potential crash, but does not by itself fix any underlying logic bug in how transactions are handled.
Treat as a stability/reliability fix rather than a critical security vulnerability. Node operators and wallet users should upgrade to avoid potential wallet-process crashes during reorgs. No immediate incident response is indicated by the diff alone.
Security signals we found
Removal of an Assume() invariant that could be violated by blockchain reorganization
Wallet crash / denial-of-service vector via reorg-triggered assertion failure
No logic change to coin selection or transaction spending itself
Evidence from the diff
In src/wallet/spend.cpp, the line Assume(!wtx.truc_child_in_mempool.has_value()) is removed from AvailableCoins(). The commit message states this assumption is ‘erroneous-on-reorg’. During a reorg, a wallet transaction’s TRUC (Topologically Restricted Until Confirmation) child-in-mempool state may legitimately have a value, so the assertion could trigger a non-fatal-but-process-aborting Assume() failure in builds where Assume is enabled. The change is defensive: it stops an over-strict invariant from crashing the node when the mempool/wallet state is temporarily inconsistent across a reorg.
Changed components
src/wallet/spend.cppAvailableCoins()TRUC transaction handlingInspect captured patch +0 / −1
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index c7c41f5d..b3651412 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -410,7 +410,6 @@ CoinsResult AvailableCoins(const CWallet& wallet,
if (ancestors > 1) continue;
} else {
if (wtx.tx->version == TRUC_VERSION) continue;
- Assume(!wtx.truc_child_in_mempool.has_value());
}
}
Why this scored 35/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.