mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
[validation] Introduce IsBlockMutated
This commit is contained in:
parent
e7669e1343
commit
66abce1d98
2 changed files with 23 additions and 0 deletions
|
|
@ -3824,6 +3824,26 @@ bool HasValidProofOfWork(const std::vector<CBlockHeader>& headers, const Consens
|
|||
[&](const auto& header) { return CheckProofOfWork(header.GetHash(), header.nBits, consensusParams);});
|
||||
}
|
||||
|
||||
bool IsBlockMutated(const CBlock& block, bool check_witness_root)
|
||||
{
|
||||
BlockValidationState state;
|
||||
if (!CheckMerkleRoot(block, state)) {
|
||||
LogDebug(BCLog::VALIDATION, "Block mutated: %s\n", state.ToString());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CheckWitnessMalleation(block, check_witness_root, state)) {
|
||||
LogDebug(BCLog::VALIDATION, "Block mutated: %s\n", state.ToString());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
arith_uint256 CalculateHeadersWork(const std::vector<CBlockHeader>& headers)
|
||||
{
|
||||
arith_uint256 total_work{0};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue