mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 05:39:38 +02:00
blockstorage: return an error code from ReadRawBlock()
It will enable different error handling flows for different error types. Also, `ReadRawBlockBench` performance has decreased due to no longer reusing a vector with an unchanging capacity - mirroring our production code behavior. Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com> Co-authored-by: Lőrinc <pap.lorinc@gmail.com>
This commit is contained in:
@@ -57,11 +57,9 @@ static void ReadRawBlockBench(benchmark::Bench& bench)
|
||||
const auto testing_setup{MakeNoLogFileContext<const TestingSetup>(ChainType::MAIN)};
|
||||
auto& blockman{testing_setup->m_node.chainman->m_blockman};
|
||||
const auto pos{blockman.WriteBlock(CreateTestBlock(), 413'567)};
|
||||
std::vector<std::byte> block_data;
|
||||
blockman.ReadRawBlock(block_data, pos); // warmup
|
||||
bench.run([&] {
|
||||
const auto success{blockman.ReadRawBlock(block_data, pos)};
|
||||
assert(success);
|
||||
const auto res{blockman.ReadRawBlock(pos)};
|
||||
assert(res);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user