Commit 0f929c97 authored by coin-server's avatar coin-server

Update to spork.cpp::CheckSignature

parent 809073c4
......@@ -187,29 +187,27 @@ void ReprocessBlocks(int nBlocks)
bool CSporkManager::CheckSignature(CSporkMessage& spork, bool fCheckSigner)
{
//note: need to investigate why this is failing
std::string strMessage = boost::lexical_cast<std::string>(spork.nSporkID) + boost::lexical_cast<std::string>(spork.nValue) + boost::lexical_cast<std::string>(spork.nTimeSigned);
std::string strMessage = std::to_string(spork.nSporkID) + std::to_string(spork.nValue) + std::to_string(spork.nTimeSigned);
CPubKey pubkeynew(ParseHex(Params().SporkKey()));
std::string errorMessage = "";
if (fCheckSigner && !obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig,strMessage, errorMessage))
bool fValidWithNewKey = obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig,strMessage, errorMessage);
if (fCheckSigner && !fValidWithNewKey)
return false;
if (GetAdjustedTime() < Params().RejectOldSporkKey()) {
// See if window is open that allows for old spork key to sign messages
if (!fValidWithNewKey && GetAdjustedTime() < Params().RejectOldSporkKey()) {
CPubKey pubkeyold(ParseHex(Params().SporkKeyOld()));
if (obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig, strMessage, errorMessage) ||
obfuScationSigner.VerifyMessage(pubkeyold, spork.vchSig, strMessage, errorMessage)) {
return true;
}
}
else if (obfuScationSigner.VerifyMessage(pubkeynew, spork.vchSig, strMessage, errorMessage)) {
return true;
return obfuScationSigner.VerifyMessage(pubkeyold, spork.vchSig, strMessage, errorMessage);
}
return false;
return fValidWithNewKey;
}
bool CSporkManager::Sign(CSporkMessage& spork)
{
std::string strMessage = boost::lexical_cast<std::string>(spork.nSporkID) + boost::lexical_cast<std::string>(spork.nValue) + boost::lexical_cast<std::string>(spork.nTimeSigned);
std::string strMessage = std::to_string(spork.nSporkID) + std::to_string(spork.nValue) + std::to_string(spork.nTimeSigned);
CKey key2;
CPubKey pubkey2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment