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 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):