From e8291c18da24cebc38610454f1441c25d3e28b9e Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 3 May 2018 15:03:44 +0300 Subject: [PATCH] Fix spork signature check for new nodes after SPORK_6_NEW_SIGS is switched to ON Unlike for other messages we have to check for new format even with SPORK_6_NEW_SIGS inactive because SPORK_6_NEW_SIGS default is OFF it is not the first spork to sync (and even if it would, spork order can't be guaranteed anyway). --- src/spork.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/spork.cpp b/src/spork.cpp index 35ae5aa5b485..0ea89226dac3 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -291,7 +291,14 @@ bool CSporkMessage::CheckSignature(const CKeyID& pubKeyId) const if (!CMessageSigner::VerifyMessage(pubKeyId, vchSig, strMessage, strError)){ LogPrintf("CSporkMessage::CheckSignature -- VerifyMessage() failed, error: %s\n", strError); - return false; + // Note: unlike for other messages we have to check for new format even with SPORK_6_NEW_SIGS + // inactive because SPORK_6_NEW_SIGS default is OFF and it is not the first spork to sync + // (and even if it would, spork order can't be guaranteed anyway). + uint256 hash = GetSignatureHash(); + if (!CHashSigner::VerifyHash(hash, pubKeyId, vchSig, strError)) { + LogPrintf("CSporkMessage::CheckSignature -- VerifyHash() failed, error: %s\n", strError); + return false; + } } }