aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.h
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-10-13 21:48:00 -0700
committerJonas Schnelli <dev@jonasschnelli.ch>2018-02-09 19:56:10 +1100
commit6fe57bdaac17d49af9ec7f36c1414d5d2bcec564 (patch)
tree468056c4529bc345ea568336de7ffd17324f2daa /src/protocol.h
parent31c45a927eaac934fb237433f156907092bf1d11 (diff)
downloadbitcoin-6fe57bdaac17d49af9ec7f36c1414d5d2bcec564.tar.xz
Connect to peers signaling NODE_NETWORK_LIMITED when out-of-IBD
Diffstat (limited to 'src/protocol.h')
-rw-r--r--src/protocol.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/protocol.h b/src/protocol.h
index ec5f55e4f6..4907c38e5c 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -15,6 +15,7 @@
#include <uint256.h>
#include <version.h>
+#include <atomic>
#include <stdint.h>
#include <string>
@@ -277,6 +278,7 @@ enum ServiceFlags : uint64_t {
// BIP process.
};
+extern std::atomic<bool> g_initial_block_download_completed;
/**
* Gets the set of service flags which are "desirable" for a given peer.
*
@@ -302,6 +304,9 @@ enum ServiceFlags : uint64_t {
* should be updated appropriately to filter for the same nodes.
*/
static ServiceFlags GetDesirableServiceFlags(ServiceFlags services) {
+ if ((services & NODE_NETWORK_LIMITED) && g_initial_block_download_completed) {
+ return ServiceFlags(NODE_NETWORK_LIMITED | NODE_WITNESS);
+ }
return ServiceFlags(NODE_NETWORK | NODE_WITNESS);
}