mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-02 11:55:42 +02:00
refactor: Compute work from headers without CBlockIndex
Avoid the need to construct a CBlockIndex object just to compute work for a header, when its nBits value suffices for that. Co-Authored-By: Pieter Wuille <pieter@wuille.net>
This commit is contained in:
@@ -4171,8 +4171,7 @@ arith_uint256 CalculateClaimedHeadersWork(std::span<const CBlockHeader> headers)
|
||||
{
|
||||
arith_uint256 total_work{0};
|
||||
for (const CBlockHeader& header : headers) {
|
||||
CBlockIndex dummy(header);
|
||||
total_work += GetBlockProof(dummy);
|
||||
total_work += GetBlockProof(header);
|
||||
}
|
||||
return total_work;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user