aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/init.cpp50
-rwxr-xr-xtest/functional/feature_asmap.py3
-rwxr-xr-xtest/functional/test_runner.py2
3 files changed, 27 insertions, 28 deletions
diff --git a/src/init.cpp b/src/init.cpp
index d7a44d1d4c..14d489617c 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1418,6 +1418,31 @@ bool AppInitMain(NodeContext& node)
return InitError(ResolveErrMsg("externalip", strAddr));
}
+ // Read asmap file if configured
+ if (gArgs.IsArgSet("-asmap")) {
+ fs::path asmap_path = fs::path(gArgs.GetArg("-asmap", ""));
+ if (asmap_path.empty()) {
+ asmap_path = DEFAULT_ASMAP_FILENAME;
+ }
+ if (!asmap_path.is_absolute()) {
+ asmap_path = GetDataDir() / asmap_path;
+ }
+ if (!fs::exists(asmap_path)) {
+ InitError(strprintf(_("Could not find asmap file %s").translated, asmap_path));
+ return false;
+ }
+ std::vector<bool> asmap = CAddrMan::DecodeAsmap(asmap_path);
+ if (asmap.size() == 0) {
+ InitError(strprintf(_("Could not parse asmap file %s").translated, asmap_path));
+ return false;
+ }
+ const uint256 asmap_version = SerializeHash(asmap);
+ node.connman->SetAsmap(std::move(asmap));
+ LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString());
+ } else {
+ LogPrintf("Using /16 prefix for IP bucketing\n");
+ }
+
#if ENABLE_ZMQ
g_zmq_notification_interface = CZMQNotificationInterface::Create();
@@ -1825,31 +1850,6 @@ bool AppInitMain(NodeContext& node)
return false;
}
- // Read asmap file if configured
- if (gArgs.IsArgSet("-asmap")) {
- fs::path asmap_path = fs::path(gArgs.GetArg("-asmap", ""));
- if (asmap_path.empty()) {
- asmap_path = DEFAULT_ASMAP_FILENAME;
- }
- if (!asmap_path.is_absolute()) {
- asmap_path = GetDataDir() / asmap_path;
- }
- if (!fs::exists(asmap_path)) {
- InitError(strprintf(_("Could not find asmap file %s").translated, asmap_path));
- return false;
- }
- std::vector<bool> asmap = CAddrMan::DecodeAsmap(asmap_path);
- if (asmap.size() == 0) {
- InitError(strprintf(_("Could not parse asmap file %s").translated, asmap_path));
- return false;
- }
- const uint256 asmap_version = SerializeHash(asmap);
- node.connman->SetAsmap(std::move(asmap));
- LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString());
- } else {
- LogPrintf("Using /16 prefix for IP bucketing\n");
- }
-
// ********************************************************* Step 13: finished
SetRPCWarmupFinished();
diff --git a/test/functional/feature_asmap.py b/test/functional/feature_asmap.py
index dd12633f50..2c6553fbe2 100755
--- a/test/functional/feature_asmap.py
+++ b/test/functional/feature_asmap.py
@@ -18,8 +18,7 @@ Verify node behaviour and debug log when launching bitcoind in these cases:
6. `bitcoind -asmap` with an empty (unparsable) default asmap file
-The tests are order-independent. The slowest tests (missing default asmap and
-empty asmap) are placed last.
+The tests are order-independent.
"""
import os
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index ac746ea9bf..2036d20852 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -101,7 +101,6 @@ BASE_SCRIPTS = [
'rpc_txoutproof.py',
'wallet_listreceivedby.py',
'wallet_abandonconflict.py',
- 'feature_asmap.py',
'feature_csv_activation.py',
'rpc_rawtransaction.py',
'wallet_address_types.py',
@@ -207,6 +206,7 @@ BASE_SCRIPTS = [
'p2p_dos_header_tree.py',
'p2p_unrequested_blocks.py',
'feature_includeconf.py',
+ 'feature_asmap.py',
'rpc_deriveaddresses.py',
'rpc_deriveaddresses.py --usecli',
'rpc_scantxoutset.py',