Skip to content

Commit

Permalink
Remove invalid tx from pool when incl in block TRTL#969
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoStehlik committed Dec 20, 2019
1 parent dc430c3 commit 970a18d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/cryptonotecore/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,10 +1143,21 @@ namespace CryptoNote
uint64_t fee = 0;
auto transactionValidationResult =
validateTransaction(transaction, validatorState, cache, fee, previousBlockIndex, false);

if (transactionValidationResult)
{
logger(Logging::DEBUGGING) << "Failed to validate transaction " << transaction.getTransactionHash()
const auto hash = transaction.getTransactionHash();

logger(Logging::DEBUGGING) << "Failed to validate transaction " << hash
<< ": " << transactionValidationResult.message();

if (transactionPool->checkIfTransactionPresent(hash))
{
logger(Logging::DEBUGGING) << "Invalid transaction " << hash << " is present in the pool, removing";
transactionPool->removeTransaction(hash);
notifyObservers(makeDelTransactionMessage({hash}, Messages::DeleteTransaction::Reason::NotActual));
}

return transactionValidationResult;
}

Expand Down

0 comments on commit 970a18d

Please sign in to comment.