diff options
author | Alexander Blair <snipa@jagtech.io> | 2020-08-05 07:54:14 -0700 |
---|---|---|
committer | Alexander Blair <snipa@jagtech.io> | 2020-08-05 07:54:31 -0700 |
commit | d9deb2c2fe66010bfb7978ae17c7d278143b546d (patch) | |
tree | 75a052bb95f6087421c8fedde549d6930c5af847 /src/cryptonote_core/blockchain.h | |
parent | Merge pull request #6586 (diff) | |
parent | Adding ZMQ/Pub support for txpool_add and chain_main events (diff) | |
download | monero-d9deb2c2fe66010bfb7978ae17c7d278143b546d.tar.xz |
Merge pull request #6418
e5214a2ca Adding ZMQ/Pub support for txpool_add and chain_main events (Lee Clagett)
Diffstat (limited to 'src/cryptonote_core/blockchain.h')
-rw-r--r-- | src/cryptonote_core/blockchain.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h index fb7e5c4f8..703dd6400 100644 --- a/src/cryptonote_core/blockchain.h +++ b/src/cryptonote_core/blockchain.h @@ -30,6 +30,7 @@ #pragma once #include <boost/asio/io_service.hpp> +#include <boost/function/function_fwd.hpp> #include <boost/serialization/serialization.hpp> #include <boost/serialization/version.hpp> #include <boost/serialization/list.hpp> @@ -764,7 +765,7 @@ namespace cryptonote * * @param notify the notify object to call at every new block */ - void set_block_notify(const std::shared_ptr<tools::Notify> ¬ify) { m_block_notify = notify; } + void add_block_notify(boost::function<void(std::uint64_t, epee::span<const block>)> &¬ify); /** * @brief sets a reorg notify object to call for every reorg @@ -1125,7 +1126,11 @@ namespace cryptonote bool m_batch_success; - std::shared_ptr<tools::Notify> m_block_notify; + /* `boost::function` is used because the implementation never allocates if + the callable object has a single `std::shared_ptr` or `std::weap_ptr` + internally. Whereas, the libstdc++ `std::function` will allocate. */ + + std::vector<boost::function<void(std::uint64_t, epee::span<const block>)>> m_block_notifiers; std::shared_ptr<tools::Notify> m_reorg_notify; // for prepare_handle_incoming_blocks |