Skip to content

Commit 6ef86c9

Browse files
committed
Do not un-mark fInMempool on wallet txn if ATMP fails.
Irrespective of the failure reason, un-marking fInMempool out-of-order is incorrect - it should be unmarked when TransactionRemovedFromMempool fires.
1 parent 8ab6c0b commit 6ef86c9

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/wallet/wallet.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4114,18 +4114,13 @@ int CMerkleTx::GetBlocksToMaturity() const
41144114

41154115
bool CWalletTx::AcceptToMemoryPool(const CAmount& nAbsurdFee, CValidationState& state)
41164116
{
4117-
// Quick check to avoid re-setting fInMempool to false
4118-
if (mempool.exists(tx->GetHash())) {
4119-
return false;
4120-
}
4121-
41224117
// We must set fInMempool here - while it will be re-set to true by the
41234118
// entered-mempool callback, if we did not there would be a race where a
41244119
// user could call sendmoney in a loop and hit spurious out of funds errors
41254120
// because we think that the transaction they just generated's change is
41264121
// unavailable as we're not yet aware its in mempool.
41274122
bool ret = ::AcceptToMemoryPool(mempool, state, tx, nullptr /* pfMissingInputs */,
41284123
nullptr /* plTxnReplaced */, false /* bypass_limits */, nAbsurdFee);
4129-
fInMempool = ret;
4124+
fInMempool |= ret;
41304125
return ret;
41314126
}

0 commit comments

Comments
 (0)