diff options
| author | Jonas Schnelli <[email protected]> | 2017-05-11 14:59:57 +0200 |
|---|---|---|
| committer | Jonas Schnelli <[email protected]> | 2018-02-09 19:56:11 +1100 |
| commit | fa999affad115c09743f8b1f5812326c19753ba9 (patch) | |
| tree | 11e8bb9fd8461423b5cea415be01f38cff9a82d7 | |
| parent | Connect to peers signaling NODE_NETWORK_LIMITED when out-of-IBD (diff) | |
| download | discoin-fa999affad115c09743f8b1f5812326c19753ba9.tar.xz discoin-fa999affad115c09743f8b1f5812326c19753ba9.zip | |
[QA] Allow addrman loopback tests (add debug option -addrmantest)
| -rw-r--r-- | src/init.cpp | 1 | ||||
| -rw-r--r-- | src/net.cpp | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp index 84398d978..79365d493 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -447,6 +447,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += HelpMessageOpt("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT)); strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT)); strUsage += HelpMessageOpt("-vbparams=deployment:start:end", "Use given start/end times for specified version bits deployment (regtest-only)"); + strUsage += HelpMessageOpt("-addrmantest", "Allows to test address relay on localhost"); } strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " + _("If <category> is not supplied or if <category> = 1, output all debugging information.") + " " + _("<category> can be:") + " " + ListLogCategories() + "."); diff --git a/src/net.cpp b/src/net.cpp index b4b43c3ba..ea6360f38 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; |