aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/p2p_protocol_defs.h
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2020-03-12 00:32:37 -0700
committerAlexander Blair <snipa@jagtech.io>2020-03-12 00:32:46 -0700
commit092a57df996be75e3a45e9dc69d15138093f503b (patch)
treebe5f80d07b7e897772b71ac0037e7b81232b775b /src/p2p/p2p_protocol_defs.h
parentMerge pull request #6248 (diff)
parentp2p: remove obsolete local time in handshake (diff)
downloadmonero-092a57df996be75e3a45e9dc69d15138093f503b.tar.xz
Merge pull request #6243
4771a7ae p2p: remove obsolete local time in handshake (moneromooo-monero) 2fbbc4a2 p2p: avoid sending the same peer list over and over (moneromooo-monero) 3004835b epee: remove backward compatible endian specific address serialization (moneromooo-monero) 39a343d7 p2p: remove backward compatible peer list (moneromooo-monero) 60631802 p2p: simplify last_seen serialization now we have optional stores (moneromooo-monero) 9467b2e4 cryptonote_protocol: omit top 64 bits of difficulty when 0 (moneromooo-monero) b595583f serialization: do not write optional fields with default value (moneromooo-monero) 5f98b46d p2p: remove obsolete local time from TIMED_SYNC (moneromooo-monero)
Diffstat (limited to 'src/p2p/p2p_protocol_defs.h')
-rw-r--r--src/p2p/p2p_protocol_defs.h67
1 files changed, 3 insertions, 64 deletions
diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h
index 393bddd05..efc8e52fd 100644
--- a/src/p2p/p2p_protocol_defs.h
+++ b/src/p2p/p2p_protocol_defs.h
@@ -82,8 +82,7 @@ namespace nodetool
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(adr)
KV_SERIALIZE(id)
- if (!is_store || this_ref.last_seen != 0)
- KV_SERIALIZE_OPT(last_seen, (int64_t)0)
+ KV_SERIALIZE_OPT(last_seen, (int64_t)0)
KV_SERIALIZE_OPT(pruning_seed, (uint32_t)0)
KV_SERIALIZE_OPT(rpc_port, (uint16_t)0)
KV_SERIALIZE_OPT(rpc_credits_per_hash, (uint32_t)0)
@@ -166,7 +165,6 @@ namespace nodetool
struct basic_node_data
{
uuid network_id;
- uint64_t local_time;
uint32_t my_port;
uint16_t rpc_port;
uint32_t rpc_credits_per_hash;
@@ -175,7 +173,6 @@ namespace nodetool
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE_VAL_POD_AS_BLOB(network_id)
KV_SERIALIZE(peer_id)
- KV_SERIALIZE(local_time)
KV_SERIALIZE(my_port)
KV_SERIALIZE_OPT(rpc_port, (uint16_t)(0))
KV_SERIALIZE_OPT(rpc_credits_per_hash, (uint32_t)0)
@@ -214,35 +211,7 @@ namespace nodetool
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(node_data)
KV_SERIALIZE(payload_data)
- if (is_store)
- {
- // saving: save both, so old and new peers can understand it
- KV_SERIALIZE(local_peerlist_new)
- std::vector<peerlist_entry_base<network_address_old>> local_peerlist;
- for (const auto &p: this_ref.local_peerlist_new)
- {
- if (p.adr.get_type_id() == epee::net_utils::ipv4_network_address::get_type_id())
- {
- const epee::net_utils::network_address &na = p.adr;
- const epee::net_utils::ipv4_network_address &ipv4 = na.as<const epee::net_utils::ipv4_network_address>();
- local_peerlist.push_back(peerlist_entry_base<network_address_old>({{ipv4.ip(), ipv4.port()}, p.id, p.last_seen, p.pruning_seed, p.rpc_port, p.rpc_credits_per_hash}));
- }
- else
- MDEBUG("Not including in legacy peer list: " << p.adr.str());
- }
- epee::serialization::selector<is_store>::serialize_stl_container_pod_val_as_blob(local_peerlist, stg, hparent_section, "local_peerlist");
- }
- else
- {
- // loading: load old list only if there is no new one
- if (!epee::serialization::selector<is_store>::serialize(this_ref.local_peerlist_new, stg, hparent_section, "local_peerlist_new"))
- {
- std::vector<peerlist_entry_base<network_address_old>> local_peerlist;
- epee::serialization::selector<is_store>::serialize_stl_container_pod_val_as_blob(local_peerlist, stg, hparent_section, "local_peerlist");
- for (const auto &p: local_peerlist)
- ((response&)this_ref).local_peerlist_new.push_back(peerlist_entry({epee::net_utils::ipv4_network_address(p.adr.ip, p.adr.port), p.id, p.last_seen, p.pruning_seed, p.rpc_port, p.rpc_credits_per_hash}));
- }
- }
+ KV_SERIALIZE(local_peerlist_new)
END_KV_SERIALIZE_MAP()
};
typedef epee::misc_utils::struct_init<response_t> response;
@@ -268,42 +237,12 @@ namespace nodetool
struct response_t
{
- uint64_t local_time;
t_playload_type payload_data;
std::vector<peerlist_entry> local_peerlist_new;
BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(local_time)
KV_SERIALIZE(payload_data)
- if (is_store)
- {
- // saving: save both, so old and new peers can understand it
- KV_SERIALIZE(local_peerlist_new)
- std::vector<peerlist_entry_base<network_address_old>> local_peerlist;
- for (const auto &p: this_ref.local_peerlist_new)
- {
- if (p.adr.get_type_id() == epee::net_utils::ipv4_network_address::get_type_id())
- {
- const epee::net_utils::network_address &na = p.adr;
- const epee::net_utils::ipv4_network_address &ipv4 = na.as<const epee::net_utils::ipv4_network_address>();
- local_peerlist.push_back(peerlist_entry_base<network_address_old>({{ipv4.ip(), ipv4.port()}, p.id, p.last_seen}));
- }
- else
- MDEBUG("Not including in legacy peer list: " << p.adr.str());
- }
- epee::serialization::selector<is_store>::serialize_stl_container_pod_val_as_blob(local_peerlist, stg, hparent_section, "local_peerlist");
- }
- else
- {
- // loading: load old list only if there is no new one
- if (!epee::serialization::selector<is_store>::serialize(this_ref.local_peerlist_new, stg, hparent_section, "local_peerlist_new"))
- {
- std::vector<peerlist_entry_base<network_address_old>> local_peerlist;
- epee::serialization::selector<is_store>::serialize_stl_container_pod_val_as_blob(local_peerlist, stg, hparent_section, "local_peerlist");
- for (const auto &p: local_peerlist)
- ((response&)this_ref).local_peerlist_new.push_back(peerlist_entry({epee::net_utils::ipv4_network_address(p.adr.ip, p.adr.port), p.id, p.last_seen}));
- }
- }
+ KV_SERIALIZE(local_peerlist_new)
END_KV_SERIALIZE_MAP()
};
typedef epee::misc_utils::struct_init<response_t> response;