[v0.14.0.x] Make sure mempool txes are properly processed by CChainLocksHandler despite node restarts (#3230)

This commit is contained in:
UdjinM6 2019-12-07 18:53:03 +03:00 committed by GitHub
parent dc07a0c5e1
commit 20d4a27778
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -347,15 +347,23 @@ void CChainLocksHandler::TrySignChainTip()
void CChainLocksHandler::SyncTransaction(const CTransaction& tx, const CBlockIndex* pindex, int posInBlock)
{
if (!masternodeSync.IsBlockchainSynced()) {
return;
}
bool handleTx = true;
if (tx.IsCoinBase() || tx.vin.empty()) {
handleTx = false;
}
if (!masternodeSync.IsBlockchainSynced()) {
if (handleTx && posInBlock == CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK) {
auto info = mempool.info(tx.GetHash());
if (!info.tx) {
return;
}
LOCK(cs);
txFirstSeenTime.emplace(tx.GetHash(), info.nTime);
}
return;
}
LOCK(cs);
if (handleTx) {