fix: refuse to create new clsig if we switched to a different fork while we were signing

This commit is contained in:
UdjinM6 2024-12-21 01:35:15 +03:00
parent dd96032e12
commit 0fc0beca0e
No known key found for this signature in database
GPG Key ID: 83592BD1400D58D9

View File

@ -519,7 +519,11 @@ MessageProcessingResult CChainLocksHandler::HandleNewRecoveredSig(const llmq::CR
// already got the same or a better CLSIG through the CLSIG message // already got the same or a better CLSIG through the CLSIG message
return {}; return {};
} }
const auto pindex = m_chainstate.m_chain.Tip()->GetAncestor(lastSignedHeight);
if (pindex == nullptr || pindex->GetBlockHash() != lastSignedMsgHash) {
// we switched to a different fork while we were signing
return {};
}
clsig = CChainLockSig(lastSignedHeight, lastSignedMsgHash, recoveredSig.sig.Get()); clsig = CChainLockSig(lastSignedHeight, lastSignedMsgHash, recoveredSig.sig.Get());
} }