Merge ElementsProject/elements#994: [elements-0.18] Add logging for dynafed activation and transitions

ca827fcd75 Add logging for dynafed activation and transitions (Steven Roose)

Pull request description:

  Relating https://github.com/ElementsProject/elements/issues/981.

  Needs forward port.

Top commit has no ACKs.

Tree-SHA512: 0c22b7e7d149fa4664f4fc0d37b644e2fc1995f2c7764c8f444a331d04216da1a9b7914d54df8ab15b20aa899eddd9834bd4cbe605c1ca3fd360521c9f5f0c1d
This commit is contained in:
Steven Roose 2021-05-10 16:44:48 +02:00
commit b181708ef3
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87

View file

@ -3564,6 +3564,20 @@ 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;
}