mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01: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:
@@ -1759,7 +1759,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
g_zmq_notification_interface = CZMQNotificationInterface::Create(
|
||||
[&chainman = node.chainman](std::vector<std::byte>& block, const CBlockIndex& index) {
|
||||
assert(chainman);
|
||||
return chainman->m_blockman.ReadRawBlock(block, WITH_LOCK(cs_main, return index.GetBlockPos()));
|
||||
if (auto ret{chainman->m_blockman.ReadRawBlock(WITH_LOCK(cs_main, return index.GetBlockPos()))}) {
|
||||
block = std::move(*ret);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if (g_zmq_notification_interface) {
|
||||
|
||||
Reference in New Issue
Block a user