[QA] Allow addrman loopback tests (add debug option -addrmantest)
This commit is contained in:
parent
6fe57bdaac
commit
fa999affad
2 changed files with 6 additions and 1 deletions
|
@ -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("-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("-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("-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) + ". " +
|
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() + ".");
|
_("If <category> is not supplied or if <category> = 1, output all debugging information.") + " " + _("<category> can be:") + " " + ListLogCategories() + ".");
|
||||||
|
|
|
@ -181,6 +181,10 @@ void AdvertiseLocal(CNode *pnode)
|
||||||
if (fListen && pnode->fSuccessfullyConnected)
|
if (fListen && pnode->fSuccessfullyConnected)
|
||||||
{
|
{
|
||||||
CAddress addrLocal = GetLocalAddress(&pnode->addr, pnode->GetLocalServices());
|
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
|
// 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
|
// tells us that it sees us as in case it has a better idea of our
|
||||||
// address than we do.
|
// address than we do.
|
||||||
|
@ -189,7 +193,7 @@ void AdvertiseLocal(CNode *pnode)
|
||||||
{
|
{
|
||||||
addrLocal.SetIP(pnode->GetAddrLocal());
|
addrLocal.SetIP(pnode->GetAddrLocal());
|
||||||
}
|
}
|
||||||
if (addrLocal.IsRoutable())
|
if (addrLocal.IsRoutable() || gArgs.GetBoolArg("-addrmantest", false))
|
||||||
{
|
{
|
||||||
LogPrint(BCLog::NET, "AdvertiseLocal: advertising address %s\n", addrLocal.ToString());
|
LogPrint(BCLog::NET, "AdvertiseLocal: advertising address %s\n", addrLocal.ToString());
|
||||||
FastRandomContext insecure_rand;
|
FastRandomContext insecure_rand;
|
||||||
|
|
Loading…
Reference in a new issue