mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Merge ElementsProject/elements#1009: Fix dynafed logging to not duplicate messages
b5424e9987 Fix dynafed logging to not duplicate messages (Steven Roose)
Pull request description:
This brings it up to date with the fixed forward port in https://github.com/ElementsProject/elements/pull/996.
Top commit has no ACKs.
Tree-SHA512: 9606ea46973bb5eceadf133b2c75e6ca98c4eb70fa821429ed3e3a06bc94d2c22f6e119b73cc458e5e040df775b64580767d7fe0234081ffcedacf51be4ac97f
This commit is contained in:
commit
07239d100b
1 changed files with 11 additions and 13 deletions
|
|
@ -2493,6 +2493,17 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
|
|||
LogPrintf(" warning='%s'", warningMessages); /* Continued */
|
||||
LogPrintf("\n");
|
||||
|
||||
// Do some logging if dynafed parameters changed.
|
||||
if (pindexNew->pprev && !pindexNew->dynafed_params.IsNull()) {
|
||||
int height = pindexNew->nHeight;
|
||||
uint256 hash = pindexNew->GetBlockHash();
|
||||
uint256 root = pindexNew->dynafed_params.m_current.CalculateRoot();
|
||||
if (pindexNew->pprev->dynafed_params.IsNull()) {
|
||||
LogPrintf("Dynafed activated in block %d:%s: %s\n", height, hash.GetHex(), root.GetHex());
|
||||
} else if (root != pindexNew->pprev->dynafed_params.m_current.CalculateRoot()) {
|
||||
LogPrintf("New dynafed parameters activated in block %d:%s: %s\n", height, hash.GetHex(), root.GetHex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Disconnect chainActive's tip.
|
||||
|
|
@ -3592,19 +3603,6 @@ static bool ContextualCheckDynaFedHeader(const CBlockHeader& block, CValidationS
|
|||
}
|
||||
}
|
||||
|
||||
// Do some logging if parameters changed.
|
||||
auto parent = pindexPrev->dynafed_params.m_current;
|
||||
if (dynafed_params.m_current != parent) {
|
||||
int height = pindexPrev->nHeight + 1;
|
||||
std::string hash = block.GetHash().GetHex();
|
||||
std::string root = dynafed_params.m_current.CalculateRoot().GetHex();
|
||||
if (parent.IsNull()) {
|
||||
LogPrintf("Dynafed activated in block %d:%s: %s\n", height, hash, root);
|
||||
} else {
|
||||
LogPrintf("New dynafed parameters activated in block %d:%s: %s\n", height, hash, root);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue