| 850 | } |
| 851 | |
| 852 | bool AppInitParameterInteraction(const ArgsManager& args) |
| 853 | { |
| 854 | const CChainParams& chainparams = Params(); |
| 855 | // ********************************************************* Step 2: parameter interactions |
| 856 | |
| 857 | // also see: InitParameterInteraction() |
| 858 | |
| 859 | // Error if network-specific options (-addnode, -connect, etc) are |
| 860 | // specified in default section of config file, but not overridden |
| 861 | // on the command line or in this network's section of the config file. |
| 862 | std::string network = args.GetChainName(); |
| 863 | if (network == CBaseChainParams::SIGNET) { |
| 864 | LogPrintf("Signet derived magic (message start): %s\n", HexStr(chainparams.MessageStart())); |
| 865 | } |
| 866 | bilingual_str errors; |
| 867 | for (const auto& arg : args.GetUnsuitableSectionOnlyArgs()) { |
| 868 | errors += strprintf(_("Config setting for %s only applied on %s network when in [%s] section.") + Untranslated("\n"), arg, network, network); |
| 869 | } |
| 870 | |
| 871 | if (!errors.empty()) { |
| 872 | return InitError(errors); |
| 873 | } |
| 874 | |
| 875 | if (!fs::is_directory(gArgs.GetBlocksDirPath())) { |
| 876 | return InitError(strprintf(_("Specified blocks directory \"%s\" does not exist."), args.GetArg("-blocksdir", ""))); |
| 877 | } |
| 878 | |
| 879 | // parse and validate enabled filter types |
| 880 | std::string blockfilterindex_value = args.GetArg("-blockfilterindex", DEFAULT_BLOCKFILTERINDEX); |
| 881 | if (blockfilterindex_value == "" || blockfilterindex_value == "1") { |
| 882 | g_enabled_filter_types = AllBlockFilterTypes(); |
| 883 | } else if (blockfilterindex_value != "0") { |
| 884 | const std::vector<std::string> names = args.GetArgs("-blockfilterindex"); |
| 885 | for (const auto& name : names) { |
| 886 | BlockFilterType filter_type; |
| 887 | if (!BlockFilterTypeByName(name, filter_type)) { |
| 888 | return InitError(strprintf(_("Unknown -blockfilterindex value %s."), name)); |
| 889 | } |
| 890 | g_enabled_filter_types.insert(filter_type); |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | // Signal NODE_COMPACT_FILTERS if peerblockfilters and basic filters index are both enabled. |
| 895 | if (args.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS)) { |
| 896 | if (g_enabled_filter_types.count(BlockFilterType::BASIC) != 1) { |
| 897 | return InitError(_("Cannot set -peerblockfilters without -blockfilterindex.")); |
| 898 | } |
| 899 | |
| 900 | nLocalServices = ServiceFlags(nLocalServices | NODE_COMPACT_FILTERS); |
| 901 | } |
| 902 | |
| 903 | // if using block pruning, then disallow txindex and coinstatsindex |
| 904 | if (args.GetIntArg("-prune", 0)) { |
| 905 | if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX)) |
| 906 | return InitError(_("Prune mode is incompatible with -txindex.")); |
| 907 | if (args.GetBoolArg("-coinstatsindex", DEFAULT_COINSTATSINDEX)) |
| 908 | return InitError(_("Prune mode is incompatible with -coinstatsindex.")); |
| 909 | } |