17 #include <boost/filesystem.hpp>
18 #include <boost/filesystem/fstream.hpp>
19 #include <boost/filesystem/convenience.hpp>
20 #include <boost/interprocess/sync/file_lock.hpp>
21 #include <boost/algorithm/string/predicate.hpp>
22 #include <openssl/crypto.h>
29 using namespace boost;
38 #define MIN_CORE_FILEDESCRIPTORS 0
40 #define MIN_CORE_FILEDESCRIPTORS 150
84 fRequestShutdown =
true;
95 printf(
"Shutdown : In progress...\n");
98 if (!lockShutdown)
return;
117 delete pcoinsdbview; pcoinsdbview = NULL;
126 printf(
"Shutdown : done\n");
135 while (!fRequestShutdown)
138 if (fRequestShutdown)
139 threadGroup->interrupt_all();
145 fRequestShutdown =
true;
164 boost::thread_group threadGroup;
165 boost::thread* detectShutdownThread = NULL;
175 if (!boost::filesystem::is_directory(
GetDataDir(
false)))
177 fprintf(stderr,
"Error: Specified directory does not exist\n");
185 std::string strUsage =
_(
"Feathercoin version") +
" " +
FormatFullVersion() +
"\n\n" +
187 " feathercoind [options] " +
"\n" +
188 " feathercoind [options] <command> [params] " +
_(
"Send command to -server or feathercoind") +
"\n" +
189 " feathercoind [options] help " +
_(
"List commands") +
"\n" +
190 " feathercoind [options] help <command> " +
_(
"Get help for a command") +
"\n";
194 fprintf(stdout,
"%s", strUsage.c_str());
199 for (
int i = 1; i < argc; i++)
200 if (!
IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i],
"feathercoin:"))
216 fprintf(stderr,
"Error: fork() returned %d errno %d\n", pid, errno);
226 pid_t sid = setsid();
228 fprintf(stderr,
"Error: setsid() returned %d errno %d\n", sid, errno);
235 catch (std::exception& e) {
241 if (detectShutdownThread)
242 detectShutdownThread->interrupt();
243 threadGroup.interrupt_all();
246 if (detectShutdownThread)
248 detectShutdownThread->join();
249 delete detectShutdownThread;
250 detectShutdownThread = NULL;
258 int main(
int argc,
char* argv[])
270 return (fRet ? 0 : 1);
274 bool static InitError(
const std::string &str)
280 bool static InitWarning(
const std::string &str)
286 bool static Bind(
const CService &addr,
unsigned int flags) {
289 std::string strError;
292 return InitError(strError);
301 string strUsage =
_(
"Options:") +
"\n" +
302 " -? " +
_(
"This help message") +
"\n" +
303 " -conf=<file> " +
_(
"Specify configuration file (default: feathercoin.conf)") +
"\n" +
304 " -pid=<file> " +
_(
"Specify pid file (default: feathercoind.pid)") +
"\n" +
305 " -gen " +
_(
"Generate coins (default: 0)") +
"\n" +
306 " -datadir=<dir> " +
_(
"Specify data directory") +
"\n" +
307 " -dbcache=<n> " +
_(
"Set database cache size in megabytes (default: 25)") +
"\n" +
308 " -timeout=<n> " +
_(
"Specify connection timeout in milliseconds (default: 5000)") +
"\n" +
309 " -proxy=<ip:port> " +
_(
"Connect through socks proxy") +
"\n" +
310 " -socks=<n> " +
_(
"Select the version of socks proxy to use (4-5, default: 5)") +
"\n" +
311 " -tor=<ip:port> " +
_(
"Use proxy to reach tor hidden services (default: same as -proxy)") +
"\n"
312 " -dns " +
_(
"Allow DNS lookups for -addnode, -seednode and -connect") +
"\n" +
313 " -port=<port> " +
_(
"Listen for connections on <port> (default: 9336 or testnet: 19336)") +
"\n" +
314 " -maxconnections=<n> " +
_(
"Maintain at most <n> connections to peers (default: 125)") +
"\n" +
315 " -addnode=<ip> " +
_(
"Add a node to connect to and attempt to keep the connection open") +
"\n" +
316 " -connect=<ip> " +
_(
"Connect only to the specified node(s)") +
"\n" +
317 " -seednode=<ip> " +
_(
"Connect to a node to retrieve peer addresses, and disconnect") +
"\n" +
318 " -externalip=<ip> " +
_(
"Specify your own public address") +
"\n" +
319 " -onlynet=<net> " +
_(
"Only connect to nodes in network <net> (IPv4, IPv6 or Tor)") +
"\n" +
320 " -discover " +
_(
"Discover own IP address (default: 1 when listening and no -externalip)") +
"\n" +
321 " -checkpointenforce " +
_(
"Only accept block chain matching checkpoints issued by the Auto-Checkpoint systems Master Node (default: 1)") +
"\n" +
322 " -checkpoints " +
_(
"Only accept block chain matching built-in checkpoints (default: 1)") +
"\n" +
323 " -listen " +
_(
"Accept connections from outside (default: 1 if no -proxy or -connect)") +
"\n" +
324 " -bind=<addr> " +
_(
"Bind to given address and always listen on it. Use [host]:port notation for IPv6") +
"\n" +
325 " -dnsseed " +
_(
"Find peers using DNS lookup (default: 1 unless -connect)") +
"\n" +
326 " -banscore=<n> " +
_(
"Threshold for disconnecting misbehaving peers (default: 100)") +
"\n" +
327 " -bantime=<n> " +
_(
"Number of seconds to keep misbehaving peers from reconnecting (default: 86400)") +
"\n" +
328 " -maxreceivebuffer=<n> " +
_(
"Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)") +
"\n" +
329 " -maxsendbuffer=<n> " +
_(
"Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)") +
"\n" +
330 " -bloomfilters " +
_(
"Allow peers to set bloom filters (default: 1)") +
"\n" +
333 " -upnp " +
_(
"Use UPnP to map the listening port (default: 1 when listening)") +
"\n" +
335 " -upnp " +
_(
"Use UPnP to map the listening port (default: 0)") +
"\n" +
338 " -paytxfee=<amt> " +
_(
"Fee per KB to add to transactions you send") +
"\n" +
339 " -mininput=<amt> " +
_(
"When creating transactions, ignore inputs with value less than this (default: 0.0001)") +
"\n" +
341 " -server " +
_(
"Accept command line and JSON-RPC commands") +
"\n" +
343 #if !defined(WIN32) && !defined(QT_GUI)
344 " -daemon " +
_(
"Run in the background as a daemon and accept commands") +
"\n" +
346 " -testnet " +
_(
"Use the test network") +
"\n" +
347 " -debug " +
_(
"Output extra debugging information. Implies all other -debug* options") +
"\n" +
348 " -debugnet " +
_(
"Output extra network debugging information") +
"\n" +
349 " -logtimestamps " +
_(
"Prepend debug output with timestamp (default: 1)") +
"\n" +
350 " -shrinkdebugfile " +
_(
"Shrink debug.log file on client startup (default: 1 when no -debug)") +
"\n" +
351 " -printtoconsole " +
_(
"Send trace/debug info to console instead of debug.log file") +
"\n" +
353 " -printtodebugger " +
_(
"Send trace/debug info to debugger") +
"\n" +
355 " -rpcuser=<user> " +
_(
"Username for JSON-RPC connections") +
"\n" +
356 " -rpcpassword=<pw> " +
_(
"Password for JSON-RPC connections") +
"\n" +
357 " -rpcport=<port> " +
_(
"Listen for JSON-RPC connections on <port> (default: 9337 or testnet: 19337)") +
"\n" +
358 " -rpcallowip=<ip> " +
_(
"Allow JSON-RPC connections from specified IP address") +
"\n" +
360 " -rpcconnect=<ip> " +
_(
"Send commands to node running on <ip> (default: 127.0.0.1)") +
"\n" +
362 " -rpcthreads=<n> " +
_(
"Set the number of threads to service RPC calls (default: 4)") +
"\n" +
363 " -blocknotify=<cmd> " +
_(
"Execute command when the best block changes (%s in cmd is replaced by block hash)") +
"\n" +
364 " -walletnotify=<cmd> " +
_(
"Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") +
"\n" +
365 " -alertnotify=<cmd> " +
_(
"Execute command when a relevant alert is received (%s in cmd is replaced by message)") +
"\n" +
366 " -upgradewallet " +
_(
"Upgrade wallet to latest format") +
"\n" +
367 " -keypool=<n> " +
_(
"Set key pool size to <n> (default: 100)") +
"\n" +
368 " -rescan " +
_(
"Rescan the block chain for missing wallet transactions") +
"\n" +
369 " -salvagewallet " +
_(
"Attempt to recover private keys from a corrupt wallet.dat") +
"\n" +
370 " -checkblocks=<n> " +
_(
"How many blocks to check at startup (default: 288, 0 = all)") +
"\n" +
371 " -checklevel=<n> " +
_(
"How thorough the block verification is (0-4, default: 3)") +
"\n" +
372 " -txindex " +
_(
"Maintain a full transaction index (default: 0)") +
"\n" +
373 " -loadblock=<file> " +
_(
"Imports blocks from external blk000??.dat file") +
"\n" +
374 " -reindex " +
_(
"Rebuild block chain index from current blk000??.dat files") +
"\n" +
375 " -par=<n> " +
_(
"Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)") +
"\n" +
377 "\n" +
_(
"Block creation options:") +
"\n" +
378 " -blockminsize=<n> " +
_(
"Set minimum block size in bytes (default: 0)") +
"\n" +
379 " -blockmaxsize=<n> " +
_(
"Set maximum block size in bytes (default: 250000)") +
"\n" +
380 " -blockprioritysize=<n> " +
_(
"Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)") +
"\n" +
382 "\n" +
_(
"SSL options: (see the Feathercoin Wiki for SSL setup instructions)") +
"\n" +
383 " -rpcssl " +
_(
"Use OpenSSL (https) for JSON-RPC connections") +
"\n" +
384 " -rpcsslcertificatechainfile=<file.cert> " +
_(
"Server certificate file (default: server.cert)") +
"\n" +
385 " -rpcsslprivatekeyfile=<file.pem> " +
_(
"Server private key (default: server.pem)") +
"\n" +
386 " -rpcsslciphers=<ciphers> " +
_(
"Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)") +
"\n";
417 printf(
"Reindexing block file blk%05u.dat...\n", (
unsigned int)nFile);
423 printf(
"Reindexing finished\n");
429 filesystem::path pathBootstrap =
GetDataDir() /
"bootstrap.dat";
430 if (filesystem::exists(pathBootstrap)) {
431 FILE *file = fopen(pathBootstrap.string().c_str(),
"rb");
434 filesystem::path pathBootstrapOld =
GetDataDir() /
"bootstrap.dat.old";
435 printf(
"Importing bootstrap.dat...\n");
442 BOOST_FOREACH(boost::filesystem::path &path, vImportFiles) {
443 FILE *file = fopen(path.string().c_str(),
"rb");
446 printf(
"Importing %s...\n", path.string().c_str());
460 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
461 _CrtSetReportFile(_CRT_WARN, CreateFileA(
"NUL", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0));
465 _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
471 #ifndef PROCESS_DEP_ENABLE
474 #define PROCESS_DEP_ENABLE 0x00000001
476 typedef BOOL (WINAPI *PSETPROCDEPPOL)(DWORD);
477 PSETPROCDEPPOL setProcDEPPol = (PSETPROCDEPPOL)GetProcAddress(GetModuleHandleA(
"Kernel32.dll"),
"SetProcessDEPPolicy");
478 if (setProcDEPPol != NULL) setProcDEPPol(PROCESS_DEP_ENABLE);
482 int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
483 if (ret != NO_ERROR || LOBYTE(wsadata.wVersion ) != 2 || HIBYTE(wsadata.wVersion) != 2)
485 return InitError(
strprintf(
"Error: Winsock library failed to start (WSAStartup returned error %d)", ret));
494 sigemptyset(&sa.sa_mask);
496 sigaction(SIGTERM, &sa, NULL);
497 sigaction(SIGINT, &sa, NULL);
500 struct sigaction sa_hup;
502 sigemptyset(&sa_hup.sa_mask);
504 sigaction(SIGHUP, &sa_hup, NULL);
537 if (
mapArgs.count(
"-externalip")) {
548 int nBind = std::max((
int)
mapArgs.count(
"-bind"), 1);
553 return InitError(
_(
"Not enough file descriptors available."));
589 bool fDisableWallet =
GetBoolArg(
"-disablewallet",
false);
593 int nNewTimeout =
GetArg(
"-timeout", 5000);
594 if (nNewTimeout > 0 && nNewTimeout < 600000)
601 const char* pszP2SH =
"/P2SH/";
602 COINBASE_FLAGS << std::vector<unsigned char>(pszP2SH, pszP2SH+strlen(pszP2SH));
610 if (
mapArgs.count(
"-mintxfee"))
616 return InitError(
strprintf(
_(
"Invalid amount for -mintxfee=<amount>: '%s'"),
mapArgs[
"-mintxfee"].c_str()));
618 if (
mapArgs.count(
"-minrelaytxfee"))
624 return InitError(
strprintf(
_(
"Invalid amount for -minrelaytxfee=<amount>: '%s'"),
mapArgs[
"-minrelaytxfee"].c_str()));
627 if (
mapArgs.count(
"-paytxfee"))
630 return InitError(
strprintf(
_(
"Invalid amount for -paytxfee=<amount>: '%s'"),
mapArgs[
"-paytxfee"].c_str()));
632 InitWarning(
_(
"Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
635 if (
mapArgs.count(
"-mininput"))
638 return InitError(
strprintf(
_(
"Invalid amount for -mininput=<amount>: '%s'"),
mapArgs[
"-mininput"].c_str()));
641 if (
mapArgs.count(
"-checkpointkey"))
644 return InitError(
_(
"Unable to sign checkpoint, wrong checkpointkey?"));
649 std::string strDataDir =
GetDataDir().string();
652 boost::filesystem::path pathLockFile =
GetDataDir() /
".lock";
653 FILE* file = fopen(pathLockFile.string().c_str(),
"a");
654 if (file) fclose(file);
655 static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
656 if (!lock.try_lock())
657 return InitError(
strprintf(
_(
"Cannot obtain a lock on data directory %s. Feathercoin is probably already running."), strDataDir.c_str()));
661 printf(
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
663 printf(
"Using OpenSSL version %s\n", SSLeay_version(SSLEAY_VERSION));
667 printf(
"Using data directory %s\n", strDataDir.c_str());
668 printf(
"Using at most %i connections (%i file descriptors available)\n", nMaxConnections, nFD);
669 std::ostringstream strErrors;
672 fprintf(stdout,
"Feathercoin server starting\n");
682 #if defined(USE_SSE2)
683 scrypt_detect_sse2();
688 if (!fDisableWallet) {
694 boost::filesystem::path pathDatabase =
GetDataDir() /
"database";
697 boost::filesystem::rename(pathDatabase, pathDatabaseBak);
698 printf(
"Moved old %s to %s. Retrying.\n", pathDatabase.string().c_str(), pathDatabaseBak.string().c_str());
699 }
catch(boost::filesystem::filesystem_error &
error) {
706 string msg =
strprintf(
_(
"Error initializing wallet database environment %s!"), strDataDir.c_str());
707 return InitError(msg);
718 if (filesystem::exists(
GetDataDir() /
"wallet.dat"))
723 string msg =
strprintf(
_(
"Warning: wallet.dat corrupt, data salvaged!"
724 " Original wallet.dat saved as wallet.{timestamp}.bak in %s; if"
725 " your balance or transactions are incorrect you should"
726 " restore from a backup."), strDataDir.c_str());
730 return InitError(
_(
"wallet.dat corrupt, salvage failed"));
736 int nSocksVersion =
GetArg(
"-socks", 5);
737 if (nSocksVersion != 4 && nSocksVersion != 5)
738 return InitError(
strprintf(
_(
"Unknown -socks proxy version requested: %i"), nSocksVersion));
740 if (
mapArgs.count(
"-onlynet")) {
741 std::set<enum Network> nets;
742 BOOST_FOREACH(std::string snet,
mapMultiArgs[
"-onlynet"]) {
745 return InitError(
strprintf(
_(
"Unknown network specified in -onlynet: '%s'"), snet.c_str()));
748 for (
int n = 0; n <
NET_MAX; n++) {
750 if (!nets.count(net))
754 #if defined(USE_IPV6)
766 return InitError(
strprintf(
_(
"Invalid -proxy address: '%s'"),
mapArgs[
"-proxy"].c_str()));
770 if (nSocksVersion > 4) {
784 addrOnion = addrProxy;
788 return InitError(
strprintf(
_(
"Invalid -tor address: '%s'"),
mapArgs[
"-tor"].c_str()));
801 BOOST_FOREACH(std::string strBind,
mapMultiArgs[
"-bind"]) {
804 return InitError(
strprintf(
_(
"Cannot resolve -bind address: '%s'"), strBind.c_str()));
809 struct in_addr inaddr_any;
810 inaddr_any.s_addr = INADDR_ANY;
817 return InitError(
_(
"Failed to listen on any port. Use -listen=0 if you want this."));
820 if (
mapArgs.count(
"-externalip")) {
821 BOOST_FOREACH(
string strAddr,
mapMultiArgs[
"-externalip"]) {
824 return InitError(
strprintf(
_(
"Cannot resolve -externalip address: '%s'"), strAddr.c_str()));
829 BOOST_FOREACH(
string strDest,
mapMultiArgs[
"-seednode"])
837 filesystem::path blocksDir =
GetDataDir() /
"blocks";
838 if (!filesystem::exists(blocksDir))
840 filesystem::create_directories(blocksDir);
842 for (
unsigned int i = 1; i < 10000; i++) {
844 if (!filesystem::exists(source))
break;
845 filesystem::path dest = blocksDir /
strprintf(
"blk%05u.dat", i-1);
847 filesystem::create_hard_link(source, dest);
848 printf(
"Hardlinked %s -> %s\n", source.string().c_str(), dest.string().c_str());
850 }
catch (filesystem::filesystem_error & e) {
853 printf(
"Error hardlinking blk%04u.dat : %s\n", i, e.what());
864 size_t nTotalCache =
GetArg(
"-dbcache", 25) << 20;
865 if (nTotalCache < (1 << 22))
866 nTotalCache = (1 << 22);
867 size_t nBlockTreeDBCache = nTotalCache / 8;
868 if (nBlockTreeDBCache > (1 << 21) && !
GetBoolArg(
"-txindex",
false))
869 nBlockTreeDBCache = (1 << 21);
870 nTotalCache -= nBlockTreeDBCache;
871 size_t nCoinDBCache = nTotalCache / 2;
872 nTotalCache -= nCoinDBCache;
875 bool fLoaded =
false;
878 std::string strLoadError;
898 strLoadError =
_(
"Error loading block database");
905 return InitError(
_(
"Incorrect or no genesis block found. Wrong datadir for network?"));
909 strLoadError =
_(
"Error initializing block database");
915 strLoadError =
_(
"You need to rebuild the database using -reindex to change -txindex");
921 GetArg(
"-checkblocks", 288))) {
922 strLoadError =
_(
"Corrupted block database detected");
925 }
catch(std::exception &e) {
926 strLoadError =
_(
"Error opening block database");
937 strLoadError +
".\n\n" +
_(
"Do you want to rebuild the block database now?"),
941 fRequestShutdown =
false;
946 return InitError(strLoadError);
954 if (fRequestShutdown)
956 printf(
"Shutdown requested. Exiting.\n");
967 if (
mapArgs.count(
"-printblock"))
969 string strMatch =
mapArgs[
"-printblock"];
974 if (strncmp(hash.
ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0)
986 printf(
"No blocks matching %s were found\n", strMatch.c_str());
992 if (fDisableWallet) {
993 printf(
"Wallet disabled!\n");
999 bool fFirstRun =
true;
1000 pwalletMain =
new CWallet(
"wallet.dat");
1005 strErrors <<
_(
"Error loading wallet.dat: Wallet corrupted") <<
"\n";
1008 string msg(
_(
"Warning: error reading wallet.dat! All keys read correctly, but transaction data"
1009 " or address book entries might be missing or incorrect."));
1013 strErrors <<
_(
"Error loading wallet.dat: Wallet requires newer version of Feathercoin") <<
"\n";
1016 strErrors <<
_(
"Wallet needed to be rewritten: restart Feathercoin to complete") <<
"\n";
1017 printf(
"%s", strErrors.str().c_str());
1018 return InitError(strErrors.str());
1021 strErrors <<
_(
"Error loading wallet.dat") <<
"\n";
1026 int nMaxVersion =
GetArg(
"-upgradewallet", 0);
1027 if (nMaxVersion == 0)
1030 nMaxVersion = CLIENT_VERSION;
1034 printf(
"Allowing wallet upgrade up to %i\n", nMaxVersion);
1035 if (nMaxVersion < pwalletMain->GetVersion())
1036 strErrors <<
_(
"Cannot downgrade wallet") <<
"\n";
1049 strErrors <<
_(
"Cannot write default address") <<
"\n";
1055 printf(
"%s", strErrors.str().c_str());
1089 strErrors <<
"Failed to connect best block";
1091 std::vector<boost::filesystem::path> vImportFiles;
1092 if (
mapArgs.count(
"-loadblock"))
1094 BOOST_FOREACH(
string strFile,
mapMultiArgs[
"-loadblock"])
1095 vImportFiles.push_back(strFile);
1097 threadGroup.create_thread(boost::bind(&
ThreadImport, vImportFiles));
1108 printf(
"Invalid or missing peers.dat; recreating\n");
1111 printf(
"Loaded %i addresses from peers.dat %"PRI64d"ms\n",
1119 if (!strErrors.str().empty())
1120 return InitError(strErrors.str());
bool error(const char *format,...)
const boost::filesystem::path & GetDataDir(bool fNetSpecific)
unsigned int nWalletDBUpdated
void SetReachable(enum Network net, bool fFlag)
void GenerateBitcoins(bool fGenerate, CWallet *pwallet)
Run the miner threads.
Access to the (IP) address database (peers.dat)
#define strprintf(format,...)
void AddOneShot(string strDest)
FILE * OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly)
Open a block file (blk?????.dat)
bool AddLocal(const CService &addr, int nScore)
#define TRY_LOCK(cs, name)
void CreatePidFile(const boost::filesystem::path &path, pid_t pid)
bool SoftSetBoolArg(const std::string &strArg, bool fValue)
Set a boolean argument if it doesn't already have a value.
void UnregisterWallet(CWallet *pwalletIn)
Unregister a wallet from core.
boost::filesystem::path GetPidFile()
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
void ThreadScriptCheck()
Run an instance of the script checking thread.
void SetLimited(enum Network net, bool fLimited)
Make a particular network entirely off-limits (no automatic connects to it)
bool VerifyDB(int nCheckLevel, int nCheckDepth)
Verify consistency of the block and coin databases.
void Flush(bool fShutdown)
unsigned short GetListenPort()
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest)
bool SetMaxVersion(int nVersion)
DBErrors
Error statuses for the wallet database.
void RandAddSeedPerfmon()
int CommandLineRPC(int argc, char *argv[])
void ReacceptWalletTransactions()
Signals for UI communication.
void RenameThread(const char *name)
bool SetDefaultKey(const CPubKey &vchPubKey)
volatile bool fReopenDebugLog
bool CheckDiskSpace(uint64 nAdditionalBytes)
Check whether enough disk space is available for an incoming block.
void PrintBlockTree()
Print the loaded block tree.
bool SetAddressBookName(const CTxDestination &address, const std::string &strName)
void SetBestChain(const CBlockLocator &loc)
int RaiseFileDescriptorLimit(int nMinFD)
static int64 nMinTxFee
Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) ...
uint256 BuildMerkleTree() const
bool SetMinVersion(enum WalletFeature, CWalletDB *pwalletdbIn=NULL, bool fExplicit=false)
CBlockTreeDB * pblocktree
Global variable that points to the active block tree (protected by cs_main)
enum Network ParseNetwork(std::string net)
bool GetBoolArg(const std::string &strArg, bool fDefault)
Return boolean argument or default value.
Access to the block database (blocks/index/)
volatile bool fRequestShutdown
void UnloadBlockIndex()
Unload database information.
CBlockIndex * GetBlockIndex()
A combination of a network address (CNetAddr) and a (TCP) port.
An encapsulated public key.
CClientUIInterface uiInterface
bool AppInit(int argc, char *argv[])
bool AppInit2(boost::thread_group &threadGroup)
Initialize bitcoin.
bool LoadBlockIndex()
Load the block tree and coins database from disk.
bool SetNameProxy(CService addrProxy, int nSocksVersion)
void PrintExceptionContinue(std::exception *pex, const char *pszThread)
std::string DateTimeStrFormat(const char *pszFormat, int64 nTime)
CCoinsViewCache * pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
void ParseParameters(int argc, const char *const argv[])
bool ConnectBestBlock(CValidationState &state)
Find the best known block, and make it the tip of the block chain.
Access to the wallet database (wallet.dat)
void ThreadImport(std::vector< boost::filesystem::path > vImportFiles)
void DetectShutdownThread(boost::thread_group *threadGroup)
std::string strWalletFile
bool ReadBestBlock(CBlockLocator &locator)
Capture information about block/transaction validation.
CBlockIndex * pindexGenesisBlock
std::set< int64 > setKeyPool
int main(int argc, char *argv[])
bool BindListenPort(const CService &addrBind, string &strError)
bool IsSwitchChar(char c)
void ReadConfigFile(map< string, string > &mapSettingsRet, map< string, vector< string > > &mapMultiSettingsRet)
int ScanForWalletTransactions(CBlockIndex *pindexStart, bool fUpdate=false)
The block chain is a tree shaped structure starting with the genesis block at the root...
unsigned int nCoinCacheSize
std::string ToString() const
CCoinsView backed by the LevelDB coin database (chainstate/)
string FormatFullVersion()
static bool Recover(CDBEnv &dbenv, std::string filename, bool fOnlyKeys)
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a boost::optional result...
bool Lookup(const char *pszName, std::vector< CService > &vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
bool GetKeyFromPool(CPubKey &key, bool fAllowReuse=true)
void RegisterWallet(CWallet *pwalletIn)
Register a wallet to receive updates from core.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
unsigned int nTransactionsUpdated
VerifyResult Verify(std::string strFile, bool(*recoverFunc)(CDBEnv &dbenv, std::string strFile))
bool WriteReindexing(bool fReindex)
std::map< CTxDestination, std::string > mapAddressBook
std::map< uint256, CWalletTx > mapWallet
boost::signals2::signal< bool(const std::string &message, const std::string &caption, unsigned int style), boost::signals2::last_value< bool > > ThreadSafeMessageBox
Show message box.
DBErrors LoadWallet(bool &fFirstRunRet)
std::string GetArg(const std::string &strArg, const std::string &strDefault)
Return string argument or default value.
bool ParseMoney(const string &str, int64 &nRet)
bool LoadExternalBlockFile(FILE *fileIn, CDiskBlockPos *dbp)
Import blocks from an external file.
std::string HelpMessage()
CCoinsView that adds a memory cache for transactions to another CCoinsView.
#define MIN_CORE_FILEDESCRIPTORS
bool InitBlockIndex()
Initialize a new block tree database + block data on disk.
map< string, vector< string > > mapMultiArgs
bool ReadFromDisk(const CDiskBlockPos &pos)
bool Open(const boost::filesystem::path &path)
map< uint256, CBlockIndex * > mapBlockIndex
static int64 nMinRelayTxFee
Fees smaller than this (in satoshi) are considered zero fee (for relaying)
bool Read(CAddrMan &addr)
void ThreadFlushWalletDB(const std::string &strWalletFile)
bool IsLimited(enum Network net)
const std::string CLIENT_DATE
boost::signals2::signal< void(const std::string &message)> InitMessage
Progress message during initialization.
void StartNode(boost::thread_group &threadGroup)
map< string, string > mapArgs
bool SetProxy(enum Network net, CService addrProxy, int nSocksVersion)
bool SetCheckpointPrivKey(std::string strPrivKey)
boost::filesystem::path GetDefaultDataDir()