6 #if defined(HAVE_CONFIG_H)
7 #include <config/bitcoin-config.h>
77 #include <boost/signals2/signal.hpp>
80 #include <chronik-cpp/chronik.h>
123 #define MIN_CORE_FILEDESCRIPTORS 0
125 #define MIN_CORE_FILEDESCRIPTORS 150
152 std::strerror(errno)));
193 node.connman->Interrupt();
205 static Mutex g_shutdown_mutex;
206 TRY_LOCK(g_shutdown_mutex, lock_shutdown);
207 if (!lock_shutdown) {
210 LogPrintf(
"%s: In progress...\n", __func__);
219 node.mempool->AddTransactionsUpdated(1);
226 for (
const auto &client :
node.chain_clients) {
247 node.connman->Stop();
258 if (
node.scheduler) {
259 node.scheduler->stop();
261 if (
node.chainman &&
node.chainman->m_load_block.joinable()) {
262 node.chainman->m_load_block.join();
268 node.peerman.reset();
272 node.connman.reset();
274 node.addrman.reset();
276 if (
node.mempool &&
node.mempool->IsLoaded() &&
286 if (chainstate->CanFlushToDisk()) {
287 chainstate->ForceFlushStateToDisk();
317 if (chainstate->CanFlushToDisk()) {
318 chainstate->ForceFlushStateToDisk();
319 chainstate->ResetCoinsViews();
323 for (
const auto &client :
node.chain_clients) {
335 node.chain_clients.clear();
339 node.mempool.reset();
340 node.chainman.reset();
341 node.scheduler.reset();
345 LogPrintf(
"%s: Unable to remove PID file: File does not exist\n",
348 }
catch (
const fs::filesystem_error &e) {
349 LogPrintf(
"%s: Unable to remove PID file: %s\n", __func__,
371 static BOOL WINAPI consoleCtrlHandler(DWORD dwCtrlType) {
382 sigemptyset(&sa.sa_mask);
384 sigaction(signal, &sa, NULL);
409 argsman.
AddArg(
"-help-debug",
410 "Print help message with debugging options and exit",
false,
415 const auto defaultBaseParams =
417 const auto testnetBaseParams =
419 const auto regtestBaseParams =
422 const auto testnetChainParams =
424 const auto regtestChainParams =
428 std::vector<std::string> hidden_args = {
433 "-automaticunparking",
434 "-replayprotectionactivationtime",
437 "-allowselfsignedrootcertificates",
442 "-rootcertificates=<file>",
446 "-wellingtonactivationtime",
456 #if defined(HAVE_SYSTEM)
458 "-alertnotify=<cmd>",
459 "Execute command when a relevant alert is received or we see "
460 "a really long fork (%s in cmd is replaced by message)",
464 "-assumevalid=<hex>",
466 "If this block is in the chain assume that it and its ancestors "
467 "are valid and potentially skip their script verification (0 to "
468 "verify all, default: %s, testnet: %s)",
469 defaultChainParams->GetConsensus().defaultAssumeValid.GetHex(),
470 testnetChainParams->GetConsensus().defaultAssumeValid.GetHex()),
472 argsman.
AddArg(
"-blocksdir=<dir>",
473 "Specify directory to hold blocks subdirectory for *.dat "
474 "files (default: <datadir>)",
476 argsman.
AddArg(
"-fastprune",
477 "Use smaller block files and lower minimum prune height for "
481 #if defined(HAVE_SYSTEM)
482 argsman.
AddArg(
"-blocknotify=<cmd>",
483 "Execute command when the best block changes (%s in cmd is "
484 "replaced by block hash)",
487 argsman.
AddArg(
"-blockreconstructionextratxn=<n>",
488 strprintf(
"Extra transactions to keep in memory for compact "
489 "block reconstructions (default: %u)",
494 strprintf(
"Whether to reject transactions from network peers. "
495 "Automatic broadcast and rebroadcast of any transactions "
496 "from inbound peers is disabled, unless the peer has the "
497 "'forcerelay' permission. RPC transactions are"
498 " not affected. (default: %u)",
501 argsman.
AddArg(
"-coinstatsindex",
502 strprintf(
"Maintain coinstats index used by the "
503 "gettxoutsetinfo RPC (default: %u)",
508 strprintf(
"Specify path to read-only configuration file. Relative "
509 "paths will be prefixed by datadir location. (default: %s)",
512 argsman.
AddArg(
"-datadir=<dir>",
"Specify data directory",
516 strprintf(
"Maximum database write batch size in bytes (default: %u)",
522 strprintf(
"Set database cache size in MiB (%d to %d, default: %d)",
526 "-includeconf=<file>",
527 "Specify additional configuration file, relative to the -datadir path "
528 "(only useable from configuration file, not command line)",
530 argsman.
AddArg(
"-loadblock=<file>",
531 "Imports blocks from external file on startup",
533 argsman.
AddArg(
"-maxmempool=<n>",
534 strprintf(
"Keep the transaction memory pool below <n> "
535 "megabytes (default: %u)",
538 argsman.
AddArg(
"-maxorphantx=<n>",
539 strprintf(
"Keep at most <n> unconnectable transactions in "
540 "memory (default: %u)",
543 argsman.
AddArg(
"-mempoolexpiry=<n>",
544 strprintf(
"Do not keep transactions in the mempool longer "
545 "than <n> hours (default: %u)",
549 "-minimumchainwork=<hex>",
551 "Minimum work assumed to exist on a valid chain in hex "
552 "(default: %s, testnet: %s)",
553 defaultChainParams->GetConsensus().nMinimumChainWork.GetHex(),
554 testnetChainParams->GetConsensus().nMinimumChainWork.GetHex()),
559 strprintf(
"Set the number of script verification threads (%u to %d, 0 "
560 "= auto, <0 = leave that many cores free, default: %d)",
564 argsman.
AddArg(
"-persistmempool",
565 strprintf(
"Whether to save the mempool on shutdown and load "
566 "on restart (default: %u)",
571 strprintf(
"Specify pid file. Relative paths will be prefixed "
572 "by a net-specific datadir location. (default: %s)",
577 strprintf(
"Reduce storage requirements by enabling pruning (deleting) "
578 "of old blocks. This allows the pruneblockchain RPC to be "
579 "called to delete specific blocks, and enables automatic "
580 "pruning of old blocks if a target size in MiB is provided. "
581 "This mode is incompatible with -txindex, -coinstatsindex "
582 "and -rescan. Warning: Reverting this setting requires "
583 "re-downloading the entire blockchain. (default: 0 = disable "
584 "pruning blocks, 1 = allow manual pruning via RPC, >=%u = "
585 "automatically prune block files to stay under the specified "
586 "target size in MiB)",
590 "-reindex-chainstate",
591 "Rebuild chain state from the currently indexed blocks. When "
592 "in pruning mode or if blocks on disk might be corrupted, use "
593 "full -reindex instead.",
597 "Rebuild chain state and block index from the blk*.dat files on disk",
602 "Specify path to dynamic settings data file. Can be disabled with "
603 "-nosettings. File is written at runtime and not meant to be "
604 "edited by users (use %s instead for custom settings). Relative "
605 "paths will be prefixed by datadir location. (default: %s)",
609 argsman.
AddArg(
"-startupnotify=<cmd>",
"Execute command on startup.",
615 "Create new files with system default permissions, instead of umask "
616 "077 (only effective with disabled wallet functionality)",
619 hidden_args.emplace_back(
"-sysperms");
621 argsman.
AddArg(
"-txindex",
622 strprintf(
"Maintain a full transaction index, used by the "
623 "getrawtransaction rpc call (default: %d)",
629 strprintf(
"Enable the Chronik indexer, which can be read via a "
630 "dedicated HTTP/Protobuf interface (default: %d)",
634 "-chronikbind=<addr>[:port]",
636 "Bind the Chronik indexer to the given address to listen for "
637 "HTTP/Protobuf connections to access the index. Unlike the "
638 "JSON-RPC, it's ok to have this publicly exposed on the internet. "
639 "This option can be specified multiple times (default: %s; default "
640 "port: %u, testnet: %u, regtest: %u)",
641 Join(chronik::DEFAULT_BINDS,
", "),
642 defaultBaseParams->ChronikPort(), testnetBaseParams->ChronikPort(),
643 regtestBaseParams->ChronikPort()),
646 argsman.
AddArg(
"-chronikreindex",
647 "Reindex the Chronik indexer from genesis, but leave the "
648 "other indexes untouched",
652 "-blockfilterindex=<type>",
653 strprintf(
"Maintain an index of compact filters by block "
654 "(default: %s, values: %s).",
656 " If <type> is not supplied or if <type> = 1, indexes for "
657 "all known types are enabled.",
661 "Use Cash Address for destination encoding instead of base58 "
662 "(activate by default on Jan, 14)",
667 "Add a node to connect to and attempt to keep the connection "
668 "open (see the `addnode` RPC command help for more info)",
671 argsman.
AddArg(
"-asmap=<file>",
672 strprintf(
"Specify asn mapping used for bucketing of the "
673 "peers (default: %s). Relative paths will be "
674 "prefixed by the net-specific datadir location.",
677 argsman.
AddArg(
"-bantime=<n>",
678 strprintf(
"Default duration (in seconds) of manually "
679 "configured bans (default: %u)",
683 "-bind=<addr>[:<port>][=onion]",
684 strprintf(
"Bind to given address and always listen on it (default: "
685 "0.0.0.0). Use [host]:port notation for IPv6. Append =onion "
686 "to tag any incoming connections to that address and port as "
687 "incoming Tor connections (default: 127.0.0.1:%u=onion, "
688 "testnet: 127.0.0.1:%u=onion, regtest: 127.0.0.1:%u=onion)",
689 defaultBaseParams->OnionServiceTargetPort(),
690 testnetBaseParams->OnionServiceTargetPort(),
691 regtestBaseParams->OnionServiceTargetPort()),
696 "Connect only to the specified node(s); -connect=0 disables automatic "
697 "connections (the rules for this peer are the same as for -addnode)",
702 "Discover own IP addresses (default: 1 when listening and no "
703 "-externalip or -proxy)",
706 strprintf(
"Allow DNS lookups for -addnode, -seednode and "
707 "-connect (default: %d)",
713 "Query for peer addresses via DNS lookup, if low on addresses "
714 "(default: %u unless -connect used)",
717 argsman.
AddArg(
"-externalip=<ip>",
"Specify your own public address",
722 "Allow fixed seeds if DNS seeds don't provide peers (default: %u)",
728 "Always query for peer addresses via DNS lookup (default: %d)",
731 argsman.
AddArg(
"-overridednsseed",
732 "If set, only use the specified DNS seed when "
733 "querying for peer addresses via DNS lookup.",
737 "Accept connections from outside (default: 1 if no -proxy or -connect)",
741 strprintf(
"Automatically create Tor onion service (default: %d)",
745 "-maxconnections=<n>",
746 strprintf(
"Maintain at most <n> connections to peers. The effective "
747 "limit depends on system limitations and might be lower than "
748 "the specified value (default: %u)",
751 argsman.
AddArg(
"-maxreceivebuffer=<n>",
752 strprintf(
"Maximum per-connection receive buffer, <n>*1000 "
753 "bytes (default: %u)",
757 "-maxsendbuffer=<n>",
759 "Maximum per-connection send buffer, <n>*1000 bytes (default: %u)",
763 "-maxtimeadjustment",
764 strprintf(
"Maximum allowed median peer time offset adjustment. Local "
765 "perspective of time may be influenced by peers forward or "
766 "backward by this amount. (default: %u seconds)",
769 argsman.
AddArg(
"-onion=<ip:port>",
770 strprintf(
"Use separate SOCKS5 proxy to reach peers via Tor "
771 "onion services (default: %s)",
774 argsman.
AddArg(
"-i2psam=<ip:port>",
775 "I2P SAM proxy to reach I2P peers and accept I2P "
776 "connections (default: none)",
779 "-i2pacceptincoming",
780 "If set and -i2psam is also set then incoming I2P connections are "
781 "accepted via the SAM proxy. If this is not set but -i2psam is set "
782 "then only outgoing connections will be made to the I2P network. "
783 "Ignored if -i2psam is not set. Listening for incoming I2P connections "
784 "is done through the SAM proxy, not by binding to a local address and "
790 "Make outgoing connections only through network <net> (" +
792 "). Incoming connections are not affected by this option. This "
793 "option can be specified multiple times to allow multiple "
794 "networks. Warning: if it is used with non-onion networks "
795 "and the -onion or -proxy option is set, then outbound onion "
796 "connections will still be made; use -noonion or -onion=0 to "
797 "disable outbound onion connections in this case",
799 argsman.
AddArg(
"-peerbloomfilters",
800 strprintf(
"Support filtering of blocks and transaction with "
801 "bloom filters (default: %d)",
807 "Serve compact block filters to peers per BIP 157 (default: %u)",
810 argsman.
AddArg(
"-permitbaremultisig",
811 strprintf(
"Relay non-P2SH multisig (default: %d)",
817 argsman.
AddArg(
"-port=<port>",
818 strprintf(
"Listen for connections on <port>. Nodes not "
819 "using the default ports (default: %u, "
820 "testnet: %u, regtest: %u) are unlikely to get "
821 "incoming connections. Not relevant for I2P (see "
823 defaultChainParams->GetDefaultPort(),
824 testnetChainParams->GetDefaultPort(),
825 regtestChainParams->GetDefaultPort()),
828 argsman.
AddArg(
"-proxy=<ip:port>",
"Connect through SOCKS5 proxy",
832 strprintf(
"Randomize credentials for every proxy connection. "
833 "This enables Tor stream isolation (default: %d)",
838 "Connect to a node to retrieve peer addresses, and disconnect",
842 "Enable all P2P network activity (default: 1). Can be changed "
843 "by the setnetworkactive RPC command",
845 argsman.
AddArg(
"-timeout=<n>",
846 strprintf(
"Specify connection timeout in milliseconds "
847 "(minimum: 1, default: %d)",
852 strprintf(
"Specify p2p connection timeout in seconds. This option "
853 "determines the amount of time a peer may be inactive before "
854 "the connection to it is dropped. (minimum: 1, default: %d)",
858 "-torcontrol=<ip>:<port>",
860 "Tor control port to use if onion listening enabled (default: %s)",
863 argsman.
AddArg(
"-torpassword=<pass>",
864 "Tor control port password (default: empty)",
870 "Use UPnP to map the listening port (default: 1 when "
871 "listening and no -proxy)",
876 strprintf(
"Use UPnP to map the listening port (default: %u)", 0),
880 hidden_args.emplace_back(
"-upnp");
885 strprintf(
"Use NAT-PMP to map the listening port (default: %s)",
889 hidden_args.emplace_back(
"-natpmp");
892 "-whitebind=<[permissions@]addr>",
893 "Bind to the given address and add permission flags to the peers "
895 "Use [host]:port notation for IPv6. Allowed permissions: " +
898 "Specify multiple permissions separated by commas (default: "
899 "download,noban,mempool,relay). Can be specified multiple times.",
902 argsman.
AddArg(
"-whitelist=<[permissions@]IP address or network>",
903 "Add permission flags to the peers connecting from the "
904 "given IP address (e.g. 1.2.3.4) or CIDR-notated network "
905 "(e.g. 1.2.3.0/24). "
906 "Uses the same permissions as -whitebind. Can be specified "
910 "-maxuploadtarget=<n>",
911 strprintf(
"Tries to keep outbound traffic under the given target (in "
912 "MiB per 24h). Limit does not apply to peers with 'download' "
913 "permission. 0 = no limit (default: %d)",
920 argsman.
AddArg(
"-zmqpubhashblock=<address>",
921 "Enable publish hash block in <address>",
923 argsman.
AddArg(
"-zmqpubhashtx=<address>",
924 "Enable publish hash transaction in <address>",
926 argsman.
AddArg(
"-zmqpubrawblock=<address>",
927 "Enable publish raw block in <address>",
929 argsman.
AddArg(
"-zmqpubrawtx=<address>",
930 "Enable publish raw transaction in <address>",
932 argsman.
AddArg(
"-zmqpubsequence=<address>",
933 "Enable publish hash block and tx sequence in <address>",
936 "-zmqpubhashblockhwm=<n>",
937 strprintf(
"Set publish hash block outbound message high water "
938 "mark (default: %d)",
942 "-zmqpubhashtxhwm=<n>",
943 strprintf(
"Set publish hash transaction outbound message high "
944 "water mark (default: %d)",
948 "-zmqpubrawblockhwm=<n>",
949 strprintf(
"Set publish raw block outbound message high water "
950 "mark (default: %d)",
954 "-zmqpubrawtxhwm=<n>",
955 strprintf(
"Set publish raw transaction outbound message high "
956 "water mark (default: %d)",
959 argsman.
AddArg(
"-zmqpubsequencehwm=<n>",
960 strprintf(
"Set publish hash sequence message high water mark"
965 hidden_args.emplace_back(
"-zmqpubhashblock=<address>");
966 hidden_args.emplace_back(
"-zmqpubhashtx=<address>");
967 hidden_args.emplace_back(
"-zmqpubrawblock=<address>");
968 hidden_args.emplace_back(
"-zmqpubrawtx=<address>");
969 hidden_args.emplace_back(
"-zmqpubsequence=<n>");
970 hidden_args.emplace_back(
"-zmqpubhashblockhwm=<n>");
971 hidden_args.emplace_back(
"-zmqpubhashtxhwm=<n>");
972 hidden_args.emplace_back(
"-zmqpubrawblockhwm=<n>");
973 hidden_args.emplace_back(
"-zmqpubrawtxhwm=<n>");
974 hidden_args.emplace_back(
"-zmqpubsequencehwm=<n>");
979 strprintf(
"How many blocks to check at startup (default: %u, 0 = all)",
983 argsman.
AddArg(
"-checklevel=<n>",
984 strprintf(
"How thorough the block verification of "
985 "-checkblocks is: %s (0-4, default: %u)",
989 argsman.
AddArg(
"-checkblockindex",
990 strprintf(
"Do a consistency check for the block tree, "
991 "chainstate, and other validation data structures "
992 "occasionally. (default: %u, regtest: %u)",
993 defaultChainParams->DefaultConsistencyChecks(),
994 regtestChainParams->DefaultConsistencyChecks()),
997 argsman.
AddArg(
"-checkaddrman=<n>",
998 strprintf(
"Run addrman consistency checks every <n> "
999 "operations. Use 0 to disable. (default: %u)",
1004 "-checkmempool=<n>",
1005 strprintf(
"Run mempool consistency checks every <n> transactions. Use "
1006 "0 to disable. (default: %u, regtest: %u)",
1007 defaultChainParams->DefaultConsistencyChecks(),
1008 regtestChainParams->DefaultConsistencyChecks()),
1011 argsman.
AddArg(
"-checkpoints",
1012 strprintf(
"Only accept block chain matching built-in "
1013 "checkpoints (default: %d)",
1017 argsman.
AddArg(
"-deprecatedrpc=<method>",
1018 "Allows deprecated RPC method(s) to be used",
1022 "-stopafterblockimport",
1023 strprintf(
"Stop running after importing blocks from disk (default: %d)",
1027 argsman.
AddArg(
"-stopatheight",
1028 strprintf(
"Stop running after reaching the given height in "
1029 "the main chain (default: %u)",
1035 "-limitancestorcount=<n>",
1036 strprintf(
"DEPRECATED: Do not accept transactions if number of "
1037 "in-mempool ancestors is <n> or more (default: %u). This is "
1038 "no longer evaluated after the May 15th 2023 eCash network "
1044 "-limitancestorsize=<n>",
1045 strprintf(
"DEPRECATED: Do not accept transactions whose size with all "
1046 "in-mempool ancestors exceeds <n> kilobytes (default: %u). "
1047 "This is no longer evaluated after the May 15th 2023 eCash "
1053 "-limitdescendantcount=<n>",
1054 strprintf(
"DEPRECATED: Do not accept transactions if any ancestor "
1055 "would have <n> or more in-mempool descendants (default: %u)"
1056 ". This is no longer evaluated after the May 15th 2023 eCash "
1062 "-limitdescendantsize=<n>",
1063 strprintf(
"DEPRECATED: Do not accept transactions if any ancestor "
1064 "would have more than <n> kilobytes of in-mempool "
1065 "descendants (default: %u). This is no longer evaluated "
1066 "after the May 15th 2023 eCash network upgrade.",
1070 argsman.
AddArg(
"-addrmantest",
"Allows to test address relay on localhost",
1073 argsman.
AddArg(
"-capturemessages",
"Capture all P2P messages to disk",
1076 argsman.
AddArg(
"-mocktime=<n>",
1082 "-maxsigcachesize=<n>",
1083 strprintf(
"Limit size of signature cache to <n> MiB (default: %u)",
1088 "-maxscriptcachesize=<n>",
1089 strprintf(
"Limit size of script cache to <n> MiB (default: %u)",
1093 argsman.
AddArg(
"-maxtipage=<n>",
1094 strprintf(
"Maximum tip age in seconds to consider node in "
1095 "initial block download (default: %u)",
1100 argsman.
AddArg(
"-uacomment=<cmt>",
1101 "Append comment to the user agent string",
1103 argsman.
AddArg(
"-uaclientname=<clientname>",
"Set user agent client name",
1105 argsman.
AddArg(
"-uaclientversion=<clientversion>",
1114 "Relay and mine \"non-standard\" transactions (%sdefault: %u)",
1115 "testnet/regtest only; ", defaultChainParams->RequireStandard()),
1118 argsman.
AddArg(
"-excessiveblocksize=<n>",
1119 strprintf(
"Do not accept blocks larger than this limit, in "
1120 "bytes (default: %d)",
1126 "-dustrelayfee=<amt>",
1127 strprintf(
"Fee rate (in %s/kB) used to define dust, the value of an "
1128 "output such that it will cost about 1/3 of its value in "
1129 "fees at this fee rate to spend it. (default: %s)",
1135 "-bytespersigcheck",
1136 strprintf(
"Equivalent bytes per sigCheck in transactions for relay and "
1137 "mining (default: %u).",
1142 strprintf(
"DEPRECATED: Equivalent bytes per sigCheck in transactions "
1143 "for relay and mining (default: %u). This has been "
1144 "deprecated since v0.26.8 and will be removed in the future, "
1145 "please use -bytespersigcheck instead.",
1150 strprintf(
"Relay and mine data carrier transactions (default: %d)",
1155 strprintf(
"Maximum size of data in data carrier transactions "
1156 "we relay and mine (default: %u)",
1160 "-minrelaytxfee=<amt>",
1161 strprintf(
"Fees (in %s/kB) smaller than this are rejected for "
1162 "relaying, mining and transaction creation (default: %s)",
1167 strprintf(
"Add 'relay' permission to whitelisted inbound peers "
1168 "with default permissions. This will accept relayed "
1169 "transactions even when not relaying transactions "
1174 "-whitelistforcerelay",
1175 strprintf(
"Add 'forcerelay' permission to whitelisted inbound peers"
1176 " with default permissions. This will relay transactions "
1177 "even if the transactions were already in the mempool "
1184 argsman.
AddArg(
"-excessutxocharge=<amt>",
1185 strprintf(
"Fees (in %s/kB) to charge per utxo created for "
1186 "relaying, and mining (default: %s)",
1191 argsman.
AddArg(
"-blockmaxsize=<n>",
1192 strprintf(
"Set maximum block size in bytes (default: %d)",
1196 "-blockmintxfee=<amt>",
1197 strprintf(
"Set lowest fee rate (in %s/kB) for transactions to "
1198 "be included in block creation. (default: %s)",
1202 argsman.
AddArg(
"-blockversion=<n>",
1203 "Override block version to test forking scenarios",
1207 argsman.
AddArg(
"-server",
"Accept command line and JSON-RPC commands",
1210 strprintf(
"Accept public REST requests (default: %d)",
1214 "-rpcbind=<addr>[:port]",
1215 "Bind to given address to listen for JSON-RPC connections. Do not "
1216 "expose the RPC server to untrusted networks such as the public "
1217 "internet! This option is ignored unless -rpcallowip is also passed. "
1218 "Port is optional and overrides -rpcport. Use [host]:port notation "
1219 "for IPv6. This option can be specified multiple times (default: "
1220 "127.0.0.1 and ::1 i.e., localhost)",
1225 "-rpccookiefile=<loc>",
1226 "Location of the auth cookie. Relative paths will be prefixed "
1227 "by a net-specific datadir location. (default: data dir)",
1229 argsman.
AddArg(
"-rpcuser=<user>",
"Username for JSON-RPC connections",
1232 argsman.
AddArg(
"-rpcpassword=<pw>",
"Password for JSON-RPC connections",
1236 "-rpcwhitelist=<whitelist>",
1237 "Set a whitelist to filter incoming RPC calls for a specific user. The "
1238 "field <whitelist> comes in the format: <USERNAME>:<rpc 1>,<rpc "
1239 "2>,...,<rpc n>. If multiple whitelists are set for a given user, they "
1240 "are set-intersected. See -rpcwhitelistdefault documentation for "
1241 "information on default whitelist behavior.",
1244 "-rpcwhitelistdefault",
1245 "Sets default behavior for rpc whitelisting. Unless "
1246 "rpcwhitelistdefault is set to 0, if any -rpcwhitelist is set, the rpc "
1247 "server acts as if all rpc users are subject to "
1248 "empty-unless-otherwise-specified whitelists. If rpcwhitelistdefault "
1249 "is set to 1 and no -rpcwhitelist is set, rpc server acts as if all "
1250 "rpc users are subject to empty whitelists.",
1253 "-rpcauth=<userpw>",
1254 "Username and HMAC-SHA-256 hashed password for JSON-RPC connections. "
1255 "The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A "
1256 "canonical python script is included in share/rpcauth. The client then "
1257 "connects normally using the rpcuser=<USERNAME>/rpcpassword=<PASSWORD> "
1258 "pair of arguments. This option can be specified multiple times",
1260 argsman.
AddArg(
"-rpcport=<port>",
1261 strprintf(
"Listen for JSON-RPC connections on <port> "
1262 "(default: %u, testnet: %u, regtest: %u)",
1263 defaultBaseParams->RPCPort(),
1264 testnetBaseParams->RPCPort(),
1265 regtestBaseParams->RPCPort()),
1270 "Allow JSON-RPC connections from specified source. Valid for "
1271 "<ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. "
1272 "1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). "
1273 "This option can be specified multiple times",
1278 "Set the number of threads to service RPC calls (default: %d)",
1282 "-rpccorsdomain=value",
1283 "Domain from which to accept cross origin requests (browser enforced)",
1286 argsman.
AddArg(
"-rpcworkqueue=<n>",
1287 strprintf(
"Set the depth of the work queue to service RPC "
1288 "calls (default: %d)",
1292 argsman.
AddArg(
"-rpcservertimeout=<n>",
1293 strprintf(
"Timeout during HTTP requests (default: %d)",
1299 argsman.
AddArg(
"-daemon",
1300 strprintf(
"Run in the background as a daemon and accept "
1301 "commands (default: %d)",
1304 argsman.
AddArg(
"-daemonwait",
1305 strprintf(
"Wait for initialization to be finished before "
1306 "exiting. This implies -daemon (default: %d)",
1310 hidden_args.emplace_back(
"-daemon");
1311 hidden_args.emplace_back(
"-daemonwait");
1315 argsman.
AddArg(
"-avalanche",
1316 strprintf(
"Enable the avalanche feature (default: %u)",
1319 argsman.
AddArg(
"-avalancheconflictingproofcooldown",
1320 strprintf(
"Mandatory cooldown before a proof conflicting "
1321 "with an already registered one can be considered "
1322 "in seconds (default: %u)",
1325 argsman.
AddArg(
"-avalanchepeerreplacementcooldown",
1326 strprintf(
"Mandatory cooldown before a peer can be replaced "
1327 "in seconds (default: %u)",
1331 "-avaminquorumstake",
1333 "Minimum amount of known stake for a usable quorum (default: %s)",
1337 "-avaminquorumconnectedstakeratio",
1338 strprintf(
"Minimum proportion of known stake we"
1339 " need nodes for to have a usable quorum (default: %s)",
1343 "-avaminavaproofsnodecount",
1344 strprintf(
"Minimum number of node that needs to send us an avaproofs"
1345 " message before we consider we have a usable quorum"
1350 "-avastalevotethreshold",
1351 strprintf(
"Number of avalanche votes before a voted item goes stale "
1352 "when voting confidence is low (default: %u)",
1356 "-avastalevotefactor",
1358 "Factor affecting the number of avalanche votes before a voted "
1359 "item goes stale when voting confidence is high (default: %u)",
1362 argsman.
AddArg(
"-avacooldown",
1363 strprintf(
"Mandatory cooldown between two avapoll in "
1364 "milliseconds (default: %u)",
1369 strprintf(
"Avalanche query timeout in milliseconds (default: %u)",
1374 "Avalanche proof delegation to the master key used by this node "
1375 "(default: none). Should be used in conjunction with -avaproof and "
1378 argsman.
AddArg(
"-avaproof",
1379 "Avalanche proof to be used by this node (default: none)",
1382 "-avaproofstakeutxoconfirmations",
1384 "Minimum number of confirmations before a stake utxo is mature"
1385 " enough to be included into a proof. Utxos in the mempool are not "
1386 "accepted (i.e this value must be greater than 0) (default: %s)",
1389 argsman.
AddArg(
"-avaproofstakeutxodustthreshold",
1390 strprintf(
"Minimum value each stake utxo must have to be "
1391 "considered valid (default: %s)",
1394 argsman.
AddArg(
"-avamasterkey",
1395 "Master key associated with the proof. If a proof is "
1396 "required, this is mandatory.",
1399 argsman.
AddArg(
"-avasessionkey",
"Avalanche session key (default: random)",
1403 "-maxavalancheoutbound",
1405 "Set the maximum number of avalanche outbound peers to connect to. "
1406 "Note that the -maxconnections option takes precedence (default: "
1411 hidden_args.emplace_back(
"-avalanchepreconsensus");
1418 const std::string URL_SOURCE_CODE =
1419 "<https://github.com/Bitcoin-ABC/bitcoin-abc>";
1420 const std::string URL_WEBSITE =
"<https://www.bitcoinabc.org>";
1426 strprintf(
_(
"Please contribute if you find %s useful. "
1427 "Visit %s for further information about the software.")
1429 PACKAGE_NAME, URL_WEBSITE) +
1431 strprintf(
_(
"The source code is available from %s.").translated,
1433 "\n" +
"\n" +
_(
"This is experimental software.").
translated +
"\n" +
1434 strprintf(
_(
"Distributed under the MIT software license, see the "
1435 "accompanying file %s or %s")
1437 "COPYING",
"<https://opensource.org/licenses/MIT>") +
1439 strprintf(
_(
"This product includes software developed by the "
1440 "OpenSSL Project for use in the OpenSSL Toolkit %s and "
1441 "cryptographic software written by Eric Young and UPnP "
1442 "software written by Thomas Bernard.")
1444 "<https://www.openssl.org>") +
1453 if (pBlockIndex !=
nullptr) {
1463 static void StartupNotify(
const ArgsManager &args) {
1464 std::string cmd = args.
GetArg(
"-startupnotify",
"");
1466 std::thread t(runCommand, cmd);
1504 "%s: parameter interaction: -bind set -> setting -listen=1\n",
1510 LogPrintf(
"%s: parameter interaction: -whitebind set -> setting "
1520 LogPrintf(
"%s: parameter interaction: -connect set -> setting "
1525 LogPrintf(
"%s: parameter interaction: -connect set -> setting "
1536 "%s: parameter interaction: -proxy set -> setting -listen=0\n",
1544 "%s: parameter interaction: -proxy set -> setting -upnp=0\n",
1549 "%s: parameter interaction: -proxy set -> setting -natpmp=0\n",
1554 LogPrintf(
"%s: parameter interaction: -proxy set -> setting "
1565 "%s: parameter interaction: -listen=0 -> setting -upnp=0\n",
1570 "%s: parameter interaction: -listen=0 -> setting -natpmp=0\n",
1575 "%s: parameter interaction: -listen=0 -> setting -discover=0\n",
1579 LogPrintf(
"%s: parameter interaction: -listen=0 -> setting "
1584 LogPrintf(
"%s: parameter interaction: -listen=0 -> setting "
1585 "-i2pacceptincoming=0\n",
1590 if (args.
IsArgSet(
"-externalip")) {
1593 LogPrintf(
"%s: parameter interaction: -externalip set -> setting "
1602 LogPrintf(
"%s: parameter interaction: -blocksonly=1 -> setting "
1603 "-whitelistrelay=0\n",
1612 LogPrintf(
"%s: parameter interaction: -whitelistforcerelay=1 -> "
1613 "setting -whitelistrelay=1\n",
1620 const bool fAvalanche =
1639 int nMaxConnections;
1640 int nUserMaxConnections;
1643 int64_t peer_connect_timeout;
1644 std::set<BlockFilterType> g_enabled_filter_types;
1652 std::set_new_handler(std::terminate);
1653 LogPrintf(
"Error: Out of memory. Terminating.\n");
1663 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
1664 _CrtSetReportFile(_CRT_WARN, CreateFileA(
"NUL", GENERIC_WRITE, 0,
nullptr,
1665 OPEN_EXISTING, 0, 0));
1667 _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
1671 SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
1675 Untranslated(
"Initializing wait-for-shutdown state failed."));
1696 signal(SIGPIPE, SIG_IGN);
1698 SetConsoleCtrlHandler(consoleCtrlHandler,
true);
1718 errors +=
strprintf(
_(
"Config setting for %s only applied on %s "
1719 "network when in [%s] section.") +
1721 arg, network, network);
1724 if (!errors.
empty()) {
1732 _(
"Section [%s] is not recognized.") +
1734 section.m_file, section.m_line, section.m_name);
1737 if (!warnings.
empty()) {
1743 strprintf(
_(
"Specified blocks directory \"%s\" does not exist."),
1744 args.
GetArg(
"-blocksdir",
"")));
1748 std::string blockfilterindex_value =
1750 if (blockfilterindex_value ==
"" || blockfilterindex_value ==
"1") {
1752 }
else if (blockfilterindex_value !=
"0") {
1753 const std::vector<std::string> names =
1754 args.
GetArgs(
"-blockfilterindex");
1755 for (
const auto &
name : names) {
1761 g_enabled_filter_types.insert(filter_type);
1770 _(
"Cannot set -peerblockfilters without -blockfilterindex."));
1779 return InitError(
_(
"Prune mode is incompatible with -txindex."));
1783 _(
"Prune mode is incompatible with -coinstatsindex."));
1786 return InitError(
_(
"Prune mode is incompatible with -chronik."));
1792 args.
GetArgs(
"-bind").size() + args.
GetArgs(
"-whitebind").size();
1795 "Cannot set -bind or -whitebind together with -listen=0"));
1799 int nBind = std::max(nUserBind,
size_t(1));
1800 nUserMaxConnections =
1802 nMaxConnections = std::max(nUserMaxConnections, 0);
1813 int fd_max = FD_SETSIZE;
1815 nMaxConnections = std::max(
1816 std::min<int>(nMaxConnections,
1821 return InitError(
_(
"Not enough file descriptors available."));
1827 if (nMaxConnections < nUserMaxConnections) {
1831 LogPrintf(
"Reducing -maxconnections from %d to %d, because of system "
1833 nUserMaxConnections, nMaxConnections);
1844 LogPrintf(
"Checkpoints will be verified.\n");
1846 LogPrintf(
"Skipping checkpoint verification.\n");
1850 args.
GetArg(
"-assumevalid",
1853 LogPrintf(
"Assuming ancestors of block %s have valid signatures.\n",
1856 LogPrintf(
"Validating signatures for all blocks.\n");
1859 if (args.
IsArgSet(
"-minimumchainwork")) {
1860 const std::string minChainWorkStr =
1861 args.
GetArg(
"-minimumchainwork",
"");
1865 "Invalid non-hex (%s) minimum chain work value specified"),
1876 LogPrintf(
"Warning: nMinimumChainWork set below default value of %s\n",
1881 int64_t nMempoolSizeMax =
1883 int64_t nMempoolSizeMin =
1886 if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin) {
1888 std::ceil(nMempoolSizeMin / 1000000.0)));
1892 const int64_t nProposedExcessiveBlockSize =
1894 if (nProposedExcessiveBlockSize <= 0 ||
1897 _(
"Excessive block size must be > 1,000,000 bytes (1MB)"));
1901 const int64_t nProposedMaxGeneratedBlockSize =
1903 if (nProposedMaxGeneratedBlockSize <= 0) {
1904 return InitError(
_(
"Max generated block size must be greater than 0"));
1906 if (uint64_t(nProposedMaxGeneratedBlockSize) > config.
GetMaxBlockSize()) {
1907 return InitError(
_(
"Max generated block size (blockmaxsize) cannot "
1908 "exceed the excessive block size "
1909 "(excessiveblocksize)"));
1914 int64_t nPruneArg = args.
GetIntArg(
"-prune", 0);
1915 if (nPruneArg < 0) {
1917 _(
"Prune cannot be configured with a negative value."));
1920 if (nPruneArg == 1) {
1922 LogPrintf(
"Block pruning enabled. Use RPC call "
1923 "pruneblockchain(height) to manually prune block and undo "
1930 strprintf(
_(
"Prune configured below the minimum of %d MiB. "
1931 "Please use a higher number."),
1934 LogPrintf(
"Prune configured to target %u MiB on disk for block and "
1945 peer_connect_timeout =
1947 if (peer_connect_timeout <= 0) {
1949 "peertimeout cannot be configured with a negative value."));
1953 if (args.
IsArgSet(
"-excessutxocharge")) {
1958 "excessutxocharge", args.
GetArg(
"-excessutxocharge",
"")));
1965 if (args.
IsArgSet(
"-minrelaytxfee")) {
1970 args.
GetArg(
"-minrelaytxfee",
"")));
1979 if (args.
IsArgSet(
"-blockmintxfee")) {
1983 args.
GetArg(
"-blockmintxfee",
"")));
1989 if (args.
IsArgSet(
"-dustrelayfee")) {
2004 "acceptnonstdtxn is not currently supported for %s chain"),
2030 if (args.
IsArgSet(
"-proxy") && args.
GetArg(
"-proxy",
"").empty()) {
2032 "No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>."));
2036 const int64_t stakeUtxoMinConfirmations =
2037 args.
GetIntArg(
"-avaproofstakeutxoconfirmations",
2041 stakeUtxoMinConfirmations !=
2043 return InitError(
_(
"Avalanche stake UTXO minimum confirmations can "
2044 "only be set on test chains."));
2047 if (stakeUtxoMinConfirmations <= 0) {
2048 return InitError(
_(
"Avalanche stake UTXO minimum confirmations must be "
2049 "a positive integer."));
2052 if (args.
IsArgSet(
"-avaproofstakeutxodustthreshold")) {
2055 args.
GetArg(
"-avaproofstakeutxodustthreshold",
""), amount);
2058 "avaproofstakeutxodustthreshold",
2059 args.
GetArg(
"-avaproofstakeutxodustthreshold",
"")));
2064 return InitError(
_(
"Avalanche stake UTXO dust threshold can "
2065 "only be set on test chains."));
2077 _(
"Cannot write to data directory '%s'; check permissions."),
2082 "%s. %s is probably already running."),
2096 _(
"Initialization sanity check failed. %s is shutting down."),
2145 LogPrintf(
"Using at most %i automatic connections (%i file descriptors "
2147 nMaxConnections, nFD);
2152 LogPrintf(
"Warning: relative datadir option '%s' specified, which will "
2153 "be interpreted relative to the current working directory "
2154 "'%s'. This is fragile, because if bitcoin is started in the "
2155 "future from a different location, it will be unable to "
2156 "locate the current data files. There could also be data "
2157 "loss if bitcoin is started while in a temporary "
2159 args.
GetArg(
"-datadir",
""),
2167 if (script_threads <= 0) {
2175 script_threads = std::max(script_threads - 1, 0);
2180 LogPrintf(
"Script verification uses %d additional threads\n",
2182 if (script_threads >= 1) {
2187 node.scheduler = std::make_unique<CScheduler>();
2190 node.scheduler->m_service_thread =
2192 [&] {
node.scheduler->serviceQueue(); });
2195 node.scheduler->scheduleEvery(
2200 std::chrono::minutes{1});
2209 for (
const auto &client :
node.chain_clients) {
2210 client->registerRpcs();
2226 _(
"Unable to start HTTP server. See debug log for details."));
2231 for (
const auto &client :
node.chain_clients) {
2232 if (!client->verify()) {
2252 std::vector<bool> asmap;
2255 if (asmap_path.empty()) {
2258 if (!asmap_path.is_absolute()) {
2267 if (asmap.size() == 0) {
2273 LogPrintf(
"Using asmap version %s for IP bucketing\n",
2276 LogPrintf(
"Using /16 prefix for IP bucketing\n");
2279 uiInterface.InitMessage(
_(
"Loading P2P addresses...").translated);
2280 if (
const auto error{
2287 node.banman = std::make_unique<BanMan>(
2291 node.connman = std::make_unique<CConnman>(
2292 config,
GetRand(std::numeric_limits<uint64_t>::max()),
2293 GetRand(std::numeric_limits<uint64_t>::max()), *
node.addrman,
2297 std::vector<std::string> uacomments;
2298 for (
const std::string &cmt : args.
GetArgs(
"-uacomment")) {
2301 _(
"User Agent comment (%s) contains unsafe characters."), cmt));
2303 uacomments.push_back(cmt);
2306 const std::string client_version =
2310 _(
"-uaclientname (%s) contains invalid characters."), client_name));
2312 if (client_version !=
2315 strprintf(
_(
"-uaclientversion (%s) contains invalid characters."),
2318 const std::string strSubVersion =
2322 _(
"Total length of network version string (%i) exceeds maximum "
2323 "length (%i). Reduce the number or size of uacomments."),
2328 std::set<enum Network> nets;
2329 for (
const std::string &snet : args.
GetArgs(
"-onlynet")) {
2333 _(
"Unknown network specified in -onlynet: '%s'"), snet));
2337 for (
int n = 0; n <
NET_MAX; n++) {
2339 if (!nets.count(net)) {
2349 bool proxyRandomize =
2354 std::string proxyArg = args.
GetArg(
"-proxy",
"");
2356 if (proxyArg !=
"" && proxyArg !=
"0") {
2360 _(
"Invalid -proxy address or hostname: '%s'"), proxyArg));
2366 _(
"Invalid -proxy address or hostname: '%s'"), proxyArg));
2382 std::string onionArg = args.
GetArg(
"-onion",
"");
2383 if (onionArg !=
"") {
2384 if (onionArg ==
"0") {
2391 _(
"Invalid -onion address or hostname: '%s'"), onionArg));
2396 _(
"Invalid -onion address or hostname: '%s'"), onionArg));
2403 for (
const std::string &strAddr : args.
GetArgs(
"-externalip")) {
2424 bool fReindexChainState = args.
GetBoolArg(
"-reindex-chainstate",
false);
2430 int64_t nMempoolSizeMax =
2433 LogPrintf(
"* Using %.1f MiB for block index database\n",
2436 LogPrintf(
"* Using %.1f MiB for transaction index database\n",
2437 cache_sizes.
tx_index * (1.0 / 1024 / 1024));
2440 LogPrintf(
"* Using %.1f MiB for %s block filter index database\n",
2444 LogPrintf(
"* Using %.1f MiB for chain state database\n",
2445 cache_sizes.
coins_db * (1.0 / 1024 / 1024));
2446 LogPrintf(
"* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of "
2447 "unused mempool space)\n",
2448 cache_sizes.
coins * (1.0 / 1024 / 1024),
2449 nMempoolSizeMax * (1.0 / 1024 / 1024));
2453 const int mempool_check_ratio = std::clamp<int>(
2459 node.mempool = std::make_unique<CTxMemPool>(mempool_check_ratio);
2461 node.chainman = std::make_unique<ChainstateManager>();
2467 uiInterface.InitMessage(
_(
"Loading block index...").translated);
2469 const int64_t load_block_index_start_time =
GetTimeMillis();
2470 std::optional<ChainstateLoadingError> rv;
2478 uiInterface.ThreadSafeMessageBox(
2479 _(
"Error reading from database, shutting down."),
"",
2480 CClientUIInterface::MSG_ERROR);
2482 }
catch (
const std::exception &e) {
2484 rv = ChainstateLoadingError::ERROR_GENERIC_BLOCKDB_OPEN_FAILED;
2487 if (rv.has_value()) {
2488 switch (rv.value()) {
2489 case ChainstateLoadingError::ERROR_UPGRADING_BLOCK_DB:
2490 strLoadError =
_(
"Error upgrading block index database");
2492 case ChainstateLoadingError::ERROR_LOADING_BLOCK_DB:
2493 strLoadError =
_(
"Error loading block database");
2495 case ChainstateLoadingError::ERROR_BAD_GENESIS_BLOCK:
2499 return InitError(
_(
"Incorrect or no genesis block found. "
2500 "Wrong datadir for network?"));
2501 case ChainstateLoadingError::ERROR_PRUNED_NEEDS_REINDEX:
2503 _(
"You need to rebuild the database using -reindex to "
2504 "go back to unpruned mode. This will redownload the "
2505 "entire blockchain");
2507 case ChainstateLoadingError::ERROR_LOAD_GENESIS_BLOCK_FAILED:
2508 strLoadError =
_(
"Error initializing block database");
2510 case ChainstateLoadingError::ERROR_CHAINSTATE_UPGRADE_FAILED:
2511 strLoadError =
_(
"Error upgrading chainstate database");
2513 case ChainstateLoadingError::ERROR_REPLAYBLOCKS_FAILED:
2515 _(
"Unable to replay blocks. You will need to rebuild "
2516 "the database using -reindex-chainstate.");
2518 case ChainstateLoadingError::ERROR_LOADCHAINTIP_FAILED:
2519 strLoadError =
_(
"Error initializing block database");
2521 case ChainstateLoadingError::ERROR_GENERIC_BLOCKDB_OPEN_FAILED:
2522 strLoadError =
_(
"Error opening block database");
2524 case ChainstateLoadingError::SHUTDOWN_PROBED:
2528 std::optional<ChainstateLoadVerifyError> rv2;
2530 uiInterface.InitMessage(
_(
"Verifying blocks…").translated);
2536 LogPrintf(
"Prune: pruned datadir may not have more than %d "
2537 "blocks; only checking available blocks\n",
2542 chainman, fReset, fReindexChainState, config, check_blocks,
2544 static_cast<int64_t (*)()
>(
GetTime));
2545 }
catch (
const std::exception &e) {
2547 rv2 = ChainstateLoadVerifyError::ERROR_GENERIC_FAILURE;
2550 if (rv2.has_value()) {
2551 switch (rv2.value()) {
2552 case ChainstateLoadVerifyError::ERROR_BLOCK_FROM_FUTURE:
2554 "The block database contains a block which appears "
2555 "to be from the future. "
2556 "This may be due to your computer's date and time "
2557 "being set incorrectly. "
2558 "Only rebuild the block database if you are sure "
2559 "that your computer's date and time are correct");
2561 case ChainstateLoadVerifyError::ERROR_CORRUPTED_BLOCK_DB:
2562 strLoadError =
_(
"Corrupted block database detected");
2564 case ChainstateLoadVerifyError::ERROR_GENERIC_FAILURE:
2565 strLoadError =
_(
"Error opening block database");
2580 _(
"Do you want to rebuild the block database now?"),
2582 ".\nPlease restart with -reindex or "
2583 "-reindex-chainstate to recover.",
2591 LogPrintf(
"Aborted block database rebuild. Exiting.\n");
2605 LogPrintf(
"Shutdown requested. Exiting.\n");
2613 chainparams, *
node.connman, *
node.addrman,
node.banman.get(), chainman,
2624 args, *
node.chain,
node.connman.get(), chainman,
node.mempool.get(),
2625 *
node.scheduler, avalancheError);
2648 for (
const auto &filter_type : g_enabled_filter_types) {
2662 const bool fReindexChronik =
2664 if (!chronik::Start(config,
node, fReindexChronik)) {
2671 for (
const auto &client :
node.chain_clients) {
2672 if (!client->load()) {
2682 LogPrintf(
"Unsetting NODE_NETWORK on prune mode\n");
2687 uiInterface.InitMessage(
_(
"Pruning blockstore...").translated);
2688 chainstate->PruneAndFlush();
2696 strprintf(
_(
"Error: Disk space is low for %s"),
2702 strprintf(
_(
"Error: Disk space is low for %s"),
2710 boost::signals2::connection block_notify_genesis_wait_connection;
2712 block_notify_genesis_wait_connection =
2719 #if defined(HAVE_SYSTEM)
2720 const std::string block_notify = args.
GetArg(
"-blocknotify",
"");
2721 if (!block_notify.empty()) {
2722 uiInterface.NotifyBlockTip_connect([block_notify](
2728 std::string command = block_notify;
2730 std::thread t(runCommand, command);
2737 std::vector<fs::path> vImportFiles;
2738 for (
const std::string &strFile : args.
GetArgs(
"-loadblock")) {
2756 block_notify_genesis_wait_connection.disconnect();
2765 int chain_active_height;
2786 LogPrintf(
"nBestHeight = %d\n", chain_active_height);
2788 node.peerman->SetBestHeight(chain_active_height);
2802 ? args.
GetIntArg(
"-maxavalancheoutbound",
2832 const auto BadPortWarning = [](
const char *
prefix, uint16_t port) {
2833 return strprintf(
_(
"%s request to listen on port %u. This port is "
2834 "considered \"bad\" and "
2835 "thus it is unlikely that any Bitcoin ABC peers "
2836 "connect to it. See "
2837 "doc/p2p-bad-ports.md for details and a full list."),
2841 for (
const std::string &bind_arg : args.
GetArgs(
"-bind")) {
2843 const size_t index = bind_arg.rfind(
'=');
2844 if (index == std::string::npos) {
2846 connOptions.
vBinds.push_back(bind_addr);
2853 const std::string network_type = bind_arg.substr(index + 1);
2854 if (network_type ==
"onion") {
2855 const std::string truncated_bind_arg =
2856 bind_arg.substr(0, index);
2857 if (
Lookup(truncated_bind_arg, bind_addr,
2858 BaseParams().OnionServiceTargetPort(),
false)) {
2867 for (
const std::string &strBind : args.
GetArgs(
"-whitebind")) {
2879 args.
GetArgs(
"-bind").empty() && args.
GetArgs(
"-whitebind").empty();
2884 const uint16_t port_arg = args.
GetIntArg(
"-port", 0);
2892 onion_service_target = connOptions.
onion_binds.front();
2895 connOptions.
onion_binds.push_back(onion_service_target);
2901 _(
"More than one onion bind address is provided. Using %s "
2902 "for the automatically created Tor onion service."),
2908 for (
const auto &net : args.
GetArgs(
"-whitelist")) {
2922 const auto connect = args.
GetArgs(
"-connect");
2923 if (connect.size() != 1 || connect[0] !=
"0") {
2928 const std::string &i2psam_arg = args.
GetArg(
"-i2psam",
"");
2929 if (!i2psam_arg.empty()) {
2933 _(
"Invalid -i2psam address or hostname: '%s'"), i2psam_arg));
2944 if (!
node.connman->Start(*
node.scheduler, connOptions)) {
2963 for (
const auto &client :
node.chain_clients) {
2964 client->start(*
node.scheduler);
2968 node.scheduler->scheduleEvery(
2976 node.peerman->StartScheduledTasks(*
node.scheduler);
2983 StartupNotify(args);
std::optional< bilingual_str > LoadAddrman(const CChainParams &chainparams, const std::vector< bool > &asmap, const ArgsManager &args, std::unique_ptr< AddrMan > &addrman)
Returns an error string on failure.
static constexpr int32_t DEFAULT_ADDRMAN_CONSISTENCY_CHECKS
Default for -checkaddrman.
arith_uint256 UintToArith256(const uint256 &a)
std::vector< bool > DecodeAsmap(fs::path path)
Read asmap from provided binary file.
bool isAvalancheEnabled(const ArgsManager &argsman)
static constexpr double AVALANCHE_DEFAULT_MIN_QUORUM_CONNECTED_STAKE_RATIO
Default minimum percentage of stake-weighted peers we must have a node for to constitute a usable quo...
static constexpr size_t AVALANCHE_DEFAULT_PEER_REPLACEMENT_COOLDOWN
Peer replacement cooldown time default value in seconds.
static constexpr double AVALANCHE_DEFAULT_MIN_AVAPROOFS_NODE_COUNT
Default minimum number of nodes that sent us an avaproofs message before we can consider our quorum s...
static constexpr Amount AVALANCHE_DEFAULT_MIN_QUORUM_STAKE
Default minimum cumulative stake of all known peers that constitutes a usable quorum.
static constexpr size_t AVALANCHE_DEFAULT_CONFLICTING_PROOF_COOLDOWN
Conflicting proofs cooldown time default value in seconds.
static constexpr bool AVALANCHE_DEFAULT_ENABLED
Is avalanche enabled by default.
std::unique_ptr< avalanche::Processor > g_avalanche
Global avalanche instance.
static constexpr size_t AVALANCHE_DEFAULT_COOLDOWN
Avalanche default cooldown in milliseconds.
static constexpr unsigned int DEFAULT_MISBEHAVING_BANTIME
static constexpr std::chrono::minutes DUMP_BANS_INTERVAL
void RPCNotifyBlockChange(const CBlockIndex *pindex)
Callback for when block tip changed.
const std::string & BlockFilterTypeName(BlockFilterType filter_type)
Get the human-readable name for a filter type.
const std::string & ListBlockFilterTypes()
Get a comma-separated list of known filter type names.
bool BlockFilterTypeByName(const std::string &name, BlockFilterType &filter_type)
Find a filter type by its human-readable name.
const std::set< BlockFilterType > & AllBlockFilterTypes()
Get a list of known filter types.
void DestroyAllBlockFilterIndexes()
Destroy all open block filter indexes.
BlockFilterIndex * GetBlockFilterIndex(BlockFilterType filter_type)
Get a block filter index by type.
void ForEachBlockFilterIndex(std::function< void(BlockFilterIndex &)> fn)
Iterate over all running block filter indexes, invoking fn on each.
bool InitBlockFilterIndex(BlockFilterType filter_type, size_t n_cache_size, bool f_memory, bool f_wipe)
Initialize a block filter index for the given type if one does not already exist.
RecursiveMutex cs_main
Global state.
const CChainParams & Params()
Return the currently selected parameters.
std::unique_ptr< CChainParams > CreateChainParams(const std::string &chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
const CBaseChainParams & BaseParams()
Return the currently selected parameters.
void SetupChainParamsBaseOptions(ArgsManager &argsman)
Set the arguments for chainparams.
std::unique_ptr< CBaseChainParams > CreateBaseChainParams(const std::string &chain)
Port numbers for incoming Tor connections (8334, 18334, 38334, 18445) have been chosen arbitrarily to...
#define Assert(val)
Identity function.
const std::set< std::string > GetUnsuitableSectionOnlyArgs() const
Log warnings for options in m_section_only_args when they are specified in the default section but no...
const fs::path & GetBlocksDirPath() const
Get blocks directory path.
std::vector< std::string > GetArgs(const std::string &strArg) const
Return a vector of strings of the given argument.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
bool SoftSetBoolArg(const std::string &strArg, bool fValue)
Set a boolean argument if it doesn't already have a value.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
void AddHiddenArgs(const std::vector< std::string > &args)
Add many hidden arguments.
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
const std::list< SectionInfo > GetUnrecognizedSections() const
Log warnings for unrecognized section names in the config file.
std::string GetChainName() const
Looks for -regtest, -testnet and returns the appropriate BIP70 chain name.
std::atomic< bool > m_reopen_file
void Stop()
Stops the instance from staying in sync with blockchain updates.
void Start(Chainstate &active_chainstate)
Start initializes the sync state and registers the instance as a ValidationInterface so that it stays...
BlockFilterIndex is used to store and retrieve block filters, hashes, and headers for a range of bloc...
static const std::string REGTEST
static const std::string TESTNET
static const std::string MAIN
BIP70 chain name strings (main, test or regtest)
The block chain is a tree shaped structure starting with the genesis block at the root,...
int64_t GetBlockTime() const
BlockHash GetBlockHash() const
int nHeight
height of the entry in the chain. The genesis block has height 0
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
int Height() const
Return the maximal height in the chain.
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
bool DefaultConsistencyChecks() const
Default value for -checkmempool and -checkblockindex argument.
std::string NetworkIDString() const
Return the BIP70 network string (main, test or regtest)
bool RequireStandard() const
Policy: Filter transactions that do not match well-defined patterns.
bool IsTestChain() const
If this chain is exclusively used for testing.
const Consensus::Params & GetConsensus() const
const CBlock & GenesisBlock() const
Fee rate in satoshis per kilobyte: Amount / kB.
void UnregisterBackgroundSignalScheduler()
Unregister a CScheduler to give callbacks which should run in the background - these callbacks will n...
void RegisterBackgroundSignalScheduler(CScheduler &scheduler)
Register a CScheduler to give callbacks which should run in the background (may only be called once)
void FlushBackgroundCallbacks()
Call any remaining callbacks on the calling thread.
A combination of a network address (CNetAddr) and a (TCP) port.
std::string ToStringIPPort() const
static const int DEFAULT_ZMQ_SNDHWM
static CZMQNotificationInterface * Create()
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
node::BlockMap & BlockIndex() EXCLUSIVE_LOCKS_REQUIRED(
Chainstate & ActiveChainstate() const
The most-work chain.
CBlockIndex * m_best_header
Best header we've seen so far (used for getheaders queries' starting points).
CBlockIndex * ActiveTip() const
CChain & ActiveChain() const
Chainstate &InitializeChainstate(CTxMemPool *mempool, const std::optional< BlockHash > &snapshot_blockhash=std::nullopt) LIFETIMEBOUND EXCLUSIVE_LOCKS_REQUIRED(std::vector< Chainstate * GetAll)()
Instantiate a new chainstate and assign it based upon whether it is from a snapshot.
node::BlockManager m_blockman
A single BlockManager instance is shared across each constructed chainstate to avoid duplicating bloc...
virtual uint64_t GetMaxBlockSize() const =0
virtual const CChainParams & GetChainParams() const =0
virtual bool SetMaxBlockSize(uint64_t maxBlockSize)=0
virtual void SetExcessUTXOCharge(Amount amt)=0
virtual void SetCashAddrEncoding(bool)=0
static bool TryParse(const std::string &str, NetWhitebindPermissions &output, bilingual_str &error)
static bool TryParse(const std::string &str, NetWhitelistPermissions &output, bilingual_str &error)
static std::unique_ptr< PeerManager > make(const CChainParams &chainparams, CConnman &connman, AddrMan &addrman, BanMan *banman, ChainstateManager &chainman, CTxMemPool &pool, bool ignore_incoming_txs)
Class for registering and managing all RPC calls.
virtual void AddWalletOptions(ArgsManager &argsman) const =0
Get wallet help string.
virtual void Construct(node::NodeContext &node) const =0
Add wallets that should be opened to list of chain clients.
virtual bool ParameterInteraction() const =0
Check wallet parameter interaction.
static std::unique_ptr< Processor > MakeProcessor(const ArgsManager &argsman, interfaces::Chain &chain, CConnman *connman, ChainstateManager &chainman, CTxMemPool *mempoolIn, CScheduler &scheduler, bilingual_str &error)
std::string ToString() const
std::string GetHex() const
std::string GetHex() const
Path class wrapper to prepare application code for transition from boost::filesystem library to std::...
bool m_have_pruned
True if any block files have ever been pruned.
std::string FormatVersion(int nVersion)
std::string FormatUserAgent(const std::string &name, const std::string &version, const std::vector< std::string > &comments)
Format the subversion field according to BIP 14 spec.
static constexpr int CLIENT_VERSION
bitcoind-res.rc includes this file, but it cannot cope with real c++ code.
const std::string CLIENT_NAME
std::unique_ptr< CoinStatsIndex > g_coin_stats_index
The global UTXO set hash object.
static const uint64_t DEFAULT_MAX_BLOCK_SIZE
Default setting for maximum allowed size for a block, in bytes.
void SetupCurrencyUnitOptions(ArgsManager &argsman)
bilingual_str AmountErrMsg(const std::string &optname, const std::string &strValue)
bilingual_str ResolveErrMsg(const std::string &optname, const std::string &strBind)
uint256 SerializeHash(const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
Compute the 256-bit hash of an object's serialization.
void InterruptHTTPRPC()
Interrupt HTTP RPC subsystem.
void StopHTTPRPC()
Stop HTTP RPC subsystem.
bool StartHTTPRPC(HTTPRPCRequestProcessor &httpRPCRequestProcessor)
Start HTTP RPC subsystem.
void StartREST(const std::any &context)
Start HTTP REST subsystem.
void StopREST()
Stop HTTP REST subsystem.
void InterruptREST()
Interrupt RPC REST subsystem.
void InterruptHTTPServer()
Interrupt HTTP server threads.
void StartHTTPServer()
Start HTTP server.
void StopHTTPServer()
Stop HTTP server.
bool InitHTTPServer(Config &config)
Initialize HTTP server.
static const int DEFAULT_HTTP_SERVER_TIMEOUT
static const int DEFAULT_HTTP_WORKQUEUE
static const int DEFAULT_HTTP_THREADS
Common init functions shared by bitcoin-node, bitcoin-wallet, etc.
static const char * BITCOIN_PID_FILENAME
The PID file facilities.
static bool CreatePidFile(const ArgsManager &args)
static const bool DEFAULT_PROXYRANDOMIZE
void Interrupt(NodeContext &node)
Interrupt threads.
void InitLogging(const ArgsManager &args)
Initialize global loggers.
bool AppInitLockDataDirectory()
Lock bitcoin data directory.
void SetupServerArgs(NodeContext &node)
Register all arguments with the ArgsManager.
static bool AppInitServers(Config &config, HTTPRPCRequestProcessor &httpRPCRequestProcessor, NodeContext &node)
#define MIN_CORE_FILEDESCRIPTORS
void Shutdown(NodeContext &node)
static void HandleSIGTERM(int)
Signal handlers are very limited in what they are allowed to do.
static void OnRPCStarted()
static Mutex g_genesis_wait_mutex
static void HandleSIGHUP(int)
static fs::path GetPidFile(const ArgsManager &args)
static std::condition_variable g_genesis_wait_cv
bool AppInitMain(Config &config, RPCServer &rpcServer, HTTPRPCRequestProcessor &httpRPCRequestProcessor, NodeContext &node, interfaces::BlockAndHeaderTipInfo *tip_info)
Bitcoin main initialization.
static constexpr bool DEFAULT_CHRONIK
bool AppInitBasicSetup(const ArgsManager &args)
Initialize bitcoin: Basic context setup.
bool AppInitSanityChecks()
Initialization sanity checks: ecc init, sanity checks, dir lock.
bool AppInitInterfaces(NodeContext &node)
Initialize node and wallet interface pointers.
static const char * DEFAULT_ASMAP_FILENAME
void InitParameterInteraction(ArgsManager &args)
Parameter interaction: change current parameters depending on various rules.
static void BlockNotifyGenesisWait(const CBlockIndex *pBlockIndex)
static void OnRPCStopped()
static bool LockDataDirectory(bool probeOnly)
static void registerSignalHandler(int signal, void(*handler)(int))
std::string LicenseInfo()
Returns licensing information (for -version)
bool AppInitParameterInteraction(Config &config, const ArgsManager &args)
Initialization: parameter interaction.
static const bool DEFAULT_REST_ENABLE
static boost::signals2::connection rpc_notify_block_change_connection
static void new_handler_terminate()
static constexpr bool DEFAULT_DAEMON
Default value for -daemon option.
static constexpr bool DEFAULT_DAEMONWAIT
Default value for -daemonwait option.
BCLog::Logger & LogInstance()
#define LogPrint(category,...)
void StartMapPort(bool use_upnp, bool use_natpmp)
static constexpr bool DEFAULT_NATPMP
static constexpr bool DEFAULT_UPNP
static const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT
Default for -limitdescendantsize, maximum kilobytes of in-mempool descendants.
static constexpr unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT
Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool ancestors.
static constexpr unsigned int DEFAULT_DESCENDANT_LIMIT
Default for -limitdescendantcount, max number of in-mempool descendants.
static constexpr unsigned int DEFAULT_ANCESTOR_LIMIT
Default for -limitancestorcount, max number of in-mempool ancestors.
std::string FormatMoney(const Amount amt)
Do not use these functions to represent or parse monetary amounts to or from JSON but use AmountFromV...
bool ParseMoney(const std::string &money_string, Amount &nRet)
Parse an amount denoted in full coins.
void OnStarted(std::function< void()> slot)
void OnStopped(std::function< void()> slot)
static constexpr Amount PROOF_DUST_THRESHOLD
Minimum amount per utxo.
static auto quoted(const std::string &s)
static bool exists(const path &p)
static std::string PathToString(const path &path)
Convert path object to byte string.
static path PathFromString(const std::string &string)
Convert byte string to path object.
std::string get_filesystem_error_message(const fs::filesystem_error &e)
void AddLoggingArgs(ArgsManager &argsman)
void SetLoggingCategories(const ArgsManager &args)
bool SanityChecks()
Ensure a usable environment with all necessary library support.
bool StartLogging(const ArgsManager &args)
void SetLoggingOptions(const ArgsManager &args)
std::unique_ptr< Chain > MakeChain(node::NodeContext &node, const CChainParams ¶ms)
Return implementation of Chain interface.
const CBlockIndex *GetFirstStoredBlock(const CBlockIndex *start_block) EXCLUSIVE_LOCKS_REQUIRED(voi CleanupBlockRevFiles)()
Find the first block that is not pruned.
bool fPruneMode
Pruning-related variables and constants.
ChainstateLoadVerifyError
CacheSizes CalculateCacheSizes(const ArgsManager &args, size_t n_indexes)
uint64_t nPruneTarget
Number of MiB of block files that we're trying to stay below.
static constexpr bool DEFAULT_STOPAFTERBLOCKIMPORT
void ThreadImport(const Config &config, ChainstateManager &chainman, std::vector< fs::path > vImportFiles, const ArgsManager &args)
std::optional< ChainstateLoadVerifyError > VerifyLoadedChainstate(ChainstateManager &chainman, bool fReset, bool fReindexChainState, const Config &config, unsigned int check_blocks, unsigned int check_level, std::function< int64_t()> get_unix_time_seconds)
std::optional< ChainstateLoadingError > LoadChainstate(bool fReset, ChainstateManager &chainman, CTxMemPool *mempool, bool fPruneMode_, const Consensus::Params &consensus_params, bool fReindexChainState, int64_t nBlockTreeDBCache, int64_t nCoinDBCache, int64_t nCoinCacheUsage, bool block_tree_db_in_memory, bool coins_db_in_memory, std::function< bool()> shutdown_requested, std::function< void()> coins_error_cb)
This sequence can have 4 types of outcomes:
std::atomic_bool fReindex
void TraceThread(const char *thread_name, std::function< void()> thread_func)
A wrapper for do-something-once thread functions.
void ThreadRename(std::string &&)
Rename a thread both in terms of an internal (in-memory) name as well as its system thread name.
void SetReachable(enum Network net, bool reachable)
Mark a network as reachable or unreachable (no automatic connects to it)
bool AddLocal(const CService &addr, int nScore)
static const unsigned int DEFAULT_MAX_PEER_CONNECTIONS
The maximum number of peer connections to maintain.
static const unsigned int MAX_SUBVERSION_LENGTH
Maximum length of the user agent string in version message.
static const int MAX_ADDNODE_CONNECTIONS
Maximum number of addnode outgoing nodes.
static const size_t DEFAULT_MAXSENDBUFFER
static const int NUM_FDS_MESSAGE_CAPTURE
Number of file descriptors required for message capture.
static const bool DEFAULT_BLOCKSONLY
Default for blocks only.
static const bool DEFAULT_WHITELISTFORCERELAY
Default for -whitelistforcerelay.
static const bool DEFAULT_FORCEDNSSEED
static const bool DEFAULT_WHITELISTRELAY
Default for -whitelistrelay.
static constexpr uint64_t DEFAULT_MAX_UPLOAD_TARGET
The default for -maxuploadtarget.
static const size_t DEFAULT_MAXRECEIVEBUFFER
static const int DEFAULT_MAX_AVALANCHE_OUTBOUND_CONNECTIONS
Maximum number of avalanche enabled outgoing connections by default.
static const bool DEFAULT_FIXEDSEEDS
static const int MAX_FEELER_CONNECTIONS
Maximum number of feeler connections.
static const bool DEFAULT_LISTEN
-listen default
static const int64_t DEFAULT_PEER_CONNECT_TIMEOUT
-peertimeout default
static const bool DEFAULT_DNSSEED
static const int MAX_OUTBOUND_FULL_RELAY_CONNECTIONS
Maximum number of automatic outgoing nodes over which we'll relay everything (blocks,...
static const int MAX_BLOCK_RELAY_ONLY_CONNECTIONS
Maximum number of block-relay-only outgoing connections.
const std::vector< std::string > NET_PERMISSIONS_DOC
static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN
Default number of orphan+recently-replaced txn to keep around for block reconstruction.
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS
Default for -maxorphantx, maximum number of orphan transactions kept in memory.
static const bool DEFAULT_PEERBLOCKFILTERS
@ NET_MAX
Dummy value to indicate the number of NET_* constants.
@ NET_ONION
TOR (v2 or v3)
@ NET_UNROUTABLE
Addresses from these networks are not publicly routable on the global Internet.
enum Network ParseNetwork(const std::string &net_in)
bool Lookup(const std::string &name, std::vector< CService > &vAddr, uint16_t portDefault, bool fAllowLookup, unsigned int nMaxSolutions, DNSLookupFn dns_lookup_function)
Resolve a service string to its corresponding service.
std::vector< std::string > GetNetworkNames(bool append_unroutable)
Return a vector of publicly routable Network names; optionally append NET_UNROUTABLE.
bool SetNameProxy(const proxyType &addrProxy)
Set the name proxy to use for all connections to nodes specified by a hostname.
bool IsBadPort(uint16_t port)
Determine if a port is "bad" from the perspective of attempting to connect to a node on that port.
bool SetProxy(enum Network net, const proxyType &addrProxy)
static const int DEFAULT_NAME_LOOKUP
-dns default
static const int DEFAULT_CONNECT_TIMEOUT
-timeout default
uint32_t nBytesPerSigCheck
static const uint64_t DEFAULT_MAX_GENERATED_BLOCK_SIZE
Default for -blockmaxsize, which controls the maximum size of block the mining code will create.
static const Amount DUST_RELAY_TX_FEE(1000 *SATOSHI)
Min feerate for defining dust.
static const Amount DEFAULT_BLOCK_MIN_TX_FEE_PER_KB(1000 *SATOSHI)
Default for -blockmintxfee, which sets the minimum feerate for a transaction in blocks created by min...
static const unsigned int DEFAULT_BYTES_PER_SIGCHECK
Default for -bytespersigcheck .
static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE
Default for -maxmempool, maximum megabytes of mempool memory usage.
static const bool DEFAULT_PERMIT_BAREMULTISIG
Default for -permitbaremultisig.
static constexpr std::chrono::milliseconds AVALANCHE_DEFAULT_QUERY_TIMEOUT
How long before we consider that a query timed out.
static constexpr int AVALANCHE_DEFAULT_STAKE_UTXO_CONFIRMATIONS
Minimum number of confirmations before a stake utxo is mature enough to be included into a proof.
ServiceFlags
nServices flags.
void RandAddPeriodic() noexcept
Gather entropy from various expensive sources, and feed them to the PRNG state.
uint64_t GetRand(uint64_t nMax) noexcept
Generate a uniform random integer in the range [0..range).
static void RegisterAllRPCCommands(const Config &config, RPCServer &rpcServer, CRPCTable &rpcTable)
Register all context-sensitive RPC commands.
bool(* handler)(Config &config, const std::any &context, HTTPRequest *req, const std::string &strReq)
const std::string UNIX_EPOCH_TIME
String used to describe UNIX epoch time in documentation, factored out to a constant for consistency.
void InitScriptExecutionCache()
Initializes the script-execution cache.
static const unsigned int DEFAULT_MAX_SCRIPT_CACHE_SIZE
void SetRPCWarmupFinished()
Mark warmup as done.
void SetRPCWarmupStatus(const std::string &newStatus)
Set the RPC warmup status.
void RpcInterruptionPoint()
Throw JSONRPCError if RPC is not running.
bool ShutdownRequested()
Returns true if a shutdown is requested, false otherwise.
bool InitShutdownState()
Initialize shutdown state.
void StartShutdown()
Request shutdown of the application.
void AbortShutdown()
Clear shutdown flag.
void InitSignatureCache()
static const unsigned int DEFAULT_MAX_SIG_CACHE_SIZE
bool fAcceptDatacarrier
A data carrying output is an unspendable output containing data.
static const unsigned int MAX_OP_RETURN_RELAY
Default setting for nMaxDatacarrierBytes.
static const bool DEFAULT_ACCEPT_DATACARRIER
std::string SanitizeString(const std::string &str, int rule)
Remove unsafe chars.
bool IsHexNumber(const std::string &str)
Return true if the string is a hex number, optionally prefixed with "0x".
@ SAFE_CHARS_UA_COMMENT
BIP-0014 subset.
void ReplaceAll(std::string &in_out, std::string_view search, std::string_view substitute)
auto Join(const std::vector< T > &list, const BaseType &separator, UnaryOp unary_op) -> decltype(unary_op(list.at(0)))
Join a list of items.
static constexpr Amount zero()
static BlockHash fromHex(const std::string &str)
int m_max_outbound_block_relay
unsigned int nReceiveFloodSize
int m_max_outbound_full_relay
std::vector< NetWhitebindPermissions > vWhiteBinds
uint64_t nMaxOutboundLimit
std::vector< NetWhitelistPermissions > vWhitelistedRange
CClientUIInterface * uiInterface
int m_max_avalanche_outbound
std::vector< CService > onion_binds
std::vector< std::string > m_specified_outgoing
ServiceFlags nLocalServices
std::vector< std::string > m_added_nodes
int64_t m_peer_connect_timeout
std::vector< CService > vBinds
unsigned int nSendBufferMaxSize
bool m_i2p_accept_incoming
std::vector< std::string > vSeedNodes
bool m_use_addrman_outgoing
std::vector< NetEventsInterface * > m_msgproc
bool bind_on_any
True if the user did not specify -bind= or -whitebind= and thus we should bind on 0....
BlockHash defaultAssumeValid
uint256 nMinimumChainWork
static const Currency & get()
Block and header tip information.
double verification_progress
NodeContext struct containing references to chain state and connection state.
#define WAIT_LOCK(cs, name)
#define TRY_LOCK(cs, name)
void SetupHelpOptions(ArgsManager &args)
Add help options to the args manager.
fs::path AbsPathForConfigVal(const fs::path &path, bool net_specific)
Most paths passed as configuration arguments are treated as relative to the datadir if they are not a...
const char *const BITCOIN_SETTINGS_FILENAME
std::string CopyrightHolders(const std::string &strPrefix)
bool LockDirectory(const fs::path &directory, const std::string lockfile_name, bool probe_only)
bool DirIsWritable(const fs::path &directory)
int RaiseFileDescriptorLimit(int nMinFD)
This function tries to raise the file descriptor limit to the requested number.
bool CheckDiskSpace(const fs::path &dir, uint64_t additional_bytes)
const char *const BITCOIN_CONF_FILENAME
int GetNumCores()
Return the number of cores available on the current system.
bool error(const char *fmt, const Args &...args)
int64_t GetTimeMillis()
Returns the system time (not mockable)
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.
T GetTime()
Return system time (or mocked time, if set)
static const int64_t DEFAULT_MAX_TIME_ADJUSTMENT
CService DefaultOnionServiceTarget()
const std::string DEFAULT_TOR_CONTROL
Default control port.
void InterruptTorControl()
void StartTorControl(CService onion_service_target)
static const bool DEFAULT_LISTEN_ONION
bilingual_str _(const char *psz)
Translation function.
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
std::optional< bilingual_str > CheckLegacyTxindex(CBlockTreeDB &block_tree_db)
static constexpr int64_t MAX_DB_CACHE_MB
max. -dbcache (MiB)
static constexpr int64_t MIN_DB_CACHE_MB
min. -dbcache (MiB)
static constexpr int64_t DEFAULT_DB_BATCH_SIZE
-dbbatchsize default (bytes)
static constexpr int64_t DEFAULT_DB_CACHE_MB
-dbcache default (MiB)
std::unique_ptr< TxIndex > g_txindex
The global transaction index, used in GetTransaction. May be null.
CClientUIInterface uiInterface
void InitWarning(const bilingual_str &str)
Show warning message.
bool InitError(const bilingual_str &str)
Show error message.
uint256 uint256S(const char *str)
uint256 from const char *.
void StartScriptCheckWorkerThreads(int threads_num)
Run instances of script checking worker threads.
arith_uint256 nMinimumChainWork
Minimum work we will assume exists on some valid chain.
std::condition_variable g_best_block_cv
double GuessVerificationProgress(const ChainTxData &data, const CBlockIndex *pindex)
Guess how far we are in the verification process at the given block index require cs_main if pindex h...
bool DumpMempool(const CTxMemPool &pool)
Dump the mempool to disk.
CFeeRate minRelayTxFee
A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation)
void StopScriptCheckWorkerThreads()
Stop all of the script checking worker threads.
const std::vector< std::string > CHECKLEVEL_DOC
Documentation for argument 'checklevel'.
BlockHash hashAssumeValid
Block hash whose ancestors we will assume to have valid scripts without checking them.
int64_t nMaxTipAge
If the tip is older than this (in seconds), the node is considered to be in initial block download.
static const bool DEFAULT_CHECKPOINTS_ENABLED
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES
Require that user allocate at least 550 MiB for block & undo files (blk???.dat and rev?...
static const unsigned int DEFAULT_CHECKLEVEL
static const unsigned int MIN_BLOCKS_TO_KEEP
Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ActiveChain().Tip() will not be pr...
static const Amount DEFAULT_MIN_RELAY_TX_FEE_PER_KB(1000 *SATOSHI)
Default for -minrelaytxfee, minimum relay fee for transactions.
static const int MAX_SCRIPTCHECK_THREADS
Maximum number of dedicated script-checking threads allowed.
static const Amount DEFAULT_UTXO_FEE
Default for -excessutxocharge for transactions transactions.
SynchronizationState
Current sync state passed to tip changed callbacks.
static const int DEFAULT_SCRIPTCHECK_THREADS
-par default (number of script-checking threads, 0 = auto)
static const char *const DEFAULT_BLOCKFILTERINDEX
static const unsigned int DEFAULT_MEMPOOL_EXPIRY
Default for -mempoolexpiry, expiration time for mempool transactions in hours.
static constexpr bool DEFAULT_COINSTATSINDEX
static const int64_t DEFAULT_MAX_TIP_AGE
static const signed int DEFAULT_CHECKBLOCKS
static const bool DEFAULT_PERSIST_MEMPOOL
Default for -persistmempool.
static const bool DEFAULT_PEERBLOOMFILTERS
static const int DEFAULT_STOPATHEIGHT
Default for -stopatheight.
static const bool DEFAULT_TXINDEX
CMainSignals & GetMainSignals()
void UnregisterAllValidationInterfaces()
Unregister all subscribers.
void UnregisterValidationInterface(CValidationInterface *callbacks)
Unregister subscriber.
void RegisterValidationInterface(CValidationInterface *callbacks)
Register subscriber.
static constexpr uint32_t AVALANCHE_VOTE_STALE_FACTOR
Scaling factor applied to confidence to determine staleness threshold.
static constexpr uint32_t AVALANCHE_VOTE_STALE_THRESHOLD
Number of votes before a record may be considered as stale.
const WalletInitInterface & g_wallet_init_interface
CZMQNotificationInterface * g_zmq_notification_interface
void RegisterZMQRPCCommands(CRPCTable &t)