aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-12-04 21:21:47 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-01-26 18:37:33 +0000
commit39a343d76ed984ef03a4d2b57777b207b85fb461 (patch)
treed5945379ee98f33515e6186aa5366c5b5c26419f /src
parentp2p: simplify last_seen serialization now we have optional stores (diff)
downloadmonero-39a343d76ed984ef03a4d2b57777b207b85fb461.tar.xz
p2p: remove backward compatible peer list
Diffstat (limited to 'src')
-rw-r--r--src/p2p/p2p_protocol_defs.h60
1 files changed, 2 insertions, 58 deletions
diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h
index 4acf05ef8..3684c317a 100644
--- a/src/p2p/p2p_protocol_defs.h
+++ b/src/p2p/p2p_protocol_defs.h
@@ -213,35 +213,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;
@@ -272,35 +244,7 @@ namespace nodetool
BEGIN_KV_SERIALIZE_MAP()
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;