mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
zmq: Pass lambda to zmq's ZMQPublishRawBlockNotifier
The lambda captures a reference to the chainman unique_ptr to retrieve block data. An assert is added on the chainman to ensure that the lambda is not used while the chainman is uninitialized. This is done in preparation for the following commits where blockstorage functions are made BlockManager methods.
This commit is contained in:
@@ -1424,7 +1424,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||
}
|
||||
|
||||
#if ENABLE_ZMQ
|
||||
g_zmq_notification_interface = CZMQNotificationInterface::Create();
|
||||
g_zmq_notification_interface = CZMQNotificationInterface::Create(
|
||||
[&chainman = node.chainman](CBlock& block, const CBlockIndex& index) {
|
||||
assert(chainman);
|
||||
return node::ReadBlockFromDisk(block, &index, chainman->GetConsensus());
|
||||
});
|
||||
|
||||
if (g_zmq_notification_interface) {
|
||||
RegisterValidationInterface(g_zmq_notification_interface.get());
|
||||
|
||||
Reference in New Issue
Block a user