aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/p2p_protocol_defs.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-04-23 11:07:44 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-04-24 17:56:12 +0000
commit28a7d31565cb722e1a388743e2cbc492b6ad3bed (patch)
tree623e7e6a9f6f77db2103e1890a8512586640965f /src/p2p/p2p_protocol_defs.h
parentMerge pull request #5466 (diff)
downloadmonero-28a7d31565cb722e1a388743e2cbc492b6ad3bed.tar.xz
p2p: do not send last_seen timestamp to peers
This can be used for fingerprinting and working out the network topology. Instead of sending the first N (which are sorted by last seen time), we sent a random subset of the first N+N/5, which ensures reasonably recent peers are used, while preventing repeated calls from deducing new entries are peers the target node just connected to. The list is also randomly shuffled so the original set of timestamps cannot be approximated.
Diffstat (limited to 'src/p2p/p2p_protocol_defs.h')
-rw-r--r--src/p2p/p2p_protocol_defs.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/p2p/p2p_protocol_defs.h b/src/p2p/p2p_protocol_defs.h
index 59c6099d5..85774fcd5 100644
--- a/src/p2p/p2p_protocol_defs.h
+++ b/src/p2p/p2p_protocol_defs.h
@@ -81,7 +81,8 @@ namespace nodetool
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(adr)
KV_SERIALIZE(id)
- KV_SERIALIZE(last_seen)
+ if (!is_store || this_ref.last_seen != 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)
END_KV_SERIALIZE_MAP()
@@ -132,7 +133,7 @@ namespace nodetool
ss << pe.id << "\t" << pe.adr.str()
<< " \trpc port " << (pe.rpc_port > 0 ? std::to_string(pe.rpc_port) : "-")
<< " \tpruning seed " << pe.pruning_seed
- << " \tlast_seen: " << epee::misc_utils::get_time_interval_string(now_time - pe.last_seen)
+ << " \tlast_seen: " << (pe.last_seen == 0 ? std::string("never") : epee::misc_utils::get_time_interval_string(now_time - pe.last_seen))
<< std::endl;
}
return ss.str();