Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/spork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,22 @@ void ReprocessBlocks(int nBlocks)
}


static std::string GetSporkSignatureMessage(const CSporkMessage& spork)
{
const MessageStartChars& messageStart = Params().MessageStart();

return std::string("spork:") + Params().NetworkIDString() + ":" +
HexStr(messageStart, messageStart + MESSAGE_START_SIZE) + ":" +
Params().HashGenesisBlock().ToString() + ":" +
boost::lexical_cast<std::string>(spork.nSporkID) + ":" +
boost::lexical_cast<std::string>(spork.nValue) + ":" +
boost::lexical_cast<std::string>(spork.nTimeSigned);
}

bool CSporkManager::CheckSignature(CSporkMessage& spork)
{
//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 = GetSporkSignatureMessage(spork);
CPubKey pubkey(ParseHex(Params().SporkKey()));

std::string errorMessage = "";
Expand All @@ -192,7 +204,7 @@ bool CSporkManager::CheckSignature(CSporkMessage& spork)

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 = GetSporkSignatureMessage(spork);

CKey key2;
CPubKey pubkey2;
Expand Down