Skip to content

Commit 0e177a2

Browse files
committed
Don't treat NODE_WITNESS as relevant before a fork is defined
1 parent d7fe873 commit 0e177a2

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/init.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
13911391
// Note that setting NODE_WITNESS is never required: the only downside from not
13921392
// doing so is that after activation, no upgraded nodes will fetch from you.
13931393
nLocalServices |= NODE_WITNESS;
1394+
// Only care about others providing witness capabilities if there is a softfork
1395+
// defined.
1396+
nRelevantServices |= NODE_WITNESS;
13941397
}
13951398

13961399
// ********************************************************* Step 10: import blocks

src/net.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ namespace {
7272
const static std::string NET_MESSAGE_COMMAND_OTHER = "*other*";
7373

7474
/** Services this node implementation cares about */
75-
static const uint64_t nRelevantServices = NODE_NETWORK | NODE_WITNESS;
75+
uint64_t nRelevantServices = NODE_NETWORK;
7676

7777
//
7878
// Global state variables
@@ -1601,8 +1601,8 @@ void ThreadOpenConnections()
16011601
if (nANow - addr.nLastTry < 600 && nTries < 30)
16021602
continue;
16031603

1604-
// only consider non-witness nodes after 40 failed attemps
1605-
if (!(addr.nServices & NODE_WITNESS) && nTries < 40)
1604+
// only consider nodes missing relevant services after 40 failed attemps
1605+
if ((addr.nServices & nRelevantServices) != nRelevantServices && nTries < 40)
16061606
continue;
16071607

16081608
// do not allow non-default ports, unless after 50 invalid addresses selected already

src/net.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer = NULL);
153153
extern bool fDiscover;
154154
extern bool fListen;
155155
extern uint64_t nLocalServices;
156+
extern uint64_t nRelevantServices;
156157
extern uint64_t nLocalHostNonce;
157158
extern CAddrMan addrman;
158159

0 commit comments

Comments
 (0)