Skip to content

Commit

Permalink
Merge #11866: Do not un-mark fInMempool on wallet txn if ATMP fails.
Browse files Browse the repository at this point in the history
6ef86c9 Do not un-mark fInMempool on wallet txn if ATMP fails. (Matt Corallo)

Pull request description:

  Irrespective of the failure reason, un-marking fInMempool
  out-of-order is incorrect - it should be unmarked when
  TransactionRemovedFromMempool fires.

  Clean up of #11839, which I think was the wrong fix.

Tree-SHA512: 580731297eeac4c4c99ec695e15b09febf62249237bc367fcd1830fc811d3166f9336e7aba7f2f6f8601960984ae22cebed781200db0f04e7cd2008db1a83f64
  • Loading branch information
laanwj committed Feb 14, 2018
2 parents 0cc45ed + 6ef86c9 commit 6bb9c13
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4179,19 +4179,14 @@ int CMerkleTx::GetBlocksToMaturity() const

bool CWalletTx::AcceptToMemoryPool(const CAmount& nAbsurdFee, CValidationState& state)
{
// Quick check to avoid re-setting fInMempool to false
if (mempool.exists(tx->GetHash())) {
return false;
}

// We must set fInMempool here - while it will be re-set to true by the
// entered-mempool callback, if we did not there would be a race where a
// user could call sendmoney in a loop and hit spurious out of funds errors
// because we think that the transaction they just generated's change is
// unavailable as we're not yet aware its in mempool.
bool ret = ::AcceptToMemoryPool(mempool, state, tx, nullptr /* pfMissingInputs */,
nullptr /* plTxnReplaced */, false /* bypass_limits */, nAbsurdFee);
fInMempool = ret;
fInMempool |= ret;
return ret;
}

Expand Down

0 comments on commit 6bb9c13

Please sign in to comment.