diff options
author | luigi1111 <luigi1111w@gmail.com> | 2018-08-22 20:45:09 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2018-08-22 20:45:09 -0500 |
commit | 0d415ff63806440ca46781b613d8b68e842a899f (patch) | |
tree | 94495fd886f30908f828165fc701c16a3268b41a | |
parent | Merge pull request #4204 (diff) | |
parent | cryptonote_protocol: don't serialize an unneeded new block message (diff) | |
download | monero-0d415ff63806440ca46781b613d8b68e842a899f.tar.xz |
Merge pull request #4207
ce9457a cryptonote_protocol: don't serialize an unneeded new block message (moneromooo-monero)
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.inl | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index a931d3b57..c2c660e8c 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -1683,11 +1683,6 @@ skip: fluffy_arg.b = arg.b; fluffy_arg.b.txs = fluffy_txs; - // pre-serialize them - std::string fullBlob, fluffyBlob; - epee::serialization::store_t_to_binary(arg, fullBlob); - epee::serialization::store_t_to_binary(fluffy_arg, fluffyBlob); - // sort peers between fluffy ones and others std::list<boost::uuids::uuid> fullConnections, fluffyConnections; m_p2p->for_each_connection([this, &exclude_context, &fullConnections, &fluffyConnections](connection_context& context, nodetool::peerid_type peer_id, uint32_t support_flags) @@ -1709,8 +1704,18 @@ skip: }); // send fluffy ones first, we want to encourage people to run that - m_p2p->relay_notify_to_list(NOTIFY_NEW_FLUFFY_BLOCK::ID, fluffyBlob, fluffyConnections); - m_p2p->relay_notify_to_list(NOTIFY_NEW_BLOCK::ID, fullBlob, fullConnections); + if (!fluffyConnections.empty()) + { + std::string fluffyBlob; + epee::serialization::store_t_to_binary(fluffy_arg, fluffyBlob); + m_p2p->relay_notify_to_list(NOTIFY_NEW_FLUFFY_BLOCK::ID, fluffyBlob, fluffyConnections); + } + if (!fullConnections.empty()) + { + std::string fullBlob; + epee::serialization::store_t_to_binary(arg, fullBlob); + m_p2p->relay_notify_to_list(NOTIFY_NEW_BLOCK::ID, fullBlob, fullConnections); + } return true; } |