From a94cb92903163a404c5b7d39cad725df997f2b51 Mon Sep 17 00:00:00 2001 From: cryptocode <34946442+cryptocode@users.noreply.github.com> Date: Wed, 19 Sep 2018 16:18:18 +0200 Subject: [PATCH] Bootstrap only from nodes that could be possibly up-to-date given vote-by-hash (#1184) This will disable bootstrapping from nodes that are very likely out of date since they can only be updated during periodic bootstrapping, which is too slow. --- rai/node/node.cpp | 2 +- rai/secure/common.hpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rai/node/node.cpp b/rai/node/node.cpp index 1c2ca9f3..c88da8e4 100644 --- a/rai/node/node.cpp +++ b/rai/node/node.cpp @@ -2123,7 +2123,7 @@ rai::endpoint rai::peer_container::bootstrap_peer () ; for (auto i (peers.get<4> ().begin ()), n (peers.get<4> ().end ()); i != n;) { - if (i->network_version >= 0x5) + if (i->network_version >= protocol_version_bootstrap_min) { result = i->endpoint; peers.get<4> ().modify (i, [](rai::peer_information & peer_a) { diff --git a/rai/secure/common.hpp b/rai/secure/common.hpp index 5fcd41dc..dd34ec47 100644 --- a/rai/secure/common.hpp +++ b/rai/secure/common.hpp @@ -29,6 +29,9 @@ const uint8_t protocol_version = 0x0f; const uint8_t protocol_version_min = 0x07; const uint8_t node_id_version = 0x0c; +/** Do not bootstrap from nodes older than this version */ +const uint8_t protocol_version_bootstrap_min = 0x0d; + /** * A key pair. The private key is generated from the random pool, or passed in * as a hex string. The public key is derived using ed25519.