MCPcopy Create free account
hub / github.com/ElementsProject/elements / AppInitParameterInteraction

Function AppInitParameterInteraction

src/init.cpp:852–1142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

850}
851
852bool 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 }

Callers 3

AppInitFunction · 0.85
BasicTestingSetupMethod · 0.85
baseInitializeMethod · 0.85

Calls 15

_Function · 0.85
UntranslatedFunction · 0.85
InitErrorFunction · 0.85
BlockFilterTypeByNameFunction · 0.85
ServiceFlagsEnum · 0.85
RaiseFileDescriptorLimitFunction · 0.85
InitWarningFunction · 0.85
SetLoggingCategoriesFunction · 0.85
uint256SFunction · 0.85
IsHexNumberFunction · 0.85
UintToArith256Function · 0.85
ParseMoneyFunction · 0.85

Tested by 1

BasicTestingSetupMethod · 0.68