mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 22:42:04 +01:00
Fix nonsensical -noasmap behavior
Instead of failing with "fread failed: iostream error" error when -noasmap is specified, just don't load an asmap file.
This commit is contained in:
parent
b6ab350806
commit
6e8e7f433f
2 changed files with 8 additions and 1 deletions
|
@ -1433,7 +1433,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
|
||||
// Read asmap file if configured
|
||||
std::vector<bool> asmap;
|
||||
if (args.IsArgSet("-asmap")) {
|
||||
if (args.IsArgSet("-asmap") && !args.IsArgNegated("-asmap")) {
|
||||
fs::path asmap_path = args.GetPathArg("-asmap", DEFAULT_ASMAP_FILENAME);
|
||||
if (!asmap_path.is_absolute()) {
|
||||
asmap_path = args.GetDataDirNet() / asmap_path;
|
||||
|
|
|
@ -54,6 +54,12 @@ class AsmapTest(BitcoinTestFramework):
|
|||
with self.node.assert_debug_log(['Using /16 prefix for IP bucketing']):
|
||||
self.start_node(0)
|
||||
|
||||
def test_noasmap_arg(self):
|
||||
self.log.info('Test bitcoind with -noasmap arg passed')
|
||||
self.stop_node(0)
|
||||
with self.node.assert_debug_log(['Using /16 prefix for IP bucketing']):
|
||||
self.start_node(0, ["-noasmap"])
|
||||
|
||||
def test_asmap_with_absolute_path(self):
|
||||
self.log.info('Test bitcoind -asmap=<absolute path>')
|
||||
self.stop_node(0)
|
||||
|
@ -137,6 +143,7 @@ class AsmapTest(BitcoinTestFramework):
|
|||
self.asmap_raw = os.path.join(base_dir, ASMAP)
|
||||
|
||||
self.test_without_asmap_arg()
|
||||
self.test_noasmap_arg()
|
||||
self.test_asmap_with_absolute_path()
|
||||
self.test_asmap_with_relative_path()
|
||||
self.test_default_asmap()
|
||||
|
|
Loading…
Add table
Reference in a new issue