Skip to content

Commit be25ac3

Browse files
committed
[init] Remove -addrmantest command line arg
-addrmantest is only used in `p2p_node_network_limited.py` test to test if the node self-advertises a hard-coded local address (which wouldn't be advertised in the tests because it's unroutable without the test-only code path) to check pruning-related services are correct in that addr. Remove -addrmantest because the self advertisement happens because of hard coded test path logic, and expected services are nominal due to how easily the test-only code could diverge from mainnet logic. It's also being used only in 1 test.
1 parent 802e6e1 commit be25ac3

File tree

3 files changed

+2
-19
lines changed

3 files changed

+2
-19
lines changed

src/init.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,6 @@ void SetupServerArgs(ArgsManager& argsman)
610610
argsman.AddArg("-limitancestorsize=<n>", strprintf("Do not accept transactions whose size with all in-mempool ancestors exceeds <n> kilobytes (default: %u)", DEFAULT_ANCESTOR_SIZE_LIMIT_KVB), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
611611
argsman.AddArg("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
612612
argsman.AddArg("-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_KVB), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
613-
argsman.AddArg("-addrmantest", "Allows to test address relay on localhost", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
614613
argsman.AddArg("-test=<option>", "Pass a test-only option. Options include : " + Join(TEST_OPTIONS_DOC, ", ") + ".", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
615614
argsman.AddArg("-capturemessages", "Capture all P2P messages to disk", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
616615
argsman.AddArg("-mocktime=<n>", "Replace actual time with " + UNIX_EPOCH_TIME + " (default: 0)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);

src/net.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,6 @@ static int GetnScore(const CService& addr)
238238
std::optional<CService> GetLocalAddrForPeer(CNode& node)
239239
{
240240
CService addrLocal{GetLocalAddress(node)};
241-
if (gArgs.GetBoolArg("-addrmantest", false)) {
242-
// use IPv4 loopback during addrmantest
243-
addrLocal = CService(LookupNumeric("127.0.0.1", GetListenPort()));
244-
}
245241
// If discovery is enabled, sometimes give our peer the address it
246242
// tells us that it sees us as in case it has a better idea of our
247243
// address than we do.
@@ -261,8 +257,7 @@ std::optional<CService> GetLocalAddrForPeer(CNode& node)
261257
addrLocal.SetIP(node.GetAddrLocal());
262258
}
263259
}
264-
if (addrLocal.IsRoutable() || gArgs.GetBoolArg("-addrmantest", false))
265-
{
260+
if (addrLocal.IsRoutable()) {
266261
LogPrint(BCLog::NET, "Advertising address %s to peer=%d\n", addrLocal.ToStringAddrPort(), node.GetId());
267262
return addrLocal;
268263
}

test/functional/p2p_node_network_limited.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
NODE_P2P_V2,
1616
NODE_WITNESS,
1717
msg_getdata,
18-
msg_verack,
1918
)
2019
from test_framework.p2p import P2PInterface
2120
from test_framework.test_framework import BitcoinTestFramework
@@ -43,7 +42,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
4342
def set_test_params(self):
4443
self.setup_clean_chain = True
4544
self.num_nodes = 3
46-
self.extra_args = [['-prune=550', '-addrmantest'], [], []]
45+
self.extra_args = [['-prune=550'], [], []]
4746

4847
def disconnect_all(self):
4948
self.disconnect_nodes(0, 1)
@@ -78,16 +77,6 @@ def run_test(self):
7877
self.log.info("Requesting block at height 2 (tip-289) must fail (ignored).")
7978
node.send_getdata_for_block(blocks[0]) # first block outside of the 288+2 limit
8079
node.wait_for_disconnect(5)
81-
82-
self.log.info("Check local address relay, do a fresh connection.")
83-
self.nodes[0].disconnect_p2ps()
84-
node1 = self.nodes[0].add_p2p_connection(P2PIgnoreInv())
85-
node1.send_message(msg_verack())
86-
87-
node1.wait_for_addr()
88-
#must relay address with NODE_NETWORK_LIMITED
89-
assert_equal(node1.firstAddrnServices, expected_services)
90-
9180
self.nodes[0].disconnect_p2ps()
9281

9382
# connect unsynced node 2 with pruned NODE_NETWORK_LIMITED peer

0 commit comments

Comments
 (0)