mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 09:43:55 +02:00
refactor: Remove useless CBlock::GetBlockHeader
There is no need for a function to convert a CBlock to a CBlockHeader, as it's a child class of it.
This commit is contained in:
committed by
Daniela Brozzoni
parent
4568652222
commit
ca0243e3a6
@@ -33,10 +33,10 @@ FUZZ_TARGET(block_header)
|
||||
mut_block_header.SetNull();
|
||||
assert(mut_block_header.IsNull());
|
||||
CBlock block{*block_header};
|
||||
assert(block.GetBlockHeader().GetHash() == block_header->GetHash());
|
||||
assert(block.GetHash() == block_header->GetHash());
|
||||
(void)block.ToString();
|
||||
block.SetNull();
|
||||
assert(block.GetBlockHeader().GetHash() == mut_block_header.GetHash());
|
||||
assert(block.GetHash() == mut_block_header.GetHash());
|
||||
}
|
||||
{
|
||||
std::optional<CBlockLocator> block_locator = ConsumeDeserializable<CBlockLocator>(fuzzed_data_provider);
|
||||
|
||||
@@ -89,7 +89,7 @@ void initialize_chain()
|
||||
auto& chainman{*setup->m_node.chainman};
|
||||
for (const auto& block : chain) {
|
||||
BlockValidationState dummy;
|
||||
bool processed{chainman.ProcessNewBlockHeaders({{block->GetBlockHeader()}}, true, dummy)};
|
||||
bool processed{chainman.ProcessNewBlockHeaders({{*block}}, true, dummy)};
|
||||
Assert(processed);
|
||||
const auto* index{WITH_LOCK(::cs_main, return chainman.m_blockman.LookupBlockIndex(block->GetHash()))};
|
||||
Assert(index);
|
||||
@@ -171,7 +171,7 @@ void utxo_snapshot_fuzz(FuzzBufferType buffer)
|
||||
if constexpr (!INVALID) {
|
||||
for (const auto& block : *g_chain) {
|
||||
BlockValidationState dummy;
|
||||
bool processed{chainman.ProcessNewBlockHeaders({{block->GetBlockHeader()}}, true, dummy)};
|
||||
bool processed{chainman.ProcessNewBlockHeaders({{*block}}, true, dummy)};
|
||||
Assert(processed);
|
||||
const auto* index{WITH_LOCK(::cs_main, return chainman.m_blockman.LookupBlockIndex(block->GetHash()))};
|
||||
Assert(index);
|
||||
|
||||
Reference in New Issue
Block a user