Final fix for mempool

This commit is contained in:
blackjok3r
2018-12-16 21:06:17 +08:00
parent f4b2975279
commit 94c37803df
3 changed files with 10 additions and 10 deletions

View File

@@ -1597,7 +1597,7 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF
}
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,bool* pfMissingInputs, bool fRejectAbsurdFee, int dosLevel)
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,bool* pfMissingInputs, bool fRejectAbsurdFee, int dosLevel, bool fSkipExpiry)
{
AssertLockHeld(cs_main);
if (pfMissingInputs)
@@ -1634,7 +1634,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
}
// DoS level set to 10 to be more forgiving.
// Check transaction contextually against the set of consensus rules which apply in the next block to be mined.
if (!ContextualCheckTransaction(tx, state, nextBlockHeight, (dosLevel == -1) ? 10 : dosLevel))
if (!fSkipExpiry && !ContextualCheckTransaction(tx, state, nextBlockHeight, (dosLevel == -1) ? 10 : dosLevel))
{
return error("AcceptToMemoryPool: ContextualCheckTransaction failed");
}
@@ -1973,14 +1973,14 @@ bool GetAddressUnspent(uint160 addressHash, int type,
else return(coins.vout[n].nValue);
}*/
bool myAddtomempool(CTransaction &tx, CValidationState *pstate)
bool myAddtomempool(CTransaction &tx, CValidationState *pstate, bool fSkipExpiry)
{
CValidationState state;
if (!pstate)
pstate = &state;
CTransaction Ltx; bool fMissingInputs,fOverrideFees = false;
if ( mempool.lookup(tx.GetHash(),Ltx) == 0 )
return(AcceptToMemoryPool(mempool, *pstate, tx, false, &fMissingInputs, !fOverrideFees));
return(AcceptToMemoryPool(mempool, *pstate, tx, false, &fMissingInputs, !fOverrideFees, -1, fSkipExpiry));
else return(true);
}
@@ -4686,7 +4686,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
BOOST_FOREACH(const CTxMemPoolEntry& e, mempool.mapTx) {
const CTransaction &tx = e.GetTx();
const uint256 &hash = tx.GetHash();
if ( tx.vjoinsplit.empty() || tx.vShieldedSpend.empty()) {
if ( tx.vjoinsplit.empty() && tx.vShieldedSpend.empty()) {
transactionsToRemove.push_back(tx);
tmpmempool.addUnchecked(hash,e,true);
}
@@ -4708,7 +4708,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
if (tx.IsCoinBase() || !tx.vjoinsplit.empty() || !tx.vShieldedSpend.empty() || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block) != 0)))
continue;
Tx = tx;
if ( myAddtomempool(Tx, &state) == false ) // happens with out of order tx in block on resync
if ( myAddtomempool(Tx, &state, true) == false ) // happens with out of order tx in block on resync
{
//LogPrintf("Rejected by mempool, reason: .%s.\n", state.GetRejectReason().c_str());
// take advantage of other checks, but if we were only rejected because it is a valid staking