Skip to content

Commit

Permalink
config: separate the asmap finding and parsing checks
Browse files Browse the repository at this point in the history
and update the tests.
  • Loading branch information
jonatack authored and furszy committed Jul 28, 2021
1 parent 618b8d1 commit 6545656
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1976,9 +1976,13 @@ bool AppInitMain()
if (!asmap_path.is_absolute()) {
asmap_path = GetDataDir() / asmap_path;
}
if (!fs::exists(asmap_path)) {
UIError(strprintf(_("Could not find asmap file %s"), asmap_path));
return false;
}
std::vector<bool> asmap = CAddrMan::DecodeAsmap(asmap_path);
if (asmap.size() == 0) {
UIError(strprintf(_("Could not find or parse specified asmap: '%s'"), asmap_path));
UIError(strprintf(_("Could not parse asmap file '%s'"), asmap_path));
return false;
}
const uint256 asmap_version = SerializeHash(asmap);
Expand Down
2 changes: 1 addition & 1 deletion test/functional/feature_asmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_default_asmap(self):
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):
Expand Down

0 comments on commit 6545656

Please sign in to comment.