Browse Source

[test] proper removing of txes that violates interest validation from mempool

In CreateNewBlock of miner https://github.com/KomodoPlatform/komodo/blob/master/src/miner.cpp#L331
we have a condition that prevents miners to include certain txes in
block if tx violates komodo_validate_interest check. so, if such txes
will exist in mempool and in some reason they was not miner earlier, if
they have nExpiryHeight = 0 - they NEVER will be included in block by miners.

Also, code in CTxMemPool::removeExpired that should remove such txes
from mempool didn't do it due to mistake. As a result these txes
stucks in mempool. No one can mine it, bcz no one can include it in block,
and no one get success to remove it from mempool.

Look on old code:

```
(ASSETCHAINS_SYMBOL[0] == 0
  && tipindex != 0 && komodo_validate_interest(...) ) < 0

```
But should be:

```
(ASSETCHAINS_SYMBOL[0] == 0
  && tipindex != 0 && komodo_validate_interest(...) < 0 )
```

Bcz we should compare with 0 result of komodo_validate_interest, but we
had different behaviour, due to typo.
pull/117/head
DeckerSU 4 years ago
committed by Duke Leto
parent
commit
c7d96194d6
  1. 6
      src/txmempool.cpp

6
src/txmempool.cpp

@ -523,8 +523,12 @@ std::vector<uint256> CTxMemPool::removeExpired(unsigned int nBlockHeight)
{
const CTransaction& tx = it->GetTx();
tipindex = chainActive.LastTip();
if (IsExpiredTx(tx, nBlockHeight) || (ASSETCHAINS_SYMBOL[0] == 0 && tipindex != 0 && komodo_validate_interest(tx,tipindex->GetHeight()+1,tipindex->GetMedianTimePast() + 777,0)) < 0)
bool fInterestNotValidated = ASSETCHAINS_SYMBOL[0] == 0 && tipindex != 0 && komodo_validate_interest(tx,tipindex->GetHeight()+1,tipindex->GetMedianTimePast() + 777,0) < 0;
if (IsExpiredTx(tx, nBlockHeight) || fInterestNotValidated)
{
if (fInterestNotValidated && tipindex != 0)
LogPrintf("Removing interest violate txid.%s nHeight.%d nTime.%u vs locktime.%u\n",tx.GetHash().ToString(),tipindex->GetHeight()+1,tipindex->GetMedianTimePast() + 777,tx.nLockTime);
transactionsToRemove.push_back(tx);
}
}

Loading…
Cancel
Save