diff --git a/src/spork.cpp b/src/spork.cpp index 0ea89226d..c6b4e653e 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -241,6 +241,11 @@ uint256 CSporkMessage::GetSignatureHash() const bool CSporkMessage::Sign(const CKey& key) { + if (!key.IsValid()) { + LogPrintf("CSporkMessage::Sign -- signing key is not valid\n"); + return false; + } + CKeyID pubKeyId = key.GetPubKey().GetID(); std::string strError = ""; @@ -290,7 +295,6 @@ bool CSporkMessage::CheckSignature(const CKeyID& pubKeyId) const std::string strMessage = boost::lexical_cast(nSporkID) + boost::lexical_cast(nValue) + boost::lexical_cast(nTimeSigned); if (!CMessageSigner::VerifyMessage(pubKeyId, vchSig, strMessage, strError)){ - LogPrintf("CSporkMessage::CheckSignature -- VerifyMessage() failed, error: %s\n", strError); // 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).