Skip to content

Commit

Permalink
fix: refuse to create new clsig if we switched to a different fork wh…
Browse files Browse the repository at this point in the history
…ile we were signing
  • Loading branch information
UdjinM6 committed Dec 20, 2024
1 parent dd96032 commit 0fc0bec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/llmq/chainlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,11 @@ MessageProcessingResult CChainLocksHandler::HandleNewRecoveredSig(const llmq::CR
// already got the same or a better CLSIG through the CLSIG message
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());
}
Expand Down

0 comments on commit 0fc0bec

Please sign in to comment.