From a6d484719cd431f714756d698b87617c0056bb1d Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 18 Oct 2019 02:21:14 +0300 Subject: [PATCH 1/7] refactor: Add `const` qualifier to various InstantSend related methods --- src/llmq/quorums_instantsend.cpp | 34 +++++++++++++------------- src/llmq/quorums_instantsend.h | 42 ++++++++++++++++---------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 15cf51b80c1d..a5d6a6dd8b83 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -177,12 +177,12 @@ void CInstantSendDb::RemoveArchivedInstantSendLocks(int nUntilHeight) db.WriteBatch(batch); } -bool CInstantSendDb::HasArchivedInstantSendLock(const uint256& islockHash) +bool CInstantSendDb::HasArchivedInstantSendLock(const uint256& islockHash) const { return db.Exists(std::make_tuple(std::string(DB_ARCHIVED_BY_HASH), islockHash)); } -size_t CInstantSendDb::GetInstantSendLockCount() +size_t CInstantSendDb::GetInstantSendLockCount() const { auto it = std::unique_ptr(db.NewIterator()); auto firstKey = std::make_tuple(std::string(DB_ISLOCK_BY_HASH), uint256()); @@ -204,7 +204,7 @@ size_t CInstantSendDb::GetInstantSendLockCount() return cnt; } -CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByHash(const uint256& hash) +CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByHash(const uint256& hash) const { CInstantSendLockPtr ret; if (islockCache.get(hash, ret)) { @@ -220,7 +220,7 @@ CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByHash(const uint256& hash return ret; } -uint256 CInstantSendDb::GetInstantSendLockHashByTxid(const uint256& txid) +uint256 CInstantSendDb::GetInstantSendLockHashByTxid(const uint256& txid) const { uint256 islockHash; @@ -240,7 +240,7 @@ uint256 CInstantSendDb::GetInstantSendLockHashByTxid(const uint256& txid) return islockHash; } -CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByTxid(const uint256& txid) +CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByTxid(const uint256& txid) const { uint256 islockHash = GetInstantSendLockHashByTxid(txid); if (islockHash.IsNull()) { @@ -249,7 +249,7 @@ CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByTxid(const uint256& txid return GetInstantSendLockByHash(islockHash); } -CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByInput(const COutPoint& outpoint) +CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByInput(const COutPoint& outpoint) const { uint256 islockHash; bool found = outpointCache.get(outpoint, islockHash); @@ -268,7 +268,7 @@ CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByInput(const COutPoint& o return GetInstantSendLockByHash(islockHash); } -std::vector CInstantSendDb::GetInstantSendLocksByParent(const uint256& parent) +std::vector CInstantSendDb::GetInstantSendLocksByParent(const uint256& parent) const { auto it = std::unique_ptr(db.NewIterator()); auto firstKey = std::make_tuple(std::string(DB_HASH_BY_OUTPOINT), COutPoint(parent, 0)); @@ -477,7 +477,7 @@ bool CInstantSendManager::ProcessTx(const CTransaction& tx, bool allowReSigning, return true; } -bool CInstantSendManager::CheckCanLock(const CTransaction& tx, bool printDebug, const Consensus::Params& params) +bool CInstantSendManager::CheckCanLock(const CTransaction& tx, bool printDebug, const Consensus::Params& params) const { if (tx.vin.empty()) { // can't lock TXs without inputs (e.g. quorum commitments) @@ -494,7 +494,7 @@ bool CInstantSendManager::CheckCanLock(const CTransaction& tx, bool printDebug, return true; } -bool CInstantSendManager::CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, CAmount* retValue, const Consensus::Params& params) +bool CInstantSendManager::CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, CAmount* retValue, const Consensus::Params& params) const { int nInstantSendConfirmationsRequired = params.nInstantSendConfirmationsRequired; @@ -1432,7 +1432,7 @@ bool CInstantSendManager::ProcessPendingRetryLockTxs() return retryCount != 0; } -bool CInstantSendManager::AlreadyHave(const CInv& inv) +bool CInstantSendManager::AlreadyHave(const CInv& inv) const { if (!IsInstantSendEnabled()) { return true; @@ -1442,7 +1442,7 @@ bool CInstantSendManager::AlreadyHave(const CInv& inv) return db.GetInstantSendLockByHash(inv.hash) != nullptr || pendingInstantSendLocks.count(inv.hash) != 0 || db.HasArchivedInstantSendLock(inv.hash); } -bool CInstantSendManager::GetInstantSendLockByHash(const uint256& hash, llmq::CInstantSendLock& ret) +bool CInstantSendManager::GetInstantSendLockByHash(const uint256& hash, llmq::CInstantSendLock& ret) const { if (!IsInstantSendEnabled()) { return false; @@ -1457,7 +1457,7 @@ bool CInstantSendManager::GetInstantSendLockByHash(const uint256& hash, llmq::CI return true; } -CInstantSendLockPtr CInstantSendManager::GetInstantSendLockByTxid(const uint256& txid) +CInstantSendLockPtr CInstantSendManager::GetInstantSendLockByTxid(const uint256& txid) const { if (!IsInstantSendEnabled()) { return nullptr; @@ -1467,7 +1467,7 @@ CInstantSendLockPtr CInstantSendManager::GetInstantSendLockByTxid(const uint256& return db.GetInstantSendLockByTxid(txid); } -bool CInstantSendManager::GetInstantSendLockHashByTxid(const uint256& txid, uint256& ret) +bool CInstantSendManager::GetInstantSendLockHashByTxid(const uint256& txid, uint256& ret) const { if (!IsInstantSendEnabled()) { return false; @@ -1478,7 +1478,7 @@ bool CInstantSendManager::GetInstantSendLockHashByTxid(const uint256& txid, uint return !ret.IsNull(); } -bool CInstantSendManager::IsLocked(const uint256& txHash) +bool CInstantSendManager::IsLocked(const uint256& txHash) const { if (!IsInstantSendEnabled()) { return false; @@ -1488,12 +1488,12 @@ bool CInstantSendManager::IsLocked(const uint256& txHash) return db.GetInstantSendLockByTxid(txHash) != nullptr; } -bool CInstantSendManager::IsConflicted(const CTransaction& tx) +bool CInstantSendManager::IsConflicted(const CTransaction& tx) const { return GetConflictingLock(tx) != nullptr; } -CInstantSendLockPtr CInstantSendManager::GetConflictingLock(const CTransaction& tx) +CInstantSendLockPtr CInstantSendManager::GetConflictingLock(const CTransaction& tx) const { if (!IsInstantSendEnabled()) { return nullptr; @@ -1513,7 +1513,7 @@ CInstantSendLockPtr CInstantSendManager::GetConflictingLock(const CTransaction& return nullptr; } -size_t CInstantSendManager::GetInstantSendLockCount() +size_t CInstantSendManager::GetInstantSendLockCount() const { return db.GetInstantSendLockCount(); } diff --git a/src/llmq/quorums_instantsend.h b/src/llmq/quorums_instantsend.h index 8e5bbcc7caf9..0553b5d73745 100644 --- a/src/llmq/quorums_instantsend.h +++ b/src/llmq/quorums_instantsend.h @@ -45,9 +45,9 @@ class CInstantSendDb private: CDBWrapper& db; - unordered_lru_cache islockCache; - unordered_lru_cache txidCache; - unordered_lru_cache outpointCache; + mutable unordered_lru_cache islockCache; + mutable unordered_lru_cache txidCache; + mutable unordered_lru_cache outpointCache; public: explicit CInstantSendDb(CDBWrapper& _db) : db(_db) {} @@ -60,22 +60,22 @@ class CInstantSendDb static void WriteInstantSendLockArchived(CDBBatch& batch, const uint256& hash, int nHeight); std::unordered_map RemoveConfirmedInstantSendLocks(int nUntilHeight); void RemoveArchivedInstantSendLocks(int nUntilHeight); - bool HasArchivedInstantSendLock(const uint256& islockHash); - size_t GetInstantSendLockCount(); + bool HasArchivedInstantSendLock(const uint256& islockHash) const; + size_t GetInstantSendLockCount() const; - CInstantSendLockPtr GetInstantSendLockByHash(const uint256& hash); - uint256 GetInstantSendLockHashByTxid(const uint256& txid); - CInstantSendLockPtr GetInstantSendLockByTxid(const uint256& txid); - CInstantSendLockPtr GetInstantSendLockByInput(const COutPoint& outpoint); + CInstantSendLockPtr GetInstantSendLockByHash(const uint256& hash) const; + uint256 GetInstantSendLockHashByTxid(const uint256& txid) const; + CInstantSendLockPtr GetInstantSendLockByTxid(const uint256& txid) const; + CInstantSendLockPtr GetInstantSendLockByInput(const COutPoint& outpoint) const; - std::vector GetInstantSendLocksByParent(const uint256& parent); + std::vector GetInstantSendLocksByParent(const uint256& parent) const; std::vector RemoveChainedInstantSendLocks(const uint256& islockHash, const uint256& txid, int nHeight); }; class CInstantSendManager : public CRecoveredSigsListener { private: - CCriticalSection cs; + mutable CCriticalSection cs; CInstantSendDb db; std::thread workThread; @@ -121,11 +121,11 @@ class CInstantSendManager : public CRecoveredSigsListener public: bool ProcessTx(const CTransaction& tx, bool allowReSigning, const Consensus::Params& params); - bool CheckCanLock(const CTransaction& tx, bool printDebug, const Consensus::Params& params); - bool CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, CAmount* retValue, const Consensus::Params& params); - bool IsLocked(const uint256& txHash); - bool IsConflicted(const CTransaction& tx); - CInstantSendLockPtr GetConflictingLock(const CTransaction& tx); + bool CheckCanLock(const CTransaction& tx, bool printDebug, const Consensus::Params& params) const; + bool CheckCanLock(const COutPoint& outpoint, bool printDebug, const uint256& txHash, CAmount* retValue, const Consensus::Params& params) const; + bool IsLocked(const uint256& txHash) const; + bool IsConflicted(const CTransaction& tx) const; + CInstantSendLockPtr GetConflictingLock(const CTransaction& tx) const; virtual void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig); void HandleNewInputLockRecoveredSig(const CRecoveredSig& recoveredSig, const uint256& txid); @@ -161,12 +161,12 @@ class CInstantSendManager : public CRecoveredSigsListener static void AskNodesForLockedTx(const uint256& txid); bool ProcessPendingRetryLockTxs(); - bool AlreadyHave(const CInv& inv); - bool GetInstantSendLockByHash(const uint256& hash, CInstantSendLock& ret); - CInstantSendLockPtr GetInstantSendLockByTxid(const uint256& txid); - bool GetInstantSendLockHashByTxid(const uint256& txid, uint256& ret); + bool AlreadyHave(const CInv& inv) const; + bool GetInstantSendLockByHash(const uint256& hash, CInstantSendLock& ret) const; + CInstantSendLockPtr GetInstantSendLockByTxid(const uint256& txid) const; + bool GetInstantSendLockHashByTxid(const uint256& txid, uint256& ret) const; - size_t GetInstantSendLockCount(); + size_t GetInstantSendLockCount() const; void WorkThreadMain(); }; From da874036e1ec55c5c87c685795f2c83574b725bd Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 26 Jan 2021 13:46:31 +0300 Subject: [PATCH 2/7] refactor: Drop ProcessNewTransaction --- src/llmq/quorums_instantsend.cpp | 91 +++++++++++++++----------------- src/llmq/quorums_instantsend.h | 1 - 2 files changed, 44 insertions(+), 48 deletions(-) diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index a5d6a6dd8b83..358f70112ea9 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -963,62 +963,29 @@ void CInstantSendManager::ProcessInstantSendLock(NodeId from, const uint256& has } } -void CInstantSendManager::ProcessNewTransaction(const CTransactionRef& tx, const CBlockIndex* pindex, bool allowReSigning) -{ - if (!IsInstantSendEnabled()) { - return; - } - - if (tx->IsCoinBase() || tx->vin.empty()) { - // coinbase and TXs with no inputs can't be locked - return; - } - - uint256 islockHash; - { - LOCK(cs); - islockHash = db.GetInstantSendLockHashByTxid(tx->GetHash()); - - // update DB about when an IS lock was mined - if (!islockHash.IsNull() && pindex) { - db.WriteInstantSendLockMined(islockHash, pindex->nHeight); - } - } - - if (!masternodeSync.IsBlockchainSynced()) { - return; - } - - bool chainlocked = pindex && chainLocksHandler->HasChainLock(pindex->nHeight, pindex->GetBlockHash()); - if (islockHash.IsNull() && !chainlocked) { - ProcessTx(*tx, allowReSigning, Params().GetConsensus()); - } - - LOCK(cs); - if (!chainlocked && islockHash.IsNull()) { - // TX is not locked, so make sure it is tracked - AddNonLockedTx(tx, pindex); - } else { - // TX is locked, so make sure we don't track it anymore - RemoveNonLockedTx(tx->GetHash(), true); - } -} - void CInstantSendManager::TransactionAddedToMempool(const CTransactionRef& tx) { - if (!IsInstantSendEnabled()) { + if (!IsInstantSendEnabled() || !masternodeSync.IsBlockchainSynced() || tx->vin.empty()) { return; } - CInstantSendLockPtr islock{nullptr}; + CInstantSendLockPtr islock; { LOCK(cs); islock = db.GetInstantSendLockByTxid(tx->GetHash()); } - ProcessNewTransaction(tx, nullptr, false); - - if (islock != nullptr) { + if (islock == nullptr) { + ProcessTx(*tx, false, Params().GetConsensus()); + // TX is not locked, so make sure it is tracked + LOCK(cs); + AddNonLockedTx(tx, nullptr); + } else { + { + // TX is locked, so make sure we don't track it anymore + LOCK(cs); + RemoveNonLockedTx(tx->GetHash(), true); + } // If the islock was received before the TX, we know we were not able to send // the notification at that time, we need to do it now. LogPrint(BCLog::INSTANTSEND, "CInstantSendManager::%s -- notify about an earlier received lock for tx %s\n", __func__, tx->GetHash().ToString()); @@ -1040,7 +1007,37 @@ void CInstantSendManager::BlockConnected(const std::shared_ptr& pb } for (const auto& tx : pblock->vtx) { - ProcessNewTransaction(tx, pindex, true); + if (tx->IsCoinBase() || tx->vin.empty()) { + // coinbase and TXs with no inputs can't be locked + continue; + } + + uint256 islockHash; + { + LOCK(cs); + islockHash = db.GetInstantSendLockHashByTxid(tx->GetHash()); + + // update DB about when an IS lock was mined + if (!islockHash.IsNull()) { + db.WriteInstantSendLockMined(islockHash, pindex->nHeight); + } + } + + if (!masternodeSync.IsBlockchainSynced()) { + continue; + } + + bool non_locked = islockHash.IsNull() && !chainLocksHandler->HasChainLock(pindex->nHeight, pindex->GetBlockHash()); + if (non_locked) { + ProcessTx(*tx, true, Params().GetConsensus()); + // TX is not locked, so make sure it is tracked + LOCK(cs); + AddNonLockedTx(tx, pindex); + } else { + // TX is locked, so make sure we don't track it anymore + LOCK(cs); + RemoveNonLockedTx(tx->GetHash(), true); + } } } diff --git a/src/llmq/quorums_instantsend.h b/src/llmq/quorums_instantsend.h index 0553b5d73745..0af6dcdf5f8d 100644 --- a/src/llmq/quorums_instantsend.h +++ b/src/llmq/quorums_instantsend.h @@ -140,7 +140,6 @@ class CInstantSendManager : public CRecoveredSigsListener std::unordered_set ProcessPendingInstantSendLocks(int signOffset, const std::unordered_map, StaticSaltedHasher>& pend, bool ban); void ProcessInstantSendLock(NodeId from, const uint256& hash, const CInstantSendLockPtr& islock); - void ProcessNewTransaction(const CTransactionRef& tx, const CBlockIndex* pindex, bool allowReSigning); void TransactionAddedToMempool(const CTransactionRef& tx); void BlockConnected(const std::shared_ptr& pblock, const CBlockIndex* pindex, const std::vector& vtxConflicted); void BlockDisconnected(const std::shared_ptr& pblock, const CBlockIndex* pindexDisconnected); From 0f122a36239ccf8677ce13d22525d11fbdd37136 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 27 Jan 2021 03:40:51 +0300 Subject: [PATCH 3/7] refactor: Simplify GetInstantSendLock(*) methods --- src/llmq/quorums_instantsend.cpp | 37 ++++++++------------------------ 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 358f70112ea9..e96084843fb2 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -206,6 +206,10 @@ size_t CInstantSendDb::GetInstantSendLockCount() const CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByHash(const uint256& hash) const { + if (hash.IsNull()) { + return nullptr; + } + CInstantSendLockPtr ret; if (islockCache.get(hash, ret)) { return ret; @@ -223,48 +227,25 @@ CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByHash(const uint256& hash uint256 CInstantSendDb::GetInstantSendLockHashByTxid(const uint256& txid) const { uint256 islockHash; - - bool found = txidCache.get(txid, islockHash); - if (found && islockHash.IsNull()) { - return {}; - } - - if (!found) { - found = db.Read(std::make_tuple(std::string(DB_HASH_BY_TXID), txid), islockHash); + if (!txidCache.get(txid, islockHash)) { + db.Read(std::make_tuple(std::string(DB_HASH_BY_TXID), txid), islockHash); txidCache.insert(txid, islockHash); } - - if (!found) { - return {}; - } return islockHash; } CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByTxid(const uint256& txid) const { - uint256 islockHash = GetInstantSendLockHashByTxid(txid); - if (islockHash.IsNull()) { - return nullptr; - } - return GetInstantSendLockByHash(islockHash); + return GetInstantSendLockByHash(GetInstantSendLockHashByTxid(txid)); } CInstantSendLockPtr CInstantSendDb::GetInstantSendLockByInput(const COutPoint& outpoint) const { uint256 islockHash; - bool found = outpointCache.get(outpoint, islockHash); - if (found && islockHash.IsNull()) { - return nullptr; - } - - if (!found) { - found = db.Read(std::make_tuple(std::string(DB_HASH_BY_OUTPOINT), outpoint), islockHash); + if (!outpointCache.get(outpoint, islockHash)) { + db.Read(std::make_tuple(std::string(DB_HASH_BY_OUTPOINT), outpoint), islockHash); outpointCache.insert(outpoint, islockHash); } - - if (!found) { - return nullptr; - } return GetInstantSendLockByHash(islockHash); } From d29d3691a8161e768627d4743fb9aeb36d3ac03c Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 27 Jan 2021 03:23:25 +0300 Subject: [PATCH 4/7] refactor: Check height inside Remove(Archived/Confirmed)InstantSendLocks --- src/llmq/quorums_instantsend.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index e96084843fb2..12cb89d12623 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -110,6 +110,10 @@ void CInstantSendDb::WriteInstantSendLockArchived(CDBBatch& batch, const uint256 std::unordered_map CInstantSendDb::RemoveConfirmedInstantSendLocks(int nUntilHeight) { + if (nUntilHeight <= 0) { + return {}; + } + auto it = std::unique_ptr(db.NewIterator()); auto firstKey = BuildInversedISLockKey(DB_MINED_BY_HEIGHT_AND_HASH, nUntilHeight, uint256()); @@ -150,6 +154,10 @@ std::unordered_map CInstantSendDb::RemoveConfirmed void CInstantSendDb::RemoveArchivedInstantSendLocks(int nUntilHeight) { + if (nUntilHeight <= 0) { + return; + } + auto it = std::unique_ptr(db.NewIterator()); auto firstKey = BuildInversedISLockKey(DB_ARCHIVED_BY_HEIGHT_AND_HASH, nUntilHeight, uint256()); @@ -1145,12 +1153,8 @@ void CInstantSendManager::HandleFullyConfirmedBlock(const CBlockIndex* pindex) LOCK(cs); auto& consensusParams = Params().GetConsensus(); - auto removeISLocks = db.RemoveConfirmedInstantSendLocks(pindex->nHeight); - if (pindex->nHeight > 100) { - db.RemoveArchivedInstantSendLocks(pindex->nHeight - 100); - } for (auto& p : removeISLocks) { auto& islockHash = p.first; auto& islock = p.second; @@ -1166,6 +1170,8 @@ void CInstantSendManager::HandleFullyConfirmedBlock(const CBlockIndex* pindex) quorumSigningManager->TruncateRecoveredSig(consensusParams.llmqTypeInstantSend, islock->GetRequestId()); } + db.RemoveArchivedInstantSendLocks(pindex->nHeight - 100); + // Find all previously unlocked TXs that got locked by this fully confirmed (ChainLock) block and remove them // from the nonLockedTxs map. Also collect all children of these TXs and mark them for retrying of IS locking. std::vector toRemove; From d660a579515b1bb496be2da39e573048814a2ae3 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 27 Jan 2021 03:38:17 +0300 Subject: [PATCH 5/7] refactor: Squash two loops in AddNonLockedTx into one `!info.tx == res.second` is always `true` --- src/llmq/quorums_instantsend.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 12cb89d12623..8d2f414f1793 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -1048,15 +1048,10 @@ void CInstantSendManager::AddNonLockedTx(const CTransactionRef& tx, const CBlock auto& info = res.first->second; info.pindexMined = pindexMined; - if (!info.tx) { + if (res.second) { info.tx = tx; for (const auto& in : tx->vin) { nonLockedTxs[in.prevout.hash].children.emplace(tx->GetHash()); - } - } - - if (res.second) { - for (auto& in : tx->vin) { nonLockedTxsByOutpoints.emplace(in.prevout, tx->GetHash()); } } From f11b8b5faae3d9c62efa90eddc246033567826ec Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 10 Feb 2021 14:04:31 +0300 Subject: [PATCH 6/7] Update src/llmq/quorums_instantsend.cpp Co-authored-by: dustinface <35775977+xdustinface@users.noreply.github.com> --- src/llmq/quorums_instantsend.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 8d2f414f1793..30d0c7f47ce4 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -1016,8 +1016,7 @@ void CInstantSendManager::BlockConnected(const std::shared_ptr& pb continue; } - bool non_locked = islockHash.IsNull() && !chainLocksHandler->HasChainLock(pindex->nHeight, pindex->GetBlockHash()); - if (non_locked) { + if (islockHash.IsNull() && !chainLocksHandler->HasChainLock(pindex->nHeight, pindex->GetBlockHash())) { ProcessTx(*tx, true, Params().GetConsensus()); // TX is not locked, so make sure it is tracked LOCK(cs); From 96756a047c085bbd383bd2131da81b1e86c95ac8 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 11 Feb 2021 20:05:26 +0300 Subject: [PATCH 7/7] Update src/llmq/quorums_instantsend.cpp --- src/llmq/quorums_instantsend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 30d0c7f47ce4..f92931ef4944 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -958,7 +958,7 @@ void CInstantSendManager::TransactionAddedToMempool(const CTransactionRef& tx) return; } - CInstantSendLockPtr islock; + CInstantSendLockPtr islock{nullptr}; { LOCK(cs); islock = db.GetInstantSendLockByTxid(tx->GetHash());