From 8de42370d0f07d86f099d2096b509ea03d2c96dc Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Mon, 7 Jan 2019 17:09:55 -0500 Subject: [PATCH] fixup mempool clearing of peg-outs on block commitment --- src/txmempool.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index b125c37ed2..d473b1afb1 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -614,18 +614,18 @@ void CTxMemPool::removeForBlock(const std::vector& vtx, unsigne } // Eject any newly-invalid peg-outs based on changing block commitment const CChainParams& chainparams = Params(); - if (pak_transition && !gArgs.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard())) { + if (pak_transition && chainparams.GetEnforcePak()) { for (const auto& entry : mapTx) { for (const auto& out : entry.GetTx().vout) { if (out.scriptPubKey.IsPegoutScript(Params().ParentGenesisBlockHash()) && !ScriptHasValidPAKProof(out.scriptPubKey, Params().ParentGenesisBlockHash())) { - txiter it = mapTx.find(entry.GetTx().GetHash()); + const uint256 tx_id = entry.GetTx().GetHash(); + txiter it = mapTx.find(tx_id); const CTransaction& tx = it->GetTx(); setEntries stage; stage.insert(it); - RemoveStaged(stage, true, MemPoolRemovalReason::BLOCK); removeRecursive(tx, MemPoolRemovalReason::BLOCK); - ClearPrioritisation(tx.GetHash()); + ClearPrioritisation(tx_id); break; } }