Connect to peers signaling NODE_NETWORK_LIMITED when out-of-IBD

This commit is contained in:
Jonas Schnelli
2017-10-13 21:48:00 -07:00
parent 31c45a927e
commit 6fe57bdaac
5 changed files with 18 additions and 2 deletions

View File

@@ -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);
}