Skip to content

Commit

Permalink
Implement VerifyRecoveredSig to allow verifcation of sigs found in P2…
Browse files Browse the repository at this point in the history
…P messages
  • Loading branch information
codablock committed Jan 28, 2019
1 parent 9f211ef commit 4026ea2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/llmq/quorums_signing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,4 +548,17 @@ bool CSigningManager::IsConflicting(Consensus::LLMQType llmqType, const uint256&
return false;
}

bool CSigningManager::VerifyRecoveredSig(Consensus::LLMQType llmqType, const uint256& signedAtTip, const uint256& id, const uint256& msgHash, const CBLSSignature& sig)
{
auto& llmqParams = Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqTypeForChainLocks);

auto quorum = quorumManager->SelectQuorum(llmqParams.type, signedAtTip, id);
if (!quorum) {
return false;
}

uint256 signHash = CLLMQUtils::BuildSignHash(llmqParams.type, quorum->quorumHash, id, msgHash);
return sig.VerifyInsecure(quorum->quorumPublicKey, signHash);
}

}
3 changes: 3 additions & 0 deletions src/llmq/quorums_signing.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ class CSigningManager
bool HasRecoveredSigForId(Consensus::LLMQType llmqType, const uint256& id);
bool HasRecoveredSigForSession(const uint256& signHash);
bool IsConflicting(Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash);

// Verifies a recovered sig that was signed while the chain tip was at signedAtTip
bool VerifyRecoveredSig(Consensus::LLMQType llmqType, const uint256& signedAtTip, const uint256& id, const uint256& msgHash, const CBLSSignature& sig);
};

extern CSigningManager* quorumSigningManager;
Expand Down

0 comments on commit 4026ea2

Please sign in to comment.