Skip to content

Commit 6e8e7f4

Browse files
committed
Fix nonsensical -noasmap behavior
Instead of failing with "fread failed: iostream error" error when -noasmap is specified, just don't load an asmap file.
1 parent b6ab350 commit 6e8e7f4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
14331433

14341434
// Read asmap file if configured
14351435
std::vector<bool> asmap;
1436-
if (args.IsArgSet("-asmap")) {
1436+
if (args.IsArgSet("-asmap") && !args.IsArgNegated("-asmap")) {
14371437
fs::path asmap_path = args.GetPathArg("-asmap", DEFAULT_ASMAP_FILENAME);
14381438
if (!asmap_path.is_absolute()) {
14391439
asmap_path = args.GetDataDirNet() / asmap_path;

test/functional/feature_asmap.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ def test_without_asmap_arg(self):
5454
with self.node.assert_debug_log(['Using /16 prefix for IP bucketing']):
5555
self.start_node(0)
5656

57+
def test_noasmap_arg(self):
58+
self.log.info('Test bitcoind with -noasmap arg passed')
59+
self.stop_node(0)
60+
with self.node.assert_debug_log(['Using /16 prefix for IP bucketing']):
61+
self.start_node(0, ["-noasmap"])
62+
5763
def test_asmap_with_absolute_path(self):
5864
self.log.info('Test bitcoind -asmap=<absolute path>')
5965
self.stop_node(0)
@@ -137,6 +143,7 @@ def run_test(self):
137143
self.asmap_raw = os.path.join(base_dir, ASMAP)
138144

139145
self.test_without_asmap_arg()
146+
self.test_noasmap_arg()
140147
self.test_asmap_with_absolute_path()
141148
self.test_asmap_with_relative_path()
142149
self.test_default_asmap()

0 commit comments

Comments
 (0)