From c47a376574018176ccbddc7139a8688b1edf97b6 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sat, 7 Dec 2019 18:35:09 +0300 Subject: [PATCH] [v0.14.0.x] Make sure mempool txes are properly processed by CChainLocksHandler despite node restarts --- src/llmq/quorums_chainlocks.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/llmq/quorums_chainlocks.cpp b/src/llmq/quorums_chainlocks.cpp index cdb5d99ac14c..bd4a83ee4285 100644 --- a/src/llmq/quorums_chainlocks.cpp +++ b/src/llmq/quorums_chainlocks.cpp @@ -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) {