From c7890b7d2ba359ca4dec193e8a1cd11fb0237819 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Tue, 29 Jul 2025 21:03:21 +0700 Subject: [PATCH 1/2] fix: avoid possible nullptr for unknown hash of qc after LookupBlockIndex --- src/llmq/blockprocessor.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/llmq/blockprocessor.cpp b/src/llmq/blockprocessor.cpp index 17c7d562c7d99..d8a8d74c1184c 100644 --- a/src/llmq/blockprocessor.cpp +++ b/src/llmq/blockprocessor.cpp @@ -219,6 +219,11 @@ bool CQuorumBlockProcessor::ProcessBlock(const CBlock& block, gsl::not_nullnHeight, qc.quorumHash.ToString()); + return false; + } qc.VerifySignatureAsync(m_dmnman, m_qsnapman, pQuorumBaseBlockIndex, &queue_control); } @@ -334,6 +339,11 @@ bool CQuorumBlockProcessor::ProcessCommitment(int nHeight, const uint256& blockH } const auto* pQuorumBaseBlockIndex = m_chainstate.m_blockman.LookupBlockIndex(qc.quorumHash); + if (pQuorumBaseBlockIndex == nullptr) { + LogPrint(BCLog::LLMQ, "%s -- unexpectedly failed due to no known pindex for hash[%s]\n", __func__, + qc.quorumHash.ToString()); + return false; + } // we don't validate signatures here; they already validated on previous step if (!qc.Verify(m_dmnman, m_qsnapman, pQuorumBaseBlockIndex, /*checksigs=*/false)) { From 3b9e061b02b8e33741268604f4513dde9532b5dd Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Thu, 21 Aug 2025 14:55:48 +0700 Subject: [PATCH 2/2] fix: handle possible nullptr in InitNewQuorum --- src/llmq/dkgsessionhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llmq/dkgsessionhandler.cpp b/src/llmq/dkgsessionhandler.cpp index 306b74b91b079..c5dfcce1acfd2 100644 --- a/src/llmq/dkgsessionhandler.cpp +++ b/src/llmq/dkgsessionhandler.cpp @@ -539,7 +539,7 @@ void CDKGSessionHandler::HandleDKGRound(CConnman& connman, PeerManager& peerman) const CBlockIndex* pQuorumBaseBlockIndex = WITH_LOCK(::cs_main, return m_chainstate.m_blockman.LookupBlockIndex(curQuorumHash)); - if (!InitNewQuorum(pQuorumBaseBlockIndex)) { + if (!pQuorumBaseBlockIndex || !InitNewQuorum(pQuorumBaseBlockIndex)) { // should actually never happen WaitForNewQuorum(curQuorumHash); throw AbortPhaseException();