Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we will have a new chainlock we need to switch chain here to the new one, because it is a new chain-locked tip and current tip should be refused, isn't it true?

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
Loading