From dddd6f0f5832844de8d6f9956dabbb8c8abe80b5 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 19 Mar 2019 16:37:39 -0400 Subject: init: Throw error when network specific config is ignored --- src/init.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 0898d0ff25..1960846376 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -828,19 +828,6 @@ void InitParameterInteraction() if (gArgs.SoftSetBoolArg("-whitelistrelay", true)) LogPrintf("%s: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1\n", __func__); } - - // Warn if network-specific options (-addnode, -connect, etc) are - // specified in default section of config file, but not overridden - // on the command line or in this network's section of the config file. - std::string network = gArgs.GetChainName(); - for (const auto& arg : gArgs.GetUnsuitableSectionOnlyArgs()) { - InitWarning(strprintf(_("Config setting for %s only applied on %s network when in [%s] section."), arg, network, network)); - } - - // Warn if unrecognized section name are present in the config file. - for (const auto& section : gArgs.GetUnrecognizedSections()) { - InitWarning(strprintf("%s:%i " + _("Section [%s] is not recognized."), section.m_file, section.m_line, section.m_name)); - } } static std::string ResolveErrMsg(const char * const optname, const std::string& strBind) @@ -950,6 +937,19 @@ bool AppInitParameterInteraction() // also see: InitParameterInteraction() + // Warn if network-specific options (-addnode, -connect, etc) are + // specified in default section of config file, but not overridden + // on the command line or in this network's section of the config file. + std::string network = gArgs.GetChainName(); + for (const auto& arg : gArgs.GetUnsuitableSectionOnlyArgs()) { + return InitError(strprintf(_("Config setting for %s only applied on %s network when in [%s] section."), arg, network, network)); + } + + // Warn if unrecognized section name are present in the config file. + for (const auto& section : gArgs.GetUnrecognizedSections()) { + InitWarning(strprintf("%s:%i " + _("Section [%s] is not recognized."), section.m_file, section.m_line, section.m_name)); + } + if (!fs::is_directory(GetBlocksDir())) { return InitError(strprintf(_("Specified blocks directory \"%s\" does not exist."), gArgs.GetArg("-blocksdir", "").c_str())); } -- cgit v1.2.3 From fa4a922d78bf16892172b20f29389dc11b72847d Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 21 Mar 2019 16:04:35 -0400 Subject: qa: Add test for missing testnet section in conf file --- test/functional/feature_config_args.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/functional/feature_config_args.py b/test/functional/feature_config_args.py index 13481b0478..2b93e3c24d 100755 --- a/test/functional/feature_config_args.py +++ b/test/functional/feature_config_args.py @@ -25,6 +25,10 @@ class ConfArgsTest(BitcoinTestFramework): conf.write('-dash=1\n') self.nodes[0].assert_start_raises_init_error(expected_msg='Error reading configuration file: parse error on line 1: -dash=1, options in configuration file must be specified without leading -') + with open(inc_conf_file_path, 'w', encoding='utf8') as conf: + conf.write("wallet=foo\n") + self.nodes[0].assert_start_raises_init_error(expected_msg='Error: Config setting for -wallet only applied on regtest network when in [regtest] section.') + with open(inc_conf_file_path, 'w', encoding='utf-8') as conf: conf.write('nono\n') self.nodes[0].assert_start_raises_init_error(expected_msg='Error reading configuration file: parse error on line 1: nono, if you intended to specify a negated option, use nono=1 instead') -- cgit v1.2.3 From fa9058f0edd44091af3b9e582e209f16670d6370 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 21 Mar 2019 13:38:52 -0400 Subject: doc: Add release notes for 15629 --- doc/release-notes.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/release-notes.md b/doc/release-notes.md index ebcdcda306..4faf64a325 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -73,9 +73,14 @@ Example item Low-level changes ================= -Example item +Configuration ------------ +* An error is issued where previously a warning was issued when a setting in + the config file was specified in the default section, but not overriden for + the selected network. This change takes only effect if the selected network + is not mainnet. + Credits ======= -- cgit v1.2.3 From fae38c3dc6a2dc633c236a0c27ca5a642767033e Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 22 Mar 2019 13:21:58 -0400 Subject: doc: Fix all typos reported by codespell --- doc/release-notes.md | 2 +- src/validation.cpp | 2 +- test/functional/test_framework/test_node.py | 2 +- test/functional/wallet_importmulti.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/release-notes.md b/doc/release-notes.md index 4faf64a325..c8c212abbf 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -77,7 +77,7 @@ Configuration ------------ * An error is issued where previously a warning was issued when a setting in - the config file was specified in the default section, but not overriden for + the config file was specified in the default section, but not overridden for the selected network. This change takes only effect if the selected network is not mainnet. diff --git a/src/validation.cpp b/src/validation.cpp index a9b5bcf4a4..21319b67c0 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2803,7 +2803,7 @@ bool CChainState::InvalidateBlock(CValidationState& state, const CChainParams& c bool ret = DisconnectTip(state, chainparams, &disconnectpool); // DisconnectTip will add transactions to disconnectpool. // Adjust the mempool to be consistent with the new tip, adding - // transactions back to the mempool if disconnecting was succesful, + // transactions back to the mempool if disconnecting was successful, // and we're not doing a very deep invalidation (in which case // keeping the mempool up to date is probably futile anyway). UpdateMempoolForReorg(disconnectpool, /* fAddToMempool = */ (++disconnected <= 10) && ret); diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index ec5d3b267e..8b2006a05c 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -369,7 +369,7 @@ class TestNode(): stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL) == 0 if not sys.platform.startswith('linux'): - self.log.warning("Can't profile with perf; only availabe on Linux platforms") + self.log.warning("Can't profile with perf; only available on Linux platforms") return None if not test_success('which perf'): diff --git a/test/functional/wallet_importmulti.py b/test/functional/wallet_importmulti.py index 5bfbaa2f0b..143e67950c 100755 --- a/test/functional/wallet_importmulti.py +++ b/test/functional/wallet_importmulti.py @@ -759,7 +759,7 @@ class ImportMultiTest(BitcoinTestFramework): assert_equal(addr2, newaddr2) # Import a multisig and make sure the keys don't go into the keypool - self.log.info('Imported scripts with pubkeys shoud not have their pubkeys go into the keypool') + self.log.info('Imported scripts with pubkeys should not have their pubkeys go into the keypool') addr1 = self.nodes[0].getnewaddress() addr2 = self.nodes[0].getnewaddress() pub1 = self.nodes[0].getaddressinfo(addr1)['pubkey'] -- cgit v1.2.3