 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file.
9 #if defined(HAVE_CONFIG_H)
61 #include <boost/algorithm/string/predicate.hpp>
62 #include <boost/algorithm/string/replace.hpp>
63 #include <boost/foreach.hpp>
64 #include <boost/interprocess/sync/file_lock.hpp>
65 #include <boost/thread.hpp>
66 #include <openssl/crypto.h>
74 int nWalletBackups = 10;
87 #define MIN_CORE_FILEDESCRIPTORS 0
89 #define MIN_CORE_FILEDESCRIPTORS 150
100 static const char* FEE_ESTIMATES_FILENAME =
"fee_estimates.dat";
148 }
catch (
const std::runtime_error& e) {
150 LogPrintf(
"Error reading from database: %s\n", e.what());
164 static boost::thread_group threadGroup;
180 LogPrintf(
"%s: In progress...\n", __func__);
182 TRY_LOCK(cs_Shutdown, lockShutdown);
199 GeneratePrcycoins(
false, NULL, 0);
205 threadGroup.interrupt_all();
206 threadGroup.join_all();
214 fs::path est_path =
GetDataDir() / FEE_ESTIMATES_FILENAME;
216 if (!est_fileout.
IsNull())
219 LogPrintf(
"%s: Failed to write fee estimates to %s\n", __func__, est_path.string());
233 delete pcoinscatcher;
234 pcoinscatcher = NULL;
246 if (pzmqNotificationInterface) {
248 delete pzmqNotificationInterface;
249 pzmqNotificationInterface = NULL;
259 }
catch (
const fs::filesystem_error& e) {
260 LogPrintf(
"%s: Unable to remove pidfile: %s\n", __func__, e.what());
305 static void registerSignalHandler(
int signal,
void(*
handler)(
int))
309 sigemptyset(&sa.sa_mask);
311 sigaction(signal, &sa,
nullptr);
319 std::string strError;
322 return UIError(strError);
349 if (strWarning !=
"" && !
GetBoolArg(
"-disablesafemode",
false) &&
361 strUsage +=
HelpMessageOpt(
"-alertnotify=<cmd>",
_(
"Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)"));
362 strUsage +=
HelpMessageOpt(
"-blocknotify=<cmd>",
_(
"Execute command when the best block changes (%s in cmd is replaced by block hash)"));
363 strUsage +=
HelpMessageOpt(
"-blocksizenotify=<cmd>",
_(
"Execute command when the best block changes and its size is over (%s in cmd is replaced by block hash, %d with the block size)"));
364 strUsage +=
HelpMessageOpt(
"-checkblocks=<n>",
strprintf(
_(
"How many blocks to check at startup (default: %u, 0 = all)"), 500));
365 strUsage +=
HelpMessageOpt(
"-conf=<file>",
strprintf(
_(
"Specify configuration file (default: %s)"),
"prcycoin.conf"));
368 strUsage +=
HelpMessageOpt(
"-daemon",
_(
"Run in the background as a daemon and accept commands"));
371 strUsage +=
HelpMessageOpt(
"-datadir=<dir>",
_(
"Specify data directory"));
373 strUsage +=
HelpMessageOpt(
"-dbcache=<n>",
strprintf(
_(
"Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache));
374 strUsage +=
HelpMessageOpt(
"-loadblock=<file>",
_(
"Imports blocks from external blk000??.dat file") +
" " +
_(
"on startup"));
376 strUsage +=
HelpMessageOpt(
"-maxorphantx=<n>",
strprintf(
_(
"Keep at most <n> unconnectable transactions in memory (default: %u)"), DEFAULT_MAX_ORPHAN_TRANSACTIONS));
377 strUsage +=
HelpMessageOpt(
"-par=<n>",
strprintf(
_(
"Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"), -(
int)boost::thread::hardware_concurrency(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS));
381 strUsage +=
HelpMessageOpt(
"-reindex",
_(
"Rebuild block chain index from current blk000??.dat files") +
" " +
_(
"on startup"));
383 strUsage +=
HelpMessageOpt(
"-resync",
_(
"Delete blockchain folders and resync from scratch") +
" " +
_(
"on startup"));
385 strUsage +=
HelpMessageOpt(
"-sysperms",
_(
"Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)"));
387 strUsage +=
HelpMessageOpt(
"-txindex",
strprintf(
_(
"Maintain a full transaction index, used by the getrawtransaction rpc call (default: %u)"), 0));
388 strUsage +=
HelpMessageOpt(
"-forcestart",
_(
"Attempt to force blockchain corruption recovery") +
" " +
_(
"on startup"));
391 strUsage +=
HelpMessageOpt(
"-addnode=<ip>",
_(
"Add a node to connect to and attempt to keep the connection open"));
392 strUsage +=
HelpMessageOpt(
"-banscore=<n>",
strprintf(
_(
"Threshold for disconnecting misbehaving peers (default: %u)"), 100));
393 strUsage +=
HelpMessageOpt(
"-bantime=<n>",
strprintf(
_(
"Number of seconds to keep misbehaving peers from reconnecting (default: %u)"), 86400));
394 strUsage +=
HelpMessageOpt(
"-bind=<addr>",
_(
"Bind to given address and always listen on it. Use [host]:port notation for IPv6"));
395 strUsage +=
HelpMessageOpt(
"-connect=<ip>",
_(
"Connect only to the specified node(s); -noconnect or -connect=0 alone to disable automatic connections"));
396 strUsage +=
HelpMessageOpt(
"-discover",
_(
"Discover own IP address (default: 1 when listening and no -externalip)"));
397 strUsage +=
HelpMessageOpt(
"-dns",
_(
"Allow DNS lookups for -addnode, -seednode and -connect") +
" " +
_(
"(default: 1)"));
398 strUsage +=
HelpMessageOpt(
"-dnsseed",
_(
"Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect/-noconnect)"));
399 strUsage +=
HelpMessageOpt(
"-externalip=<ip>",
_(
"Specify your own public address"));
400 strUsage +=
HelpMessageOpt(
"-forcednsseed",
strprintf(
_(
"Always query for peer addresses via DNS lookup (default: %u)"), 0));
401 strUsage +=
HelpMessageOpt(
"-listen",
_(
"Accept connections from outside (default: 1 if no -proxy or -connect/-noconnect)"));
402 strUsage +=
HelpMessageOpt(
"-listenonion",
strprintf(
_(
"Automatically create Tor hidden service (default: %d)"), DEFAULT_LISTEN_ONION));
403 strUsage +=
HelpMessageOpt(
"-maxconnections=<n>",
strprintf(
_(
"Maintain at most <n> connections to peers (default: %u)"), DEFAULT_MAX_PEER_CONNECTIONS));
404 strUsage +=
HelpMessageOpt(
"-maxreceivebuffer=<n>",
strprintf(
_(
"Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)"), 5000));
405 strUsage +=
HelpMessageOpt(
"-maxsendbuffer=<n>",
strprintf(
_(
"Maximum per-connection send buffer, <n>*1000 bytes (default: %u)"), 1000));
406 strUsage +=
HelpMessageOpt(
"-onion=<ip:port>",
strprintf(
_(
"Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)"),
"-proxy"));
407 strUsage +=
HelpMessageOpt(
"-onlynet=<net>",
_(
"Only connect to nodes in network <net> (ipv4, ipv6 or onion)"));
409 strUsage +=
HelpMessageOpt(
"-peerbloomfilters",
strprintf(
_(
"Support filtering of blocks and transaction with bloom filters (default: %u)"), DEFAULT_PEERBLOOMFILTERS));
410 strUsage +=
HelpMessageOpt(
"-port=<port>",
strprintf(
_(
"Listen for connections on <port> (default: %u or testnet: %u)"), 59682, 59684));
411 strUsage +=
HelpMessageOpt(
"-proxy=<ip:port>",
_(
"Connect through SOCKS5 proxy"));
412 strUsage +=
HelpMessageOpt(
"-proxyrandomize",
strprintf(
_(
"Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)"), 1));
413 strUsage +=
HelpMessageOpt(
"-seednode=<ip>",
_(
"Connect to a node to retrieve peer addresses, and disconnect"));
414 strUsage +=
HelpMessageOpt(
"-timeout=<n>",
strprintf(
_(
"Specify connection timeout in milliseconds (minimum: 1, default: %d)"), DEFAULT_CONNECT_TIMEOUT));
416 strUsage +=
HelpMessageOpt(
"-torpassword=<pass>",
_(
"Tor control port password (default: empty)"));
419 strUsage +=
HelpMessageOpt(
"-upnp",
_(
"Use UPnP to map the listening port (default: 1 when listening)"));
424 strUsage +=
HelpMessageOpt(
"-whitebind=<addr>",
_(
"Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6"));
425 strUsage +=
HelpMessageOpt(
"-whitelist=<netmask>",
_(
"Whitelist peers connecting from the given netmask or IP address. Can be specified multiple times.") +
426 " " +
_(
"Whitelisted peers cannot be DoS banned and their transactions are always relayed, even if they are already in the mempool, useful e.g. for a gateway"));
431 strUsage +=
HelpMessageOpt(
"-backuppath=<(dir/file)>",
_(
"Specify custom backup path to add a copy of any wallet backup. If set as dir, every backup generates a timestamped file. If set as file, will rewrite to that file every backup."));
432 strUsage +=
HelpMessageOpt(
"-createwalletbackups=<n>",
_(
"Number of automatic wallet backups (default: 10)"));
433 strUsage +=
HelpMessageOpt(
"-custombackupthreshold=<n>",
strprintf(
_(
"Number of custom location backups to retain (default: %d)"), DEFAULT_CUSTOMBACKUPTHRESHOLD));
434 strUsage +=
HelpMessageOpt(
"-disablewallet",
_(
"Do not load the wallet and disable wallet RPC calls"));
436 strUsage +=
HelpMessageOpt(
"-deletetx",
_(
"Enable Old Transaction Deletion"));
437 strUsage +=
HelpMessageOpt(
"-deleteinterval",
strprintf(
_(
"Delete transaction every <n> blocks during inital block download (default: %i)"), DEFAULT_TX_DELETE_INTERVAL));
438 strUsage +=
HelpMessageOpt(
"-keeptxnum",
strprintf(
_(
"Keep the last <n> transactions (default: %i)"), DEFAULT_TX_RETENTION_LASTTX));
439 strUsage +=
HelpMessageOpt(
"-keeptxfornblocks",
strprintf(
_(
"Keep transactions for at least <n> blocks (default: %i)"), DEFAULT_TX_RETENTION_BLOCKS));
441 strUsage +=
HelpMessageOpt(
"-mintxfee=<amt>",
strprintf(
_(
"Fees (in %s/Kb) smaller than this are considered zero fee for transaction creation (default: %s)"),
444 strUsage +=
HelpMessageOpt(
"-rescan",
_(
"Rescan the block chain for missing wallet transactions") +
" " +
_(
"on startup"));
445 strUsage +=
HelpMessageOpt(
"-salvagewallet",
_(
"Attempt to recover private keys from a corrupt wallet.dat") +
" " +
_(
"on startup"));
446 strUsage +=
HelpMessageOpt(
"-sendfreetransactions",
strprintf(
_(
"Send transactions as zero-fee transactions if possible (default: %u)"), 0));
447 strUsage +=
HelpMessageOpt(
"-spendzeroconfchange",
strprintf(
_(
"Spend unconfirmed change when sending transactions (default: %u)"), 1));
448 strUsage +=
HelpMessageOpt(
"-disablesystemnotifications",
strprintf(
_(
"Disable OS notifications for incoming transactions (default: %u)"), 0));
449 strUsage +=
HelpMessageOpt(
"-txconfirmtarget=<n>",
strprintf(
_(
"If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), 1));
450 strUsage +=
HelpMessageOpt(
"-maxtxfee=<amt>",
strprintf(
_(
"Maximum total fees to use in a single wallet transaction, setting too low may abort large transactions (default: %s)"),
452 strUsage +=
HelpMessageOpt(
"-upgradewallet",
_(
"Upgrade wallet to latest format") +
" " +
_(
"on startup"));
453 strUsage +=
HelpMessageOpt(
"-wallet=<file>",
_(
"Specify wallet file (within data directory)") +
" " +
strprintf(
_(
"(default: %s)"),
"wallet.dat"));
454 strUsage +=
HelpMessageOpt(
"-walletnotify=<cmd>",
_(
"Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)"));
456 strUsage +=
HelpMessageOpt(
"-windowtitle=<name>",
_(
"Wallet window title"));
457 strUsage +=
HelpMessageOpt(
"-zapwallettxes=<mode>",
_(
"Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup") +
458 " " +
_(
"(1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)"));
463 strUsage +=
HelpMessageOpt(
"-zmqpubhashblock=<address>",
_(
"Enable publish hash block in <address>"));
464 strUsage +=
HelpMessageOpt(
"-zmqpubhashtx=<address>",
_(
"Enable publish hash transaction in <address>"));
465 strUsage +=
HelpMessageOpt(
"-zmqpubhashtxlock=<address>",
_(
"Enable publish hash transaction (locked via SwiftX) in <address>"));
466 strUsage +=
HelpMessageOpt(
"-zmqpubrawblock=<address>",
_(
"Enable publish raw block in <address>"));
467 strUsage +=
HelpMessageOpt(
"-zmqpubrawtx=<address>",
_(
"Enable publish raw transaction in <address>"));
468 strUsage +=
HelpMessageOpt(
"-zmqpubrawtxlock=<address>",
_(
"Enable publish raw transaction (locked via SwiftX) in <address>"));
472 strUsage +=
HelpMessageOpt(
"-uacomment=<cmt>",
_(
"Append comment to the user agent string"));
474 strUsage +=
HelpMessageOpt(
"-checkblockindex",
strprintf(
"Do a full consistency check for mapBlockIndex, setBlockIndexCandidates, chainActive and mapBlocksUnlinked occasionally. Also sets -checkmempool (default: %u)",
Params(
CBaseChainParams::MAIN).DefaultConsistencyChecks()));
476 strUsage +=
HelpMessageOpt(
"-checkpoints",
strprintf(
_(
"Only accept block chain matching built-in checkpoints (default: %u)"), 1));
477 strUsage +=
HelpMessageOpt(
"-dblogsize=<n>",
strprintf(
_(
"Flush database activity from memory pool to disk log every <n> megabytes (default: %u)"), 100));
478 strUsage +=
HelpMessageOpt(
"-disablesafemode",
strprintf(
_(
"Disable safemode, override a real safe mode event (default: %u)"), 0));
480 strUsage +=
HelpMessageOpt(
"-dropmessagestest=<n>",
_(
"Randomly drop 1 of every <n> network messages"));
481 strUsage +=
HelpMessageOpt(
"-fuzzmessagestest=<n>",
_(
"Randomly fuzz 1 of every <n> network messages"));
482 strUsage +=
HelpMessageOpt(
"-flushwallet",
strprintf(
_(
"Run a thread to flush wallet periodically (default: %u)"), 1));
483 strUsage +=
HelpMessageOpt(
"-maxreorg",
strprintf(
_(
"Use a custom max chain reorganization depth (default: %u)"), 100));
484 strUsage +=
HelpMessageOpt(
"-stopafterblockimport",
strprintf(
_(
"Stop running after importing blocks from disk (default: %u)"), 0));
486 strUsage +=
HelpMessageOpt(
"-debug=<category>",
strprintf(
_(
"Output debugging information (default: %u, supplying <category> is optional)"), 0) +
". " +
487 _(
"If <category> is not supplied, output all debugging information.") +
_(
"<category> can be:") +
" " +
ListLogCategories() +
".");
488 strUsage +=
HelpMessageOpt(
"-debugexclude=<category>",
_(
"Exclude debugging information for a category. Can be used in conjunction with -debug=1 to output debug logs for all categories except one or more specified categories."));
490 strUsage +=
HelpMessageOpt(
"-nodebug",
"Turn off debugging messages, same as -debug=0");
493 strUsage +=
HelpMessageOpt(
"-genproclimit=<n>",
strprintf(
_(
"Set the number of threads for coin generation if enabled (-1 = all cores, default: %d)"), 1));
495 strUsage +=
HelpMessageOpt(
"-help-debug",
_(
"Show all debugging options (usage: --help -help-debug)"));
499 strUsage +=
HelpMessageOpt(
"-limitfreerelay=<n>",
strprintf(
_(
"Continuously rate-limit free transactions to <n>*1000 bytes per minute (default:%u)"), 15));
500 strUsage +=
HelpMessageOpt(
"-relaypriority",
strprintf(
_(
"Require high priority for relaying free or low-fee transactions (default:%u)"), 1));
501 strUsage +=
HelpMessageOpt(
"-maxsigcachesize=<n>",
strprintf(
_(
"Limit size of signature cache to <n> MiB (default: %u)"), DEFAULT_MAX_SIG_CACHE_SIZE));
503 strUsage +=
HelpMessageOpt(
"-maxtipage=<n>",
strprintf(
"Maximum tip age in seconds to consider node in initial block download (default: %u)", DEFAULT_MAX_TIP_AGE));
505 strUsage +=
HelpMessageOpt(
"-printtoconsole",
strprintf(
_(
"Send trace/debug info to console instead of debug.log file (default: %u)"), 0));
507 strUsage +=
HelpMessageOpt(
"-printpriority",
strprintf(
_(
"Log transaction priority and fee per kB when mining blocks (default: %u)"), 0));
508 strUsage +=
HelpMessageOpt(
"-privdb",
strprintf(
_(
"Sets the DB_PRIVATE flag in the wallet db environment (default: %u)"), 1));
509 strUsage +=
HelpMessageOpt(
"-regtest",
_(
"Enter regression test mode, which uses a special chain in which blocks can be solved instantly.") +
" " +
510 _(
"This is intended for regression testing tools and app development.") +
" " +
511 _(
"In this mode -genproclimit controls how many blocks are generated immediately."));
513 strUsage +=
HelpMessageOpt(
"-shrinkdebugfile",
_(
"Shrink debug.log file on client startup (default: 1 when no -debug)"));
519 strUsage +=
HelpMessageOpt(
"-prcystake=<n>",
strprintf(
_(
"Enable or disable staking functionality for PRCY inputs (0-1, default: %u)"), 1));
520 strUsage +=
HelpMessageOpt(
"-reservebalance=<amt>",
_(
"Keep the specified amount available for spending at all times (default: 0)"));
522 strUsage +=
HelpMessageOpt(
"-printstakemodifier",
_(
"Display the stake modifier calculations in the debug.log file."));
523 strUsage +=
HelpMessageOpt(
"-printcoinstake",
_(
"Display verbose coin stake messages in the debug.log file."));
528 strUsage +=
HelpMessageOpt(
"-masternode=<n>",
strprintf(
_(
"Enable the client to act as a masternode (0-1, default: %u)"), 0));
529 strUsage +=
HelpMessageOpt(
"-mnconf=<file>",
strprintf(
_(
"Specify masternode configuration file (default: %s)"),
"masternode.conf"));
530 strUsage +=
HelpMessageOpt(
"-mnconflock=<n>",
strprintf(
_(
"Lock masternodes from masternode configuration file (default: %u)"), 1));
531 strUsage +=
HelpMessageOpt(
"-masternodeprivkey=<n>",
_(
"Set the masternode private key"));
532 strUsage +=
HelpMessageOpt(
"-masternodeaddr=<n>",
strprintf(
_(
"Set external address:port to get to this masternode (example: %s)"),
"128.127.106.235:59682"));
533 strUsage +=
HelpMessageOpt(
"-budgetvotemode=<mode>",
_(
"Change automatic finalized budget voting behavior. mode=auto: Vote for only exact finalized budget match to my generated budget. (string, default: auto)"));
536 strUsage +=
HelpMessageOpt(
"-enableswifttx=<n>",
strprintf(
_(
"Enable SwiftX, show confirmations for locked transactions (bool, default: %s)"),
"true"));
540 strUsage +=
HelpMessageOpt(
"-datacarrier",
strprintf(
_(
"Relay and mine data carrier transactions (default: %u)"), 1));
541 strUsage +=
HelpMessageOpt(
"-datacarriersize",
strprintf(
_(
"Maximum size of data in data carrier transactions we relay and mine (default: %u)"), MAX_OP_RETURN_RELAY));
543 strUsage +=
HelpMessageOpt(
"-blockversion=<n>",
"Override block version to test forking scenarios");
548 strUsage +=
HelpMessageOpt(
"-blockmaxsize=<n>",
strprintf(
_(
"Set maximum block size in bytes (default: %d)"), DEFAULT_BLOCK_MAX_SIZE));
549 strUsage +=
HelpMessageOpt(
"-blockprioritysize=<n>",
strprintf(
_(
"Set maximum size of high-priority/low-fee transactions in bytes (default: %d)"), DEFAULT_BLOCK_PRIORITY_SIZE));
552 strUsage +=
HelpMessageOpt(
"-server",
_(
"Accept command line and JSON-RPC commands"));
554 strUsage +=
HelpMessageOpt(
"-rpcbind=<addr>",
_(
"Bind to given address to listen for JSON-RPC connections. Use [host]:port notation for IPv6. This option can be specified multiple times (default: bind to all interfaces)"));
555 strUsage +=
HelpMessageOpt(
"-rpcuser=<user>",
_(
"Username for JSON-RPC connections"));
556 strUsage +=
HelpMessageOpt(
"-rpcpassword=<pw>",
_(
"Password for JSON-RPC connections"));
557 strUsage +=
HelpMessageOpt(
"-rpcauth=<userpw>",
_(
"Username and hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcuser. This option can be specified multiple times"));
558 strUsage +=
HelpMessageOpt(
"-rpcport=<port>",
strprintf(
_(
"Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), 59683, 59685));
559 strUsage +=
HelpMessageOpt(
"-rpcallowip=<ip>",
_(
"Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"));
560 strUsage +=
HelpMessageOpt(
"-rpcthreads=<n>",
strprintf(
_(
"Set the number of threads to service RPC calls (default: %d)"), DEFAULT_HTTP_THREADS));
563 strUsage +=
HelpMessageOpt(
"-rpcworkqueue=<n>",
strprintf(
"Set the depth of the work queue to service RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE));
564 strUsage +=
HelpMessageOpt(
"-rpcservertimeout=<n>",
strprintf(
"Timeout during HTTP requests (default: %d)", DEFAULT_HTTP_SERVER_TIMEOUT));
567 strUsage +=
HelpMessageOpt(
"-blockspamfilter=<n>",
strprintf(
_(
"Use block spam filter (default: %u)"), DEFAULT_BLOCK_SPAM_FILTER));
568 strUsage +=
HelpMessageOpt(
"-blockspamfiltermaxsize=<n>",
strprintf(
_(
"Maximum size of the list of indexes in the block spam filter (default: %u)"), DEFAULT_BLOCK_SPAM_FILTER_MAX_SIZE));
569 strUsage +=
HelpMessageOpt(
"-blockspamfiltermaxavg=<n>",
strprintf(
_(
"Maximum average size of an index occurrence in the block spam filter (default: %u)"), DEFAULT_BLOCK_SPAM_FILTER_MAX_AVG));
588 FormatParagraph(
_(
"Distributed under the MIT software license, see the accompanying file COPYING or <http://www.opensource.org/licenses/mit-license.php>.")) +
"\n" +
590 FormatParagraph(
_(
"This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software written by Eric Young and UPnP software written by Thomas Bernard.")) +
594 static void BlockNotifyCallback(
bool initialSync,
const CBlockIndex *pBlockIndex)
596 if (initialSync || !pBlockIndex)
599 std::string strCmd =
GetArg(
"-blocknotify",
"");
601 if (!strCmd.empty()) {
608 static void BlockSizeNotifyCallback(
int size,
const uint256& hashNewTip)
610 std::string strCmd =
GetArg(
"-blocksizenotify",
"");
612 boost::replace_all(strCmd,
"%s", hashNewTip.
GetHex());
613 boost::replace_all(strCmd,
"%d", std::to_string(size));
619 static bool fHaveGenesis =
false;
620 static std::mutex cs_GenesisWait;
621 static std::condition_variable condvar_GenesisWait;
623 static void BlockNotifyGenesisWait(
bool,
const CBlockIndex *pBlockIndex)
625 if (pBlockIndex !=
nullptr) {
627 std::unique_lock<std::mutex> lock_GenesisWait(cs_GenesisWait);
630 condvar_GenesisWait.notify_all();
666 LogPrintf(
"Reindexing block file blk%05u.dat...\n", (
unsigned int)nFile);
678 fs::path pathBootstrap =
GetDataDir() /
"bootstrap.dat";
679 if (fs::exists(pathBootstrap)) {
683 fs::path pathBootstrapOld =
GetDataDir() /
"bootstrap.dat.old";
684 LogPrintf(
"Importing bootstrap.dat...\n");
688 LogPrintf(
"Warning: Could not open bootstrap file %s\n", pathBootstrap.string());
693 for (fs::path& path : vImportFiles) {
697 LogPrintf(
"Importing blocks file %s...\n", path.string());
700 LogPrintf(
"Warning: Could not open blocks file %s\n", path.string());
704 if (
GetBoolArg(
"-stopafterblockimport",
false)) {
705 LogPrintf(
"Stopping after block import\n");
717 UIError(
"OpenSSL appears to lack support for elliptic curve cryptography. For more "
718 "information, visit https://en.bitcoin.it/wiki/OpenSSL_and_EC_Libraries");
726 UIError(
"OS cryptographic RNG sanity check failure. Aborting.");
751 [[noreturn]]
static void new_handler_terminate()
757 std::set_new_handler(std::terminate);
758 LogPrintf(
"Error: Out of memory. Terminating.\n");
769 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
770 _CrtSetReportFile(_CRT_WARN, CreateFileA(
"NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
774 _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
778 SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
782 return UIError(
"Error: Initializing networking failed");
788 return UIError(
"Error: -sysperms is not allowed in combination with enabled wallet functionality");
802 signal(SIGPIPE, SIG_IGN);
805 std::set_new_handler(new_handler_terminate);
817 LogPrintf(
"%s : parameter interaction: -bind or -whitebind set -> setting -listen=1\n", __func__);
823 LogPrintf(
"%s : parameter interaction: -connect set -> setting -dnsseed=0\n", __func__);
825 LogPrintf(
"%s : parameter interaction: -connect set -> setting -listen=0\n", __func__);
831 LogPrintf(
"%s: parameter interaction: -proxy set -> setting -listen=0\n", __func__);
835 LogPrintf(
"%s: parameter interaction: -proxy set -> setting -upnp=0\n", __func__);
838 LogPrintf(
"%s : parameter interaction: -proxy set -> setting -discover=0\n", __func__);
844 LogPrintf(
"%s : parameter interaction: -listen=0 -> setting -upnp=0\n", __func__);
846 LogPrintf(
"%s : parameter interaction: -listen=0 -> setting -discover=0\n", __func__);
848 LogPrintf(
"%s : parameter interaction: -listen=0 -> setting -listenonion=0\n", __func__);
851 if (
mapArgs.count(
"-externalip")) {
854 LogPrintf(
"%s : parameter interaction: -externalip set -> setting -discover=0\n", __func__);
860 LogPrintf(
"%s : parameter interaction: -salvagewallet=1 -> setting -rescan=1\n", __func__);
866 LogPrintf(
"%s : parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n", __func__);
871 LogPrintf(
"%s : parameter interaction: -enableswifttx=false -> setting -nSwiftTXDepth=0\n", __func__);
875 static std::string ResolveErrMsg(
const char *
const optname,
const std::string& strBind)
877 return strprintf(
_(
"Cannot resolve -%s address: '%s'"), optname, strBind);
889 LogPrintf(
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
899 version_string +=
" (debug build)";
901 version_string +=
" (release build)";
903 LogPrintf(
"PRCY version %s\n", version_string);
917 if (
mapArgs.count(
"-reservebalance")) {
919 UIError(
_(
"Invalid amount for -reservebalance=<amount>"));
926 int nBind = std::max((
int)
mapArgs.count(
"-bind") + (
int)
mapArgs.count(
"-whitebind"), 1);
931 return UIError(
_(
"Not enough file descriptors available."));
938 const std::vector<std::string>& categories =
mapMultiArgs[
"-debug"];
941 find(categories.begin(), categories.end(), std::string(
"0")) != categories.end())) {
942 for (
const auto& cat : categories) {
944 UIWarning(
strprintf(
_(
"Unsupported logging category %s=%s."),
"-debug", cat));
951 const std::vector<std::string>& excludedCategories =
mapMultiArgs.at(
"-debugexclude");
952 for (
const auto& cat : excludedCategories) {
954 UIWarning(
strprintf(
_(
"Unsupported logging category %s=%s."),
"-debugexclude", cat));
961 UIWarning(
_(
"Warning: Unsupported argument -debugnet ignored, use -debug=net."));
964 return UIError(
_(
"Error: Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported."));
967 return UIError(
_(
"Error: Unsupported argument -tor found, use -onion."));
970 return UIError(
_(
"Error: -listen must be true if -masternode is set."));
974 strprintf(
_(
"Masternodes are required to run on port %d for %s-net"),
Params().GetDefaultPort(),
Params().NetworkIDString()));
977 UIWarning(
_(
"Warning: Unsupported argument -benchmark ignored, use -debug=bench."));
993 setvbuf(stdout, NULL, _IOLBF, 0);
997 bool fDisableWallet =
GetBoolArg(
"-disablewallet",
false);
998 if (fDisableWallet) {
1000 LogPrintf(
"%s : parameter interaction: wallet functionality not enabled -> setting -staking=0\n", __func__);
1014 if (
mapArgs.count(
"-minrelaytxfee")) {
1019 return UIError(
strprintf(
_(
"Invalid amount for -%s=<amount>: '%s'"),
"minrelaytxfee",
mapArgs[
"-minrelaytxfee"]));
1022 #ifdef ENABLE_WALLET
1023 std::string strWalletFile =
GetArg(
"-wallet",
"wallet.dat");
1026 #endif // ENABLE_WALLET
1032 if (
GetBoolArg(
"-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS))
1043 return UIError(
_(
"Initialization sanity check failed. PRCY is shutting down."));
1045 std::string strDataDir =
GetDataDir().string();
1046 #ifdef ENABLE_WALLET
1048 fs::path wallet_file_path(strWalletFile);
1049 if (strWalletFile != wallet_file_path.filename().string())
1050 return UIError(
strprintf(
_(
"Wallet %s resides outside data directory %s"), strWalletFile, strDataDir));
1053 fs::path pathLockFile =
GetDataDir() /
".lock";
1055 if (file) fclose(file);
1056 static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
1059 if (!lock.timed_lock(boost::get_system_time() + boost::posix_time::seconds(10)))
1060 return UIError(
strprintf(
_(
"Cannot obtain a lock on data directory %s. PRCY is probably already running."), strDataDir));
1071 LogPrintf(
"Using OpenSSL version %s\n", SSLeay_version(SSLEAY_VERSION));
1072 #ifdef ENABLE_WALLET
1073 LogPrintf(
"Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0));
1078 LogPrintf(
"Using data directory %s\n", strDataDir);
1081 std::ostringstream strErrors;
1093 threadGroup.create_thread(boost::bind(&TraceThread<CScheduler::Function>,
"scheduler", serviceLoop));
1103 return UIError(
_(
"Unable to start HTTP server. See debug log for details."));
1107 #ifdef ENABLE_WALLET
1108 if (!fDisableWallet) {
1109 fs::path backupDir =
GetDataDir() /
"backups";
1110 if (!fs::exists(backupDir)) {
1112 fs::create_directories(backupDir);
1114 nWalletBackups =
GetArg(
"-createwalletbackups", 10);
1115 nWalletBackups = std::max(0, std::min(10, nWalletBackups));
1116 if (nWalletBackups > 0) {
1117 if (fs::exists(backupDir)) {
1120 std::string backupPathStr = backupDir.string();
1121 backupPathStr +=
"/" + strWalletFile;
1122 std::string sourcePathStr =
GetDataDir().string();
1123 sourcePathStr +=
"/" + strWalletFile;
1124 fs::path sourceFile = sourcePathStr;
1125 fs::path backupFile = backupPathStr +
dateTimeStr;
1126 sourceFile.make_preferred();
1127 backupFile.make_preferred();
1128 if (fs::exists(sourceFile)) {
1129 #if BOOST_VERSION >= 105800
1131 fs::copy_file(sourceFile, backupFile);
1132 LogPrintf(
"Creating backup of %s -> %s\n", sourceFile, backupFile);
1133 }
catch (
const fs::filesystem_error&
error) {
1137 std::ifstream src(sourceFile.string(), std::ios::binary);
1138 std::ofstream dst(backupFile.string(), std::ios::binary);
1143 typedef std::multimap<std::time_t, fs::path> folder_set_t;
1144 folder_set_t folder_set;
1145 fs::directory_iterator end_iter;
1146 fs::path backupFolder = backupDir.string();
1147 backupFolder.make_preferred();
1149 fs::path currentFile;
1150 for (fs::directory_iterator dir_iter(backupFolder); dir_iter != end_iter; ++dir_iter) {
1152 if (fs::is_regular_file(dir_iter->status())) {
1153 currentFile = dir_iter->path().filename();
1155 if (dir_iter->path().stem().string() == strWalletFile) {
1156 folder_set.insert(folder_set_t::value_type(fs::last_write_time(dir_iter->path()), *dir_iter));
1164 if (counter > nWalletBackups) {
1167 fs::remove(file.second);
1168 LogPrintf(
"Old backup deleted: %s\n", file.second);
1169 }
catch (
const fs::filesystem_error&
error) {
1180 fs::path blocksDir =
GetDataDir() /
"blocks";
1181 fs::path chainstateDir =
GetDataDir() /
"chainstate";
1185 if (fs::exists(blocksDir)){
1186 fs::remove_all(blocksDir);
1187 LogPrintf(
"-resync: folder deleted: %s\n", blocksDir.string().c_str());
1190 if (fs::exists(chainstateDir)){
1191 fs::remove_all(chainstateDir);
1192 LogPrintf(
"-resync: folder deleted: %s\n", chainstateDir.string().c_str());
1194 }
catch (
const fs::filesystem_error&
error) {
1195 LogPrintf(
"Failed to delete blockchain folders %s\n",
error.what());
1199 LogPrintf(
"Using wallet %s\n", strWalletFile);
1204 fs::path pathDatabase =
GetDataDir() /
"database";
1207 fs::rename(pathDatabase, pathDatabaseBak);
1208 LogPrintf(
"Moved old %s to %s. Retrying.\n", pathDatabase.string(), pathDatabaseBak.string());
1209 }
catch (
const fs::filesystem_error&
error) {
1216 std::string msg =
strprintf(
_(
"Error initializing wallet database environment %s!"), strDataDir);
1217 return UIError(msg);
1227 if (fs::exists(
GetDataDir() / strWalletFile)) {
1230 std::string msg =
strprintf(
_(
"Warning: wallet.dat corrupt, data salvaged!"
1231 " Original wallet.dat saved as wallet.{timestamp}.bak in %s; if"
1232 " your balance or transactions are incorrect you should"
1233 " restore from a backup."),
1238 return UIError(
_(
"wallet.dat corrupt, salvage failed"));
1242 #endif // ENABLE_WALLET
1247 std::vector<std::string> uacomments;
1248 for (
const std::string& cmt :
mapMultiArgs[
"-uacomment"]) {
1250 return UIError(
strprintf(
_(
"User Agent comment (%s) contains unsafe characters."), cmt));
1251 uacomments.push_back(cmt);
1257 return UIError(
strprintf(
_(
"Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments."),
1261 if (
mapArgs.count(
"-onlynet")) {
1262 std::set<enum Network> nets;
1266 return UIError(
strprintf(
_(
"Unknown network specified in -onlynet: '%s'"), snet));
1269 for (
int n = 0; n <
NET_MAX; n++) {
1271 if (!nets.count(net))
1276 if (
mapArgs.count(
"-whitelist")) {
1277 for (
const std::string& net :
mapMultiArgs[
"-whitelist"]) {
1281 return UIError(
strprintf(
_(
"Invalid netmask specified in -whitelist: '%s'"), net));
1289 bool proxyRandomize =
GetBoolArg(
"-proxyrandomize",
true);
1292 std::string proxyArg =
GetArg(
"-proxy",
"");
1294 if (proxyArg !=
"" && proxyArg !=
"0") {
1297 return UIError(
strprintf(
_(
"Lookup(): Invalid -proxy address or hostname: '%s'"), proxyArg));
1302 return UIError(
strprintf(
_(
"isValid(): Invalid -proxy address or hostname: '%s'"), proxyArg));
1314 std::string onionArg =
GetArg(
"-onion",
"");
1315 if (onionArg !=
"") {
1316 if (onionArg ==
"0") {
1321 return UIError(
strprintf(
_(
"Invalid -onion address or hostname: '%s'"), onionArg));
1325 return UIError(
strprintf(
_(
"Invalid -onion address or hostname: '%s'"), onionArg));
1335 bool fBound =
false;
1341 return UIError(ResolveErrMsg(
"bind", strBind));
1344 for (std::string strBind :
mapMultiArgs[
"-whitebind"]) {
1346 if (!
Lookup(strBind.c_str(), addrBind, 0,
false))
1347 return UIError(ResolveErrMsg(
"whitebind", strBind));
1349 return UIError(
strprintf(
_(
"Need to specify a port with -whitebind: '%s'"), strBind));
1353 struct in_addr inaddr_any;
1354 inaddr_any.s_addr = INADDR_ANY;
1359 return UIError(
_(
"Failed to listen on any port. Use -listen=0 if you want this."));
1362 if (
mapArgs.count(
"-externalip")) {
1363 for (std::string strAddr :
mapMultiArgs[
"-externalip"]) {
1368 return UIError(ResolveErrMsg(
"externalip", strAddr));
1378 if (pzmqNotificationInterface) {
1388 fs::create_directories(
GetDataDir() /
"blocks");
1391 int64_t nTotalCache = (
GetArg(
"-dbcache", nDefaultDbCache) << 20);
1392 nTotalCache = std::max(nTotalCache, nMinDbCache << 20);
1393 nTotalCache = std::min(nTotalCache, nMaxDbCache << 20);
1394 int64_t nBlockTreeDBCache = nTotalCache / 8;
1395 if (nBlockTreeDBCache > (1 << 21) && !
GetBoolArg(
"-txindex",
true))
1396 nBlockTreeDBCache = (1 << 21);
1397 nTotalCache -= nBlockTreeDBCache;
1398 int64_t nCoinDBCache = std::min(nTotalCache / 2, (nTotalCache / 4) + (1 << 23));
1399 nTotalCache -= nCoinDBCache;
1402 LogPrintf(
"* Using %.1fMiB for block index database\n", nBlockTreeDBCache * (1.0 / 1024 / 1024));
1403 LogPrintf(
"* Using %.1fMiB for chain state database\n", nCoinDBCache * (1.0 / 1024 / 1024));
1406 bool fLoaded =
false;
1409 std::string strLoadError;
1414 const int64_t load_block_index_start_time =
GetTimeMillis();
1419 delete pcoinsdbview;
1420 delete pcoinscatcher;
1435 std::string strBlockIndexError =
"";
1438 strLoadError =
_(
"Error loading block database");
1439 strLoadError =
strprintf(
"%s : %s", strLoadError, strBlockIndexError);
1446 return UIError(
_(
"Incorrect or no genesis block found. Wrong datadir for network?"));
1450 strLoadError =
_(
"Error initializing block database");
1456 strLoadError =
_(
"You need to rebuild the database using -reindex to change -txindex");
1464 if (
GetBoolArg(
"-reindexmoneysupply",
false)) {
1479 strLoadError =
_(
"The block database contains a block which appears to be from the future. "
1480 "This may be due to your computer's date and time being set incorrectly. "
1481 "Only rebuild the block database if you are sure that your computer's date and time are correct");
1487 if (!
CVerifyDB().VerifyDB(pcoinsdbview, 4,
GetArg(
"-checkblocks", 100))) {
1488 strLoadError =
_(
"Corrupted block database detected");
1493 }
catch (
const std::exception& e) {
1495 strLoadError =
_(
"Error opening block database");
1509 strLoadError +
".\n\n" +
_(
"Do you want to rebuild the block database now?"),
1515 fs::path blocksDir =
GetDataDir() /
"blocks";
1516 fs::path chainstateDir =
GetDataDir() /
"chainstate";
1520 if (fs::exists(blocksDir)){
1521 fs::remove_all(blocksDir);
1522 LogPrintf(
"-resync: folder deleted: %s\n", blocksDir.string().c_str());
1525 if (fs::exists(chainstateDir)){
1526 fs::remove_all(chainstateDir);
1527 LogPrintf(
"-resync: folder deleted: %s\n", chainstateDir.string().c_str());
1530 fs::create_directories(blocksDir);
1531 fs::create_directories(chainstateDir);
1532 }
catch (
const fs::filesystem_error&
error) {
1533 LogPrintf(
"Failed to delete blockchain folders %s\n",
error.what());
1537 LogPrintf(
"Aborted block database rebuild. Exiting.\n");
1541 return UIError(strLoadError);
1550 LogPrintf(
"Shutdown requested. Exiting.\n");
1554 fs::path est_path =
GetDataDir() / FEE_ESTIMATES_FILENAME;
1557 if (!est_filein.
IsNull())
1562 #ifdef ENABLE_WALLET
1563 if (fDisableWallet) {
1568 std::vector<CWalletTx> vWtx;
1584 uiInterface.
InitMessage(
_(
"Loading... Please do not interrupt this process as it could lead to a corrupt wallet."));
1588 bool fFirstRun =
true;
1593 strErrors <<
_(
"Error loading wallet.dat: Wallet corrupted") <<
"\n";
1595 std::string msg(
_(
"Warning: error reading wallet.dat! All keys read correctly, but transaction data"
1596 " or address book entries might be missing or incorrect."));
1599 strErrors <<
_(
"Error loading wallet.dat: Wallet requires newer version of PRCYcoin") <<
"\n";
1601 strErrors <<
_(
"Wallet needed to be rewritten: restart PRCY to complete") <<
"\n";
1603 return UIError(strErrors.str());
1605 strErrors <<
_(
"Error loading wallet.dat") <<
"\n";
1608 if (
GetBoolArg(
"-upgradewallet", fFirstRun)) {
1609 int nMaxVersion =
GetArg(
"-upgradewallet", 0);
1610 if (nMaxVersion == 0)
1613 nMaxVersion = CLIENT_VERSION;
1616 LogPrintf(
"Allowing wallet upgrade up to %i\n", nMaxVersion);
1617 if (nMaxVersion < pwalletMain->GetVersion())
1618 strErrors <<
_(
"Cannot downgrade wallet") <<
"\n";
1628 return UIError(
"deleteinterval must be greater than 0");
1632 return UIError(
"keeptxnum must be greater than 0");
1636 return UIError(
"keeptxfornblocks must be greater than 0");
1639 LogPrintf(
"keeptxfornblock is less than Params().COINBASE_MATURITY(), Setting to %i\n",
Params().COINBASE_MATURITY() + 1);
1660 strErrors <<
_(
"Cannot write default address") <<
"\n";
1677 LogPrintf(
"Running transaction reorder\n");
1678 int64_t maxOrderPos = 0;
1679 std::map<std::pair<int,int>,
CWalletTx*> mapSorted;
1708 return error(
"Shutdown requested over the txs scan. Exiting.");
1715 if (
GetBoolArg(
"-zapwallettxes",
false) &&
GetArg(
"-zapwallettxes",
"1") !=
"2") {
1738 #else // ENABLE_WALLET
1740 #endif // !ENABLE_WALLET
1751 fHaveGenesis =
true;
1754 if (
mapArgs.count(
"-blocknotify"))
1757 if (
mapArgs.count(
"-blocksizenotify"))
1763 strErrors <<
"Failed to connect best block";
1776 std::vector<fs::path> vImportFiles;
1777 if (
mapArgs.count(
"-loadblock")) {
1779 vImportFiles.push_back(strFile);
1781 threadGroup.create_thread(boost::bind(&
ThreadImport, vImportFiles));
1784 LogPrintf(
"Waiting for genesis block to be imported...\n");
1786 std::unique_lock<std::mutex> lockG(cs_GenesisWait);
1787 while (!fHaveGenesis) {
1788 condvar_GenesisWait.wait(lockG);
1800 LogPrintf(
"Missing masternode cache file - mncache.dat, will try to recreate\n");
1802 LogPrintf(
"Error reading mncache.dat: ");
1804 LogPrintf(
"magic is ok but data has invalid format, will try to recreate\n");
1806 LogPrintf(
"file format is unknown or invalid, please fix it manually\n");
1815 LogPrintf(
"Missing budget cache - budget.dat, will try to recreate\n");
1817 LogPrintf(
"Error reading budget.dat: ");
1819 LogPrintf(
"magic is ok but data has invalid format, will try to recreate\n");
1821 LogPrintf(
"file format is unknown or invalid, please fix it manually\n");
1835 LogPrintf(
"Missing masternode payment cache - mnpayments.dat, will try to recreate\n");
1837 LogPrintf(
"Error reading mnpayments.dat: ");
1839 LogPrintf(
"magic is ok but data has invalid format, will try to recreate\n");
1841 LogPrintf(
"file format is unknown or invalid, please fix it manually\n");
1847 return UIError(
"Enabling Masternode support requires turning on transaction indexing."
1848 "Please add txindex=1 to your configuration and start with -reindex");
1860 std::string strHost;
1865 if (nPort == 0) nPort = nDefaultPort;
1866 if (nPort != nDefaultPort) {
1867 return UIError(
strprintf(
_(
"Invalid -masternodeaddr port %d, only %d is supported on %s-net."),
1868 nPort, nDefaultPort,
Params().NetworkIDString()));
1878 std::string errorMessage;
1884 return UIError(
_(
"Invalid masternodeprivkey. Please see documenation."));
1890 return UIError(
_(
"You must specify a masternodeprivkey in the configuration. Please see documentation for help."));
1897 #ifdef ENABLE_WALLET
1900 LogPrintf(
"Locking Masternodes collateral utxo:\n");
1903 mnTxHash.
SetHex(mne.getTxHash());
1904 COutPoint outpoint =
COutPoint(mnTxHash, (
unsigned int) std::stoul(mne.getOutputIndex().c_str()));
1906 LogPrintf(
"Locked collateral, MN: %s, tx hash: %s, output index: %s\n",
1907 mne.getAlias(), mne.getTxHash(), mne.getOutputIndex());
1919 return UIError(
"You can not start a masternode in litemode");
1929 LogPrintf(
"Shutdown requested. Exiting.\n");
1935 if (!strErrors.str().empty())
1936 return UIError(strErrors.str());
1941 #ifdef ENABLE_WALLET
1947 if (
GetBoolArg(
"-listenonion", DEFAULT_LISTEN_ONION))
1952 #ifdef ENABLE_WALLET
1963 #ifdef ENABLE_WALLET
1964 bool storedStakingStatus =
false;
1975 LogPrintf(
"Autocombinedust is enabled\n");
1977 LogPrintf(
"Autocombinedust is disabled\n");
1981 if (
GetBoolArg(
"-staking",
false) || storedStakingStatus) {
1985 threadGroup.create_thread(boost::bind(&
TraceThread<
void (*)()>,
"stakemint", &ThreadStakeMinter));
1989 LogPrintf(
"Autoconsolidate is enabled and we are setting CombineMode::ON now\n");
1993 LogPrintf(
"Autoconsolidate is disabled\n");
2001 double reserveBalance;
bool StartHTTPRPC()
Start HTTP RPC subsystem.
bool ReadReserveAmount(double &amount)
void LockCoin(COutPoint &output)
void InitLogging()
Initialize the logging infrastructure.
FILE * OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly)
Open a block file (blk?????.dat)
A combination of a network address (CNetAddr) and a (TCP) port.
std::atomic< bool > fImporting
void AddTransactionsUpdated(unsigned int n)
CCoinsView backed by the LevelDB coin database (chainstate/)
static CFeeRate minTxFee
Fees smaller than this (in duffs) are considered zero fee (for transaction creation) We are ~100 time...
bool LookupSubNet(const char *pszName, CSubNet &ret)
CFeeRate minRelayTxFee
Fees smaller than this (in duffs) are considered zero fee (for relaying and mining) We are ~100 times...
void SplitHostPort(std::string in, int &portOut, std::string &hostOut)
VerifyResult
Verify that database file strFile is OK.
bool InitBlockIndex()
Initialize a new block tree database + block data on disk.
unsigned int fDeleteTransactionsAfterNBlocks
int64_t GetTime()
For unit testing.
std::map< uint256, CWalletTx > mapWallet
CActiveMasternode activeMasternode
Keep track of the active Masternode.
Signals for UI communication.
bool SoftSetBoolArg(const std::string &strArg, bool fValue)
Set a boolean argument if it doesn't already have a value.
int ScanForWalletTransactions(CBlockIndex *pindexStart, bool fUpdate=false, bool fromStartup=false, int height=-1)
Scan the block chain (starting in pindexStart) for transactions from or to us.
ReadResult Read(CMasternodePayments &objToLoad, bool fDryRun=false)
void FlushStateToDisk()
Flush all state, indexes and buffers to disk.
std::string HelpMessageGroup(const std::string &message)
Format a string to be used as group of options in help messages.
FILE * fopen(const fs::path &p, const char *mode)
std::string GetHex() const
void ThreadImport(std::vector< fs::path > vImportFiles)
bool AppInit2(bool isDaemon)
Initialize prcy.
void ThreadScriptCheck()
Run an instance of the script checking thread.
CChain chainActive
The currently-connected chain of blocks.
void Interrupt()
Interrupt threads.
bool GetKeyFromPool(CPubKey &key)
bool LoadBlockIndex(std::string &strError)
Load the block tree and coins database from disk.
bool fTxConflictDeleteEnabled
void DumpMasternodePayments()
std::map< std::string, std::string > mapArgs
std::string FormatSubVersion(const std::string &name, int nClientVersion, const std::vector< std::string > &comments)
Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip...
int nHeight
height of the entry in the chain. The genesis block has height 0
bool ReadFeeEstimates(CAutoFile &filein)
std::string HelpMessageOpt(const std::string &option, const std::string &message)
Format a string to be used as option description in help messages.
bool SetMaxVersion(int nVersion)
change which version we're allowed to upgrade to (note that this does not immediately imply upgrading...
void RegisterValidationInterface(CValidationInterface *pwalletIn)
Register a wallet to receive updates from core.
void InterruptTorControl()
int RaiseFileDescriptorLimit(int nMinFD)
this function tries to raise the file descriptor limit to the requested number.
bool ECC_InitSanityCheck()
Check that required EC support is available at runtime.
BCLog::Logger *const g_logger
NOTE: the logger instances is leaked on exit.
CBlockIndex * FindForkInGlobalIndex(const CChain &chain, const CBlockLocator &locator)
Find the last common block between the parameter chain and a locator.
BindFlags
Used to pass flags to the Bind() function.
bool AppInitBasicSetup()
Initialize PRCY: Basic context setup.
bool glibcxx_sanity_test()
std::string LicenseInfo()
Returns licensing information (for -version)
@ RPC_FORBIDDEN_BY_SAFE_MODE
std::exception thrown in command handling
ServiceFlags
nServices flags
boost::signals2::signal< void(int size, const uint256 &hash)> NotifyBlockSize
New block has been accepted and is over a certain size.
void StopREST()
Stop HTTP REST subsystem.
void InterruptHTTPRPC()
Interrupt HTTP RPC subsystem.
Save Masternode Payment Data (mnpayments.dat)
#define TRY_LOCK(cs, name)
void StartTorControl(boost::thread_group &threadGroup)
VerifyResult Verify(std::string strFile, bool(*recoverFunc)(CDBEnv &dbenv, std::string strFile))
bool Open(const fs::path &path)
bool SoftSetArg(const std::string &strArg, const std::string &strValue)
Set an argument if it doesn't already have a value.
std::string DateTimeStrFormat(const char *pszFormat, int64_t nTime)
std::string SanitizeString(const std::string &str, int rule)
Remove unsafe chars.
bool ReadScannedBlockHeight(int &height)
std::string FormatMoney(const CAmount &n, bool fPlus)
Money parsing/formatting utilities.
bool StartREST()
Start HTTP REST subsystem.
CCoinsViewErrorCatcher(CCoinsView *view)
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE)
Transaction fee set by the user.
Fee rate in PRCY per kilobyte: CAmount / kB.
int64_t DecoyConfirmationMinimum
unsigned int nTimeSmart
time received by this node
void UpdateWalletTransactionOrder(std::map< std::pair< int, int >, CWalletTx * > &mapSorted, bool resetOrder)
Update the nOrderPos with passed in ordered map.
Abstract view on the open txout dataset.
void const uint64_t uint64_t * r
bool SetAddressBook(const CTxDestination &address, const std::string &strName, const std::string &purpose)
void ThreadCheckMasternodes()
bool ActivateBestChain(CValidationState &state, CBlock *pblock, bool fAlreadyChecked)
Make the best chain active, in multiple steps.
Non-refcounted RAII wrapper for FILE*.
void SetBestChain(const CBlockLocator &loc)
std::string strMasterNodePrivKey
void AddOneShot(std::string strDest)
RecursiveMutex cs_main
Global state.
boost::signals2::signal< void(const std::string &message)> InitMessage
Progress message during initialization.
void PrepareShutdown()
Preparing steps before shutting down or restarting the wallet.
CBlockTreeDB * pblocktree
Global variable that points to the active block tree (protected by cs_main)
void SetRPCWarmupFinished()
void SetRPCWarmupStatus(const std::string &newStatus)
Set the RPC warmup status.
std::string strBudgetMode
void ThreadFlushWalletDB(const std::string &strFile)
static CZMQNotificationInterface * CreateWithArguments(const std::map< std::string, std::string > &args)
bool SetMinVersion(enum WalletFeature, CWalletDB *pwalletdbIn=NULL, bool fExplicit=false)
signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVe...
unsigned int nTimeReceived
CMasternodeMan mnodeman
Masternode manager.
volatile bool fRequestShutdown
std::string strMasterNodeAddr
int COINBASE_MATURITY() const
bool BindListenPort(const CService &addrBind, std::string &strError, bool fWhitelisted)
void UnloadBlockIndex()
Unload database information.
void RegisterNodeSignals(CNodeSignals &nodeSignals)
Register with a network node to receive its signals.
void GenerateNewHDChain(std::string *phrase=NULL)
const std::string DEFAULT_TOR_CONTROL
Default control port.
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a boost::optional result.
std::string GetWarnings(std::string strFor)
Format a string that describes several potential problems detected by the core.
const std::string CLIENT_NAME
boost::signals2::signal< bool(const std::string &message, const std::string &caption, unsigned int style), boost::signals2::last_value< bool > > ThreadSafeMessageBox
Show message box.
void OnStopped(boost::function< void()> slot)
bool RecalculatePRCYSupply(int nHeightStart)
fs::path AbsPathForConfigVal(const fs::path &path, bool net_specific)
std::condition_variable g_best_block_cv
void ThreadRename(std::string &&)
Rename a thread both in terms of an internal (in-memory) name as well as its system thread name.
void StopHTTPRPC()
Stop HTTP RPC subsystem.
std::string HelpMessage(HelpMessageMode mode)
Help for options shared between UI and daemon (for -help)
bool GetBoolArg(const std::string &strArg, bool fDefault)
Return boolean argument or default value.
#define PAIRTYPE(t1, t2)
This is needed because the foreach macro can't get over the comma in pair<t1, t2>
void setSanityCheck(bool _fSanityCheck)
Access to the wallet database (wallet.dat)
Access to the block database (blocks/index/)
UniValue JSONRPCError(int code, const std::string &message)
DBErrors LoadWallet(bool &fFirstRunRet)
int64_t CAmount
Amount in PRCY (Can be negative)
CCoinsViewCache * pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
CNodeSignals & GetNodeSignals()
void EnableCategory(LogFlags flag)
CMasternodePayments masternodePayments
Object for who's going to get paid on which blocks.
volatile bool fRestartRequested
std::atomic< bool > m_reopen_file
CTxMemPool mempool(::minRelayTxFee)
bool StartHTTPServer()
Start HTTP server.
void ReorderWalletTransactions(std::map< std::pair< int, int >, CWalletTx * > &mapSorted, int64_t &maxOrderPos)
Reorder the transactions based on block hieght and block index.
bool IsNull() const
Return true if the wrapped FILE* is NULL, false otherwise.
static void AddWhitelistedRange(const CSubNet &subnet)
void InitParameterInteraction()
Parameter interaction: change current parameters depending on various rules.
unsigned short GetListenPort()
std::vector< std::pair< std::string, std::string > > vOrderForm
256-bit unsigned big integer.
unsigned nMaxDatacarrierBytes
static void IncrementUpdateCounter()
uint64_t GetHash(const uint256 &salt) const
void SetHex(const char *psz)
bool GetCoins(const uint256 &txid, CCoins &coins) const
Retrieve the CCoins (unspent transaction outputs) for a given txid.
void Flush(bool fShutdown)
unsigned short GetPort() const
#define LogPrint(category,...)
std::string strFromAccount
void RandomInit()
Initialize the RNG.
uint256 GetBlockHash() const
bool ReadBestBlock(CBlockLocator &locator)
unsigned int fKeepLastNTransactions
int Height() const
Return the maximal height in the chain.
boost::function< void(void)> Function
static bool GetKeysFromSecret(const std::string &strSecret, CKey &keyRet, CPubKey &pubkeyRet)
Set the private/public key values, returns true if successful.
RAII wrapper for VerifyDB: Verify consistency of the block and coin databases.
int GetDefaultPort() const
void RPCNotifyBlockChange(bool fInitialDownload, const CBlockIndex *pindex)
fs::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix)
Translation to a filesystem path.
CMasternodeConfig masternodeConfig
bool GetCoins(const uint256 &txid, CCoins &coins) const
Retrieve the CCoins (unspent transaction outputs) for a given txid.
std::string ListLogCategories()
Returns a string with the supported log categories.
void OnStarted(boost::function< void()> slot)
bool WriteReindexing(bool fReindex)
void UnregisterAllValidationInterfaces()
Unregister all wallets from core.
void InitSignatureCache()
enum Network ParseNetwork(std::string net)
bool SetProxy(enum Network net, const proxyType &addrProxy)
std::string FormatParagraph(const std::string in, size_t width, size_t indent)
Format a paragraph of text to a fixed width, adding spaces for indentation to any added line.
bool WriteFlag(const std::string &name, bool fValue)
DBErrors
Error statuses for the wallet database.
bool WriteFeeEstimates(CAutoFile &fileout) const
Write/Read estimates to disk.
void CreatePidFile(const fs::path &path, pid_t pid)
fs::path GetDefaultDataDir()
std::string strSubVersion
Subversion as sent to the P2P network in version messages.
An encapsulated public key.
int64_t GetAdjustedTime()
bool DefaultShrinkDebugFile() const
CClientUIInterface uiInterface
bool SetNameProxy(const proxyType &addrProxy)
CBlockLocator GetLocator(const CBlockIndex *pindex=NULL) const
Return a CBlockLocator that refers to a block in this chain (by default the tip).
bool SetDefaultKey(const CPubKey &vchPubKey)
void HandleSIGTERM(int)
Signal handlers are very limited in what they are allowed to do, so:
void Shutdown()
Shutdown is split into 2 parts: Part 1: shut down everything but the main wallet instance (done in Pr...
An encapsulated private key.
CCoinsView that adds a memory cache for transactions to another CCoinsView.
bool LoadExternalBlockFile(FILE *fileIn, CDiskBlockPos *dbp)
Import blocks from an external file.
CCoinsView backed by another CCoinsView.
std::atomic< bool > fReindex
bool CheckDiskSpace(uint64_t nAdditionalBytes)
Check whether enough disk space is available for an incoming block.
std::set< int64_t > setKeyPool
@ SAFE_CHARS_UA_COMMENT
BIP-0014 subset.
HelpMessageMode
The help message mode determines what help message to show.
bool WriteToDisk(CWalletDB *pwalletdb)
ServiceFlags nLocalServices
bool InitSanityCheck(void)
Sanity checks Ensure that PRCY is running in a usable environment with all necessary library support.
void SetLimited(enum Network net, bool fLimited)
Make a particular network entirely off-limits (no automatic connects to it)
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
#define MIN_CORE_FILEDESCRIPTORS
void InterruptHTTPServer()
Interrupt HTTP server threads.
A transaction with a bunch of additional info that only the owner cares about.
bool IsLimited(enum Network net)
bool RenameOver(fs::path src, fs::path dest)
bool Random_SanityCheck()
Check that OS randomness is available and returning the requested number of bytes.
DBErrors ZapWalletTx(std::vector< CWalletTx > &vWtx)
CService LookupNumeric(const char *pszName, int portDefault)
const fs::path & GetDataDir(bool fNetSpecific)
const CChainParams & Params()
Return the currently selected parameters.
const char *const DEFAULT_DEBUGLOGFILE
Server/client environment: argument handling, config file parsing, thread wrappers.
void TraceThread(const char *name, Callable func)
void StartNode(boost::thread_group &threadGroup, CScheduler &scheduler)
boost::signals2::signal< void()> ShowRecoveryDialog
Show recovery dialog.
void InterruptREST()
Interrupt RPC REST subsystem.
static bool Recover(CDBEnv &dbenv, std::string filename, bool fOnlyKeys)
void UnregisterNodeSignals(CNodeSignals &nodeSignals)
Unregister a network node.
void runCommand(std::string strCommand)
QString dateTimeStr(const QDateTime &date)
void OnPreCommand(boost::function< void(const CRPCCommand &)> slot)
const std::string CURRENCY_UNIT
ReadResult Read(CBudgetManager &objToLoad, bool fDryRun=false)
An outpoint - a combination of a transaction hash and an index n into its vout.
bool(* handler)(HTTPRequest *req, const std::string &strReq)
CBlockIndex * Tip(bool fProofOfStake=false) const
Returns the index entry for the tip of this chain, or NULL if none.
void ReacceptWalletTransactions()
std::string FormatFullVersion()
boost::signals2::signal< void(bool fInitialDownload, const CBlockIndex *newTip)> NotifyBlockTip
New block has been accepted.
void UnregisterValidationInterface(CValidationInterface *pwalletIn)
Unregister a wallet from core.
bool WriteStakingStatus(bool status)
void DisableCategory(LogFlags flag)
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
std::map< std::string, std::vector< std::string > > mapMultiArgs
The block chain is a tree shaped structure starting with the genesis block at the root,...
void StopHTTPServer()
Stop HTTP server.
CAmount GetFeePerK() const
std::string GetArg(const std::string &strArg, const std::string &strDefault)
Return string argument or default value.
void OnRPCPreCommand(const CRPCCommand &cmd)
std::string strWalletFile
Capture information about block/transaction validation.
volatile bool fFeeEstimatesInitialized
Save Budget Manager (budget.dat)
CBlockIndex * Genesis() const
Returns the index entry for the genesis block of this chain, or NULL if none.
ReadResult Read(CMasternodeMan &mnodemanToLoad, bool fDryRun=false)
std::map< CTxDestination, CAddressBookData > mapAddressBook
static bool ParameterInteraction()
bool InitHTTPServer()
Initialize HTTP server.
bool error(const char *fmt, const Args &... args)
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
bool ParseMoney(const std::string &str, CAmount &nRet)
Access to the MN database (mncache.dat)
bool Lookup(const char *pszName, std::vector< CService > &vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
std::vector< CMasternodeEntry > & getEntries()
bool AddLocal(const CService &addr, int nScore)