Skip to content

Commit 07239d1

Browse files
committed
Merge #1009: Fix dynafed logging to not duplicate messages
b5424e9 Fix dynafed logging to not duplicate messages (Steven Roose) Pull request description: This brings it up to date with the fixed forward port in #996. Top commit has no ACKs. Tree-SHA512: 9606ea46973bb5eceadf133b2c75e6ca98c4eb70fa821429ed3e3a06bc94d2c22f6e119b73cc458e5e040df775b64580767d7fe0234081ffcedacf51be4ac97f
2 parents 28ba02e + b5424e9 commit 07239d1

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

src/validation.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2493,6 +2493,17 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
24932493
LogPrintf(" warning='%s'", warningMessages); /* Continued */
24942494
LogPrintf("\n");
24952495

2496+
// Do some logging if dynafed parameters changed.
2497+
if (pindexNew->pprev && !pindexNew->dynafed_params.IsNull()) {
2498+
int height = pindexNew->nHeight;
2499+
uint256 hash = pindexNew->GetBlockHash();
2500+
uint256 root = pindexNew->dynafed_params.m_current.CalculateRoot();
2501+
if (pindexNew->pprev->dynafed_params.IsNull()) {
2502+
LogPrintf("Dynafed activated in block %d:%s: %s\n", height, hash.GetHex(), root.GetHex());
2503+
} else if (root != pindexNew->pprev->dynafed_params.m_current.CalculateRoot()) {
2504+
LogPrintf("New dynafed parameters activated in block %d:%s: %s\n", height, hash.GetHex(), root.GetHex());
2505+
}
2506+
}
24962507
}
24972508

24982509
/** Disconnect chainActive's tip.
@@ -3592,19 +3603,6 @@ static bool ContextualCheckDynaFedHeader(const CBlockHeader& block, CValidationS
35923603
}
35933604
}
35943605

3595-
// Do some logging if parameters changed.
3596-
auto parent = pindexPrev->dynafed_params.m_current;
3597-
if (dynafed_params.m_current != parent) {
3598-
int height = pindexPrev->nHeight + 1;
3599-
std::string hash = block.GetHash().GetHex();
3600-
std::string root = dynafed_params.m_current.CalculateRoot().GetHex();
3601-
if (parent.IsNull()) {
3602-
LogPrintf("Dynafed activated in block %d:%s: %s\n", height, hash, root);
3603-
} else {
3604-
LogPrintf("New dynafed parameters activated in block %d:%s: %s\n", height, hash, root);
3605-
}
3606-
}
3607-
36083606
return true;
36093607
}
36103608

0 commit comments

Comments
 (0)