aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2019-12-29 18:52:10 +0100
committerJon Atack <jon@atack.com>2020-03-04 14:24:15 +0100
commitb8d0412b213df18f23bf8677ab94068c6cca9f51 (patch)
tree0e2d5c7258e12284244995d7f61548b3a1f4d6ee
parent81c38a24975f34e5894efe3d1aaf45ff6a8cee4a (diff)
downloadbitcoin-b8d0412b213df18f23bf8677ab94068c6cca9f51.tar.xz
config: separate the asmap finding and parsing checks
and update the tests.
-rw-r--r--src/init.cpp6
-rwxr-xr-xtest/functional/feature_asmap.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 222e33c1a7..0f56f3881c 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1834,9 +1834,13 @@ bool AppInitMain(NodeContext& node)
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 find or parse specified asmap: '%s'").translated, asmap_path));
+ InitError(strprintf(_("Could not parse asmap file '%s'").translated, asmap_path));
return false;
}
const uint256 asmap_version = SerializeHash(asmap);
diff --git a/test/functional/feature_asmap.py b/test/functional/feature_asmap.py
index 07dde84775..6b9d90960a 100755
--- a/test/functional/feature_asmap.py
+++ b/test/functional/feature_asmap.py
@@ -75,7 +75,7 @@ class AsmapTest(BitcoinTestFramework):
def test_default_asmap_with_missing_file(self):
self.log.info('Test bitcoind -asmap with missing default map file')
self.stop_node(0)
- msg = "Error: Could not find or parse specified asmap: '\"{}\"'".format(self.default_asmap)
+ msg = "Error: Could not find asmap file '\"{}\"'".format(self.default_asmap)
self.node.assert_start_raises_init_error(extra_args=['-asmap'], expected_msg=msg)
def run_test(self):