mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02: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:
parent
8ed4ff8e05
commit
cfbb212493
6 changed files with 21 additions and 9 deletions
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue