diff options
author | luigi1111 <luigi1111w@gmail.com> | 2021-09-23 22:10:03 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2021-09-23 22:10:03 -0500 |
commit | 298c9a357f6e57eccf28db1f3e734eb6da080d9a (patch) | |
tree | cece5d9e4c744a8c115c255b89cc3ff0c4d9b0ef /src/rpc/zmq_pub.h | |
parent | Merge pull request #7890 (diff) | |
parent | RPC and ZeroMQ APIs to support p2pool (diff) | |
download | monero-298c9a357f6e57eccf28db1f3e734eb6da080d9a.tar.xz |
Merge pull request #7891
dfee15e RPC and ZeroMQ APIs to support p2pool (SChernykh)
Diffstat (limited to 'src/rpc/zmq_pub.h')
-rw-r--r-- | src/rpc/zmq_pub.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/rpc/zmq_pub.h b/src/rpc/zmq_pub.h index 02e6b8103..c636e1d7b 100644 --- a/src/rpc/zmq_pub.h +++ b/src/rpc/zmq_pub.h @@ -39,6 +39,7 @@ #include "cryptonote_basic/fwd.h" #include "net/zmq.h" #include "span.h" +#include "cryptonote_basic/difficulty.h" namespace cryptonote { namespace listener { @@ -59,6 +60,7 @@ class zmq_pub net::zmq::socket relay_; std::deque<std::vector<txpool_event>> txes_; std::array<std::size_t, 2> chain_subs_; + std::array<std::size_t, 1> miner_subs_; std::array<std::size_t, 2> txpool_subs_; boost::mutex sync_; //!< Synchronizes counts in `*_subs_` arrays. @@ -88,6 +90,11 @@ class zmq_pub \return Number of ZMQ messages sent to relay. */ std::size_t send_chain_main(std::uint64_t height, epee::span<const cryptonote::block> blocks); + /*! Send a `ZMQ_PUB` notification for a new miner data. + Thread-safe. + \return Number of ZMQ messages sent to relay. */ + std::size_t send_miner_data(uint8_t major_version, uint64_t height, const crypto::hash& prev_id, const crypto::hash& seed_hash, difficulty_type diff, uint64_t median_weight, uint64_t already_generated_coins, const std::vector<tx_block_template_backlog_entry>& tx_backlog); + /*! Send a `ZMQ_PUB` notification for new tx(es) being added to the local pool. Thread-safe. \return Number of ZMQ messages sent to relay. */ @@ -100,6 +107,13 @@ class zmq_pub void operator()(std::uint64_t height, epee::span<const cryptonote::block> blocks) const; }; + //! Callable for `send_miner_data` with weak ownership to `zmq_pub` object. + struct miner_data + { + std::weak_ptr<zmq_pub> self_; + void operator()(uint8_t major_version, uint64_t height, const crypto::hash& prev_id, const crypto::hash& seed_hash, difficulty_type diff, uint64_t median_weight, uint64_t already_generated_coins, const std::vector<tx_block_template_backlog_entry>& tx_backlog) const; + }; + //! Callable for `send_txpool_add` with weak ownership to `zmq_pub` object. struct txpool_add { |