@@ -765,13 +765,18 @@ void CSigSharesManager::TryRecoverSig(const CQuorumCPtr& quorum, const uint256&
765765 rs.sig .SetSig (recoveredSig);
766766 rs.UpdateHash ();
767767
768- auto signHash = CLLMQUtils::BuildSignHash (rs);
769- bool valid = recoveredSig.VerifyInsecure (quorum->qc .quorumPublicKey , signHash);
770- if (!valid) {
771- // this should really not happen as we have verified all signature shares before
772- LogPrintf (" CSigSharesManager::%s -- own recovered signature is invalid. id=%s, msgHash=%s\n " , __func__,
773- id.ToString (), msgHash.ToString ());
774- return ;
768+ // There should actually be no need to verify the self-recovered signatures are it should always succeed. Let's
769+ // however still verify it from time to time, so that we have a chance to catch bugs. We do only this sporadic
770+ // verification because this is unbatched and thus slow verification that happens here.
771+ if (((recoveredSigsCounter++) % 100 ) == 0 ) {
772+ auto signHash = CLLMQUtils::BuildSignHash (rs);
773+ bool valid = recoveredSig.VerifyInsecure (quorum->qc .quorumPublicKey , signHash);
774+ if (!valid) {
775+ // this should really not happen as we have verified all signature shares before
776+ LogPrintf (" CSigSharesManager::%s -- own recovered signature is invalid. id=%s, msgHash=%s\n " , __func__,
777+ id.ToString (), msgHash.ToString ());
778+ return ;
779+ }
775780 }
776781
777782 quorumSigningManager->ProcessRecoveredSig (-1 , rs, quorum, connman);
0 commit comments