Skip to content

Commit

Permalink
[Trivial] Detailed debug log for received spork messages
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed Dec 19, 2019
1 parent 80306e1 commit afabe8c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/spork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,29 @@ void CSporkManager::ProcessSpork(CNode* pfrom, std::string& strCommand, CDataStr


uint256 hash = spork.GetHash();
std::string sporkName = sporkManager.GetSporkNameByID(spork.nSporkID);
{
LOCK(cs);
if (mapSporksActive.count(spork.nSporkID)) {
// spork is active
if (mapSporksActive[spork.nSporkID].nTimeSigned >= spork.nTimeSigned) {
// spork in memory has been signed more recently
if (fDebug) LogPrintf("%s : seen %s block %d \n", __func__, hash.ToString(), nChainHeight);
LogPrintf("%s : spork %d (%s) in memory is more recent: %d >= %d\n", __func__,
spork.nSporkID, sporkName,
mapSporksActive[spork.nSporkID].nTimeSigned, spork.nTimeSigned);
return;
} else {
// update active spork
if (fDebug) LogPrintf("%s : got updated spork %s block %d \n", __func__, hash.ToString(), nChainHeight);
LogPrintf("%s : got updated spork %d (%s) with value %d (signed at %d) - block %d \n", __func__,
spork.nSporkID, sporkName, spork.nValue, spork.nTimeSigned, nChainHeight);
}
} else {
// spork is not active
if (fDebug) LogPrintf("%s : got new spork %s block %d \n", __func__, hash.ToString(), nChainHeight);
LogPrintf("%s : got new spork %d (%s) with value %d (signed at %d) - block %d \n", __func__,
spork.nSporkID, sporkName, spork.nValue, spork.nTimeSigned, nChainHeight);
}
}

LogPrintf("%s : new %s ID %d Time %d bestHeight %d\n", __func__, hash.ToString(), spork.nSporkID, spork.nValue, nChainHeight);

const bool fRequireNew = spork.nTimeSigned >= Params().NewSporkStart();
bool fValidSig = spork.CheckSignature();
if (!fValidSig && !fRequireNew) {
Expand Down

0 comments on commit afabe8c

Please sign in to comment.