diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2017-05-11 14:59:57 +0200 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2018-02-09 19:56:11 +1100 |
commit | fa999affad115c09743f8b1f5812326c19753ba9 (patch) | |
tree | 11e8bb9fd8461423b5cea415be01f38cff9a82d7 /src/net.cpp | |
parent | 6fe57bdaac17d49af9ec7f36c1414d5d2bcec564 (diff) |
[QA] Allow addrman loopback tests (add debug option -addrmantest)
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index b4b43c3bad..ea6360f388 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -181,6 +181,10 @@ void AdvertiseLocal(CNode *pnode) if (fListen && pnode->fSuccessfullyConnected) { CAddress addrLocal = GetLocalAddress(&pnode->addr, pnode->GetLocalServices()); + if (gArgs.GetBoolArg("-addrmantest", false)) { + // use IPv4 loopback during addrmantest + addrLocal = CAddress(CService(LookupNumeric("127.0.0.1", GetListenPort())), pnode->GetLocalServices()); + } // If discovery is enabled, sometimes give our peer the address it // tells us that it sees us as in case it has a better idea of our // address than we do. @@ -189,7 +193,7 @@ void AdvertiseLocal(CNode *pnode) { addrLocal.SetIP(pnode->GetAddrLocal()); } - if (addrLocal.IsRoutable()) + if (addrLocal.IsRoutable() || gArgs.GetBoolArg("-addrmantest", false)) { LogPrint(BCLog::NET, "AdvertiseLocal: advertising address %s\n", addrLocal.ToString()); FastRandomContext insecure_rand; |