From 783b182c8fa92674fa609b584c0b187469893ca4 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 6 May 2014 15:25:01 +0200 Subject: Remove dummy PRIszX macros for formatting Size specifiers are no longer needed now that we use typesafe tinyformat for string formatting, instead of the system's sprintf. No functional changes. This continues the work in #3735. --- src/init.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 77c32d0b49..821ac4c875 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1078,12 +1078,12 @@ bool AppInit2(boost::thread_group& threadGroup) RandAddSeedPerfmon(); //// debug print - LogPrintf("mapBlockIndex.size() = %"PRIszu"\n", mapBlockIndex.size()); + LogPrintf("mapBlockIndex.size() = %u\n", mapBlockIndex.size()); LogPrintf("nBestHeight = %d\n", chainActive.Height()); #ifdef ENABLE_WALLET - LogPrintf("setKeyPool.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0); - LogPrintf("mapWallet.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapWallet.size() : 0); - LogPrintf("mapAddressBook.size() = %"PRIszu"\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); + LogPrintf("setKeyPool.size() = %u\n", pwalletMain ? pwalletMain->setKeyPool.size() : 0); + LogPrintf("mapWallet.size() = %u\n", pwalletMain ? pwalletMain->mapWallet.size() : 0); + LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); #endif StartNode(threadGroup); -- cgit v1.2.3 From 283e405c063acfca304acbff505badcbbcb814c9 Mon Sep 17 00:00:00 2001 From: shshshsh Date: Sun, 11 May 2014 13:29:16 +0000 Subject: Switch stdout to line buffering Use line buffering (instead of block buffering) so that messages arrive immediately in systemd-journald, tail -f debug.log, and the like. --- src/init.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 77c32d0b49..2c3bb02758 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -25,6 +25,7 @@ #endif #include +#include #ifndef WIN32 #include @@ -530,6 +531,7 @@ bool AppInit2(boost::thread_group& threadGroup) fServer = GetBoolArg("-server", false); fPrintToConsole = GetBoolArg("-printtoconsole", false); fLogTimestamps = GetBoolArg("-logtimestamps", true); + setvbuf(stdout, NULL, _IOLBF, 0); #ifdef ENABLE_WALLET bool fDisableWallet = GetBoolArg("-disablewallet", false); #endif -- cgit v1.2.3 From deb3572ab160221124dfa3e9c5c4e493529f59e4 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 17 Feb 2014 17:35:40 +0100 Subject: Add -rpcbind option to allow binding RPC port on a specific interface Add -rpcbind command option to specify binding RPC service on one or multiple specific interfaces. Functionality if -rpcbind is not specified remains the same as before: - If no -rpcallowip specified, bind on localhost - If no -rpcbind specified, bind on any interface Implements part of #3111. --- src/init.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 7007707855..7664988762 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -304,10 +304,11 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += "\n" + _("RPC server options:") + "\n"; strUsage += " -server " + _("Accept command line and JSON-RPC commands") + "\n"; + strUsage += " -rpcbind= " + _("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)") + "\n"; strUsage += " -rpcuser= " + _("Username for JSON-RPC connections") + "\n"; strUsage += " -rpcpassword= " + _("Password for JSON-RPC connections") + "\n"; strUsage += " -rpcport= " + _("Listen for JSON-RPC connections on (default: 8332 or testnet: 18332)") + "\n"; - strUsage += " -rpcallowip= " + _("Allow JSON-RPC connections from specified IP address") + "\n"; + strUsage += " -rpcallowip= " + _("Allow JSON-RPC connections from specified IP address. This option can be specified multiple times") + "\n"; strUsage += " -rpcthreads= " + _("Set the number of threads to service RPC calls (default: 4)") + "\n"; strUsage += "\n" + _("RPC SSL options: (see the Bitcoin Wiki for SSL setup instructions)") + "\n"; -- cgit v1.2.3 From 79d06dc6e07103b31b530f71b7187ea82c34266b Mon Sep 17 00:00:00 2001 From: R E Broadley Date: Wed, 21 May 2014 18:50:46 +0800 Subject: Remove redundant c_str --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 7664988762..bc4924b48d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -914,7 +914,7 @@ bool AppInit2(boost::thread_group& threadGroup) for (map::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi) { uint256 hash = (*mi).first; - if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0) + if (boost::algorithm::starts_with(hash.ToString(), strMatch)) { CBlockIndex* pindex = (*mi).second; CBlock block; -- cgit v1.2.3 From 53a088154ce4e1fc483afa120a9063811dd0e7ea Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Thu, 29 May 2014 12:33:17 +0200 Subject: rename fNoListen to fListen and move to net - better code readability and it belongs to net - this is a prerequisite for a pull to add -listen to the GUI --- src/init.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index bc4924b48d..06ad84af25 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -732,12 +732,12 @@ bool AppInit2(boost::thread_group& threadGroup) } // see Step 2: parameter interactions for more information about these - fNoListen = !GetBoolArg("-listen", true); + fListen = GetBoolArg("-listen", true); fDiscover = GetBoolArg("-discover", true); fNameLookup = GetBoolArg("-dns", true); bool fBound = false; - if (!fNoListen) { + if (fListen) { if (mapArgs.count("-bind")) { BOOST_FOREACH(std::string strBind, mapMultiArgs["-bind"]) { CService addrBind; -- cgit v1.2.3 From 06a91d9698762fe56fca3bd33484bddc9f020405 Mon Sep 17 00:00:00 2001 From: Cozz Lovan Date: Fri, 23 May 2014 18:04:09 +0200 Subject: VerifyDB progress --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index bc4924b48d..840a07d610 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -858,7 +858,7 @@ bool AppInit2(boost::thread_group& threadGroup) } uiInterface.InitMessage(_("Verifying blocks...")); - if (!VerifyDB(GetArg("-checklevel", 3), + if (!CVerifyDB().VerifyDB(GetArg("-checklevel", 3), GetArg("-checkblocks", 288))) { strLoadError = _("Corrupted block database detected"); break; -- cgit v1.2.3 From 4a09e1df51267c6d2dec219c6f96a24b716cc251 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Mon, 2 Jun 2014 16:21:03 -0700 Subject: key.cpp: fail with a friendlier message on missing ssl EC support Previously if bitcoind is linked with an OpenSSL which is compiled without EC support, this is seen as an assertion failure "pKey != NULL" at key.cpp:134, which occurs after several seconds. It is an esoteric piece of knowledge to interpret this as "oops, I linked with the wrong OpenSSL", and because of the delay it may not even be noticed. The new output is : OpenSSL appears to lack support for elliptic curve cryptography. For more information, visit https://en.bitcoin.it/wiki/OpenSSL_and_EC_Libraries : Initialization sanity check failed. Bitcoin Core is shutting down. which occurs immediately after attempted startup. This also blocks in an InitSanityCheck() function which currently only checks for EC support but should eventually do more. See #4081. --- src/init.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index bc4924b48d..b66231ff2c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -11,6 +11,7 @@ #include "addrman.h" #include "checkpoints.h" +#include "key.h" #include "main.h" #include "miner.h" #include "net.h" @@ -385,6 +386,23 @@ void ThreadImport(std::vector vImportFiles) } } +/** Sanity checks + * Ensure that Bitcoin is running in a usable environment with all + * necessary library support. + */ +bool InitSanityCheck(void) +{ + if(!ECC_InitSanityCheck()) { + InitError("OpenSSL appears to lack support for elliptic curve cryptography. For more " + "information, visit https://en.bitcoin.it/wiki/OpenSSL_and_EC_Libraries"); + return false; + } + + // TODO: remaining sanity checks, see #4081 + + return true; +} + /** Initialize bitcoin. * @pre Parameters should be parsed and config file should be read. */ @@ -586,6 +604,9 @@ bool AppInit2(boost::thread_group& threadGroup) strWalletFile = GetArg("-wallet", "wallet.dat"); #endif // ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log + // Sanity check + if (!InitSanityCheck()) + return InitError(_("Initialization sanity check failed. Bitcoin Core is shutting down.")); std::string strDataDir = GetDataDir().string(); #ifdef ENABLE_WALLET -- cgit v1.2.3 From cb9bd83bba86e73e3720110ce47600b6f895573c Mon Sep 17 00:00:00 2001 From: jtimon Date: Sun, 9 Mar 2014 18:35:41 -0700 Subject: Add DefaultCheckMemPool chain parameter --- src/init.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 840a07d610..a225c3f964 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -517,7 +517,8 @@ bool AppInit2(boost::thread_group& threadGroup) InitWarning(_("Warning: Deprecated argument -debugnet ignored, use -debug=net")); fBenchmark = GetBoolArg("-benchmark", false); - mempool.setSanityCheck(GetBoolArg("-checkmempool", RegTest())); + // Checkmempool defaults to true in regtest mode + mempool.setSanityCheck(GetBoolArg("-checkmempool", Params().DefaultCheckMemPool())); Checkpoints::fEnabled = GetBoolArg("-checkpoints", true); // -par=0 means autodetect, but nScriptCheckThreads==0 means no concurrency -- cgit v1.2.3 From 7b45d943b29a443f1ac808c9ee4eeed6df0db9cc Mon Sep 17 00:00:00 2001 From: shshshsh Date: Fri, 30 May 2014 12:35:23 +0000 Subject: Make max number of orphan blocks kept in memory a startup parameter (fixes #4253) --- src/init.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index bc4924b48d..995f2700cf 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -206,6 +206,7 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " -dbcache= " + strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache) + "\n"; strUsage += " -keypool= " + _("Set key pool size to (default: 100)") + "\n"; strUsage += " -loadblock= " + _("Imports blocks from external blk000??.dat file") + " " + _("on startup") + "\n"; + strUsage += " -maxorphanblocks= " + strprintf(_("Keep at most unconnectable blocks in memory (default: %u)"), DEFAULT_MAX_ORPHAN_BLOCKS) + "\n"; strUsage += " -par= " + 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) + "\n"; strUsage += " -pid= " + _("Specify pid file (default: bitcoind.pid)") + "\n"; strUsage += " -reindex " + _("Rebuild block chain index from current blk000??.dat files") + " " + _("on startup") + "\n"; -- cgit v1.2.3 From 5bd02cf715dcb44cfc797c0d1fb94b80350b6489 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Wed, 4 Jun 2014 21:19:22 +0200 Subject: log used config file to debug.log on startup --- src/init.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 6a21dee634..96f7f7b3c8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -614,6 +614,7 @@ bool AppInit2(boost::thread_group& threadGroup) LogPrintf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime())); LogPrintf("Default data directory %s\n", GetDefaultDataDir().string()); LogPrintf("Using data directory %s\n", strDataDir); + LogPrintf("Using config file %s\n", GetConfigFile().string()); LogPrintf("Using at most %i connections (%i file descriptors available)\n", nMaxConnections, nFD); std::ostringstream strErrors; -- cgit v1.2.3 From 7d4dda7630a67ae1aacfc799ed743e69562a41df Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 5 Jun 2014 14:52:07 +0200 Subject: Remove global strWalletFile As it says on the tin. There is no need to have this variable be global, it's only used in AppInit2. --- src/init.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 96f7f7b3c8..d924bd293b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -40,7 +40,6 @@ using namespace std; using namespace boost; #ifdef ENABLE_WALLET -std::string strWalletFile; CWallet* pwalletMain; #endif @@ -584,7 +583,7 @@ bool AppInit2(boost::thread_group& threadGroup) } bSpendZeroConfChange = GetArg("-spendzeroconfchange", true); - strWalletFile = GetArg("-wallet", "wallet.dat"); + std::string strWalletFile = GetArg("-wallet", "wallet.dat"); #endif // ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log -- cgit v1.2.3 From c6cb21d17ab8097b6a425d37e48c955fbb0e9f0c Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 10 Apr 2014 14:14:18 -0400 Subject: Type-safe CFeeRate class Use CFeeRate instead of an int64_t for quantities that are fee-per-size. Helps prevent unit-conversion mismatches between the wallet, relaying, and mining code. --- src/init.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index d924bd293b..1aad679b3b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -281,8 +281,8 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " -limitfreerelay= " + _("Continuously rate-limit free transactions to *1000 bytes per minute (default:15)") + "\n"; strUsage += " -maxsigcachesize= " + _("Limit size of signature cache to entries (default: 50000)") + "\n"; } - strUsage += " -mintxfee= " + _("Fees smaller than this are considered zero fee (for transaction creation) (default:") + " " + FormatMoney(CTransaction::nMinTxFee) + ")" + "\n"; - strUsage += " -minrelaytxfee= " + _("Fees smaller than this are considered zero fee (for relaying) (default:") + " " + FormatMoney(CTransaction::nMinRelayTxFee) + ")" + "\n"; + strUsage += " -mintxfee= " + _("Fees smaller than this are considered zero fee (for transaction creation) (default:") + " " + FormatMoney(CTransaction::minTxFee.GetFeePerK()) + ")" + "\n"; + strUsage += " -minrelaytxfee= " + _("Fees smaller than this are considered zero fee (for relaying) (default:") + " " + FormatMoney(CTransaction::minRelayTxFee.GetFeePerK()) + ")" + "\n"; strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n"; if (GetBoolArg("-help-debug", false)) { @@ -560,7 +560,7 @@ bool AppInit2(boost::thread_group& threadGroup) { int64_t n = 0; if (ParseMoney(mapArgs["-mintxfee"], n) && n > 0) - CTransaction::nMinTxFee = n; + CTransaction::minTxFee = CFeeRate(n); else return InitError(strprintf(_("Invalid amount for -mintxfee=: '%s'"), mapArgs["-mintxfee"])); } @@ -568,7 +568,7 @@ bool AppInit2(boost::thread_group& threadGroup) { int64_t n = 0; if (ParseMoney(mapArgs["-minrelaytxfee"], n) && n > 0) - CTransaction::nMinRelayTxFee = n; + CTransaction::minRelayTxFee = CFeeRate(n); else return InitError(strprintf(_("Invalid amount for -minrelaytxfee=: '%s'"), mapArgs["-minrelaytxfee"])); } @@ -576,10 +576,12 @@ bool AppInit2(boost::thread_group& threadGroup) #ifdef ENABLE_WALLET if (mapArgs.count("-paytxfee")) { - if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee)) + int64_t nFeePerK = 0; + if (!ParseMoney(mapArgs["-paytxfee"], nFeePerK)) return InitError(strprintf(_("Invalid amount for -paytxfee=: '%s'"), mapArgs["-paytxfee"])); - if (nTransactionFee > nHighTransactionFeeWarning) + if (nFeePerK > nHighTransactionFeeWarning) InitWarning(_("Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.")); + payTxFee = CFeeRate(nFeePerK, 1000); } bSpendZeroConfChange = GetArg("-spendzeroconfchange", true); -- cgit v1.2.3 From 171ca7745e77c9f78f26556457fe64e5b2004a75 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Mon, 17 Mar 2014 08:19:54 -0400 Subject: estimatefee / estimatepriority RPC methods New RPC methods: return an estimate of the fee (or priority) a transaction needs to be likely to confirm in a given number of blocks. Mike Hearn created the first version of this method for estimating fees. It works as follows: For transactions that took 1 to N (I picked N=25) blocks to confirm, keep N buckets with at most 100 entries in each recording the fees-per-kilobyte paid by those transactions. (separate buckets are kept for transactions that confirmed because they are high-priority) The buckets are filled as blocks are found, and are saved/restored in a new fee_estiamtes.dat file in the data directory. A few variations on Mike's initial scheme: To estimate the fee needed for a transaction to confirm in X buckets, all of the samples in all of the buckets are used and a median of all of the data is used to make the estimate. For example, imagine 25 buckets each containing the full 100 entries. Those 2,500 samples are sorted, and the estimate of the fee needed to confirm in the very next block is the 50'th-highest-fee-entry in that sorted list; the estimate of the fee needed to confirm in the next two blocks is the 150'th-highest-fee-entry, etc. That algorithm has the nice property that estimates of how much fee you need to pay to get confirmed in block N will always be greater than or equal to the estimate for block N+1. It would clearly be wrong to say "pay 11 uBTC and you'll get confirmed in 3 blocks, but pay 12 uBTC and it will take LONGER". A single block will not contribute more than 10 entries to any one bucket, so a single miner and a large block cannot overwhelm the estimates. --- src/init.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 1aad679b3b..aca5e0c9aa 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -59,6 +59,7 @@ enum BindFlags { BF_REPORT_ERROR = (1U << 1) }; +static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat"; ////////////////////////////////////////////////////////////////////////////// // @@ -121,6 +122,14 @@ void Shutdown() #endif StopNode(); UnregisterNodeSignals(GetNodeSignals()); + + boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; + CAutoFile est_fileout = CAutoFile(fopen(est_path.string().c_str(), "wb"), SER_DISK, CLIENT_VERSION); + if (est_fileout) + mempool.WriteFeeEstimates(est_fileout); + else + LogPrintf("failed to write fee estimates"); + { LOCK(cs_main); #ifdef ENABLE_WALLET @@ -933,6 +942,11 @@ bool AppInit2(boost::thread_group& threadGroup) return false; } + boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; + CAutoFile est_filein = CAutoFile(fopen(est_path.string().c_str(), "rb"), SER_DISK, CLIENT_VERSION); + if (est_filein) + mempool.ReadFeeEstimates(est_filein); + // ********************************************************* Step 8: load wallet #ifdef ENABLE_WALLET if (fDisableWallet) { -- cgit v1.2.3 From 56b07d2dcdec336173b866210c535439b03416a1 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Thu, 29 May 2014 13:02:22 +0200 Subject: [Qt] allow setting listen via GUI - add DEFAULT_LISTEN in net.h and use in the code (shared setting between core and GUI) Important: This makes it obvious, that we need to re-think the settings/options handling, as GUI settings are processed before any parameter-interaction (which is mostly important for network stuff) in AppInit2()! --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 1d86cf087d..528c3df064 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -766,7 +766,7 @@ bool AppInit2(boost::thread_group& threadGroup) } // see Step 2: parameter interactions for more information about these - fListen = GetBoolArg("-listen", true); + fListen = GetBoolArg("-listen", DEFAULT_LISTEN); fDiscover = GetBoolArg("-discover", true); fNameLookup = GetBoolArg("-dns", true); -- cgit v1.2.3 From 4aaa01783d4e3592db456fb2db05207c3c278244 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Wed, 11 Jun 2014 12:16:26 +0200 Subject: rework help messages for fee-related options - mention the units and show the default for -paytxfee --- src/init.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 1d86cf087d..b85078832f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -253,7 +253,7 @@ std::string HelpMessage(HelpMessageMode hmm) #ifdef ENABLE_WALLET strUsage += "\n" + _("Wallet options:") + "\n"; strUsage += " -disablewallet " + _("Do not load the wallet and disable wallet RPC calls") + "\n"; - strUsage += " -paytxfee= " + _("Fee per kB to add to transactions you send") + "\n"; + strUsage += " -paytxfee= " + strprintf(_("Fee (in BTC/kB) to add to transactions you send (default: %s)"), FormatMoney(payTxFee.GetFeePerK())) + "\n"; strUsage += " -rescan " + _("Rescan the block chain for missing wallet transactions") + " " + _("on startup") + "\n"; strUsage += " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup") + "\n"; strUsage += " -spendzeroconfchange " + _("Spend unconfirmed change when sending transactions (default: 1)") + "\n"; @@ -291,8 +291,8 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " -limitfreerelay= " + _("Continuously rate-limit free transactions to *1000 bytes per minute (default:15)") + "\n"; strUsage += " -maxsigcachesize= " + _("Limit size of signature cache to entries (default: 50000)") + "\n"; } - strUsage += " -mintxfee= " + _("Fees smaller than this are considered zero fee (for transaction creation) (default:") + " " + FormatMoney(CTransaction::minTxFee.GetFeePerK()) + ")" + "\n"; - strUsage += " -minrelaytxfee= " + _("Fees smaller than this are considered zero fee (for relaying) (default:") + " " + FormatMoney(CTransaction::minRelayTxFee.GetFeePerK()) + ")" + "\n"; + strUsage += " -mintxfee= " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)"), FormatMoney(CTransaction::minTxFee.GetFeePerK())) + "\n"; + strUsage += " -minrelaytxfee= " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for relaying (default: %s)"), FormatMoney(CTransaction::minRelayTxFee.GetFeePerK())) + "\n"; strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n"; if (GetBoolArg("-help-debug", false)) { -- cgit v1.2.3 From 45615af26fe374fa996c116984a05f0a632a0e79 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 10 Jun 2014 16:02:46 +0200 Subject: Add 'about' information to `-version` output Adds a copyright and attribution message to the `-version` output (the same as shown in the About dialog in the GUI). Move the message to a function LicenseInfo in init.cpp. --- src/init.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 528c3df064..39453da9c8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -195,7 +195,6 @@ bool static Bind(const CService &addr, unsigned int flags) { return true; } -// Core-specific options shared between UI, daemon and RPC client std::string HelpMessage(HelpMessageMode hmm) { string strUsage = _("Options:") + "\n"; @@ -330,6 +329,18 @@ std::string HelpMessage(HelpMessageMode hmm) return strUsage; } +std::string LicenseInfo() +{ + return FormatParagraph(strprintf(_("Copyright (C) 2009-%i The Bitcoin Core Developers"), COPYRIGHT_YEAR)) + "\n" + + "\n" + + FormatParagraph(_("This is experimental software.")) + "\n" + + "\n" + + FormatParagraph(_("Distributed under the MIT/X11 software license, see the accompanying file COPYING or .")) + "\n" + + "\n" + + FormatParagraph(_("This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit and cryptographic software written by Eric Young and UPnP software written by Thomas Bernard.")) + + "\n"; +} + struct CImportingNow { CImportingNow() { -- cgit v1.2.3 From 1569353b8aa535f086833acb6223650972c89790 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 7 May 2014 18:10:48 +0000 Subject: Add `-stopafterblockimport` option Stop after importing blocks. This can be useful for development and trouble shooting. --- src/init.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 39453da9c8..0a0b479fa2 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -273,6 +273,7 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " -dropmessagestest= " + _("Randomly drop 1 of every network messages") + "\n"; strUsage += " -fuzzmessagestest= " + _("Randomly fuzz 1 of every network messages") + "\n"; strUsage += " -flushwallet " + _("Run a thread to flush wallet periodically (default: 1)") + "\n"; + strUsage += " -stopafterblockimport " + _("Stop running after importing blocks from disk (default: 0)") + "\n"; } strUsage += " -debug= " + _("Output debugging information (default: 0, supplying is optional)") + "\n"; strUsage += " " + _("If is not supplied, output all debugging information.") + "\n"; @@ -404,6 +405,11 @@ void ThreadImport(std::vector vImportFiles) LogPrintf("Warning: Could not open blocks file %s\n", path.string()); } } + + if (GetBoolArg("-stopafterblockimport", false)) { + LogPrintf("Stopping after block import\n"); + StartShutdown(); + } } /** Sanity checks -- cgit v1.2.3 From 77cbd4623e171ee9c48ada8a421295ed2c8e6c7c Mon Sep 17 00:00:00 2001 From: Cozz Lovan Date: Fri, 14 Feb 2014 18:27:15 +0100 Subject: Let -zapwallettxes recover transaction meta data --- src/init.cpp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 39453da9c8..b9af16a156 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -259,7 +259,8 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " -upgradewallet " + _("Upgrade wallet to latest format") + " " + _("on startup") + "\n"; strUsage += " -wallet= " + _("Specify wallet file (within data directory)") + " " + _("(default: wallet.dat)") + "\n"; strUsage += " -walletnotify= " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n"; - strUsage += " -zapwallettxes " + _("Clear list of wallet transactions (diagnostic tool; implies -rescan)") + "\n"; + strUsage += " -zapwallettxes= " + _("Delete all wallet transactions and only recover those part of the blockchain through -rescan on startup") + "\n"; + strUsage += " " + _("(default: 1, 1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)") + "\n"; #endif strUsage += "\n" + _("Debugging/Testing options:") + "\n"; @@ -529,7 +530,7 @@ bool AppInit2(boost::thread_group& threadGroup) // -zapwallettx implies a rescan if (GetBoolArg("-zapwallettxes", false)) { if (SoftSetBoolArg("-rescan", true)) - LogPrintf("AppInit2 : parameter interaction: -zapwallettxes=1 -> setting -rescan=1\n"); + LogPrintf("AppInit2 : parameter interaction: -zapwallettxes= -> setting -rescan=1\n"); } // Make sure enough file descriptors are available @@ -986,11 +987,15 @@ bool AppInit2(boost::thread_group& threadGroup) pwalletMain = NULL; LogPrintf("Wallet disabled!\n"); } else { + + // needed to restore wallet transaction meta data after -zapwallettxes + std::vector vWtx; + if (GetBoolArg("-zapwallettxes", false)) { uiInterface.InitMessage(_("Zapping all transactions from wallet...")); pwalletMain = new CWallet(strWalletFile); - DBErrors nZapWalletRet = pwalletMain->ZapWalletTx(); + DBErrors nZapWalletRet = pwalletMain->ZapWalletTx(vWtx); if (nZapWalletRet != DB_LOAD_OK) { uiInterface.InitMessage(_("Error loading wallet.dat: Wallet corrupted")); return false; @@ -1085,6 +1090,29 @@ bool AppInit2(boost::thread_group& threadGroup) LogPrintf(" rescan %15dms\n", GetTimeMillis() - nStart); pwalletMain->SetBestChain(chainActive.GetLocator()); nWalletDBUpdated++; + + // Restore wallet transaction metadata after -zapwallettxes=1 + if (GetBoolArg("-zapwallettxes", false) && GetArg("-zapwallettxes", "1") != "2") + { + BOOST_FOREACH(const CWalletTx& wtxOld, vWtx) + { + uint256 hash = wtxOld.GetHash(); + std::map::iterator mi = pwalletMain->mapWallet.find(hash); + if (mi != pwalletMain->mapWallet.end()) + { + const CWalletTx* copyFrom = &wtxOld; + CWalletTx* copyTo = &mi->second; + copyTo->mapValue = copyFrom->mapValue; + copyTo->vOrderForm = copyFrom->vOrderForm; + copyTo->nTimeReceived = copyFrom->nTimeReceived; + copyTo->nTimeSmart = copyFrom->nTimeSmart; + copyTo->fFromMe = copyFrom->fFromMe; + copyTo->strFromAccount = copyFrom->strFromAccount; + copyTo->nOrderPos = copyFrom->nOrderPos; + copyTo->WriteToDisk(); + } + } + } } } // (!fDisableWallet) #else // ENABLE_WALLET -- cgit v1.2.3 From 92a6220711b3f98c3daad8a8dcdf13f09ce484fd Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Fri, 13 Jun 2014 19:23:01 -0400 Subject: sanity: hook up sanity checks --- src/init.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 39453da9c8..f3df3cb375 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -31,6 +31,7 @@ #ifndef WIN32 #include #endif +#include "compat/sanity.h" #include #include @@ -417,8 +418,8 @@ bool InitSanityCheck(void) "information, visit https://en.bitcoin.it/wiki/OpenSSL_and_EC_Libraries"); return false; } - - // TODO: remaining sanity checks, see #4081 + if (!glibc_sanity_test() || !glibcxx_sanity_test()) + return false; return true; } -- cgit v1.2.3 From 1020f599f33d47812a5ed73366fd266a25fef32d Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 17 Jun 2014 09:13:52 +0200 Subject: add comment to HelpMessage() to ensure alphabetical ordering - also rename hmm to mode, to be consistent between .h and .cpp --- src/init.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 39453da9c8..dd5e4cf3b0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -195,8 +195,9 @@ bool static Bind(const CService &addr, unsigned int flags) { return true; } -std::string HelpMessage(HelpMessageMode hmm) +std::string HelpMessage(HelpMessageMode mode) { + // When adding new options to the categories, please keep and ensure alphabetical ordering. string strUsage = _("Options:") + "\n"; strUsage += " -? " + _("This help message") + "\n"; strUsage += " -alertnotify= " + _("Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)") + "\n"; @@ -204,7 +205,7 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " -checkblocks= " + _("How many blocks to check at startup (default: 288, 0 = all)") + "\n"; strUsage += " -checklevel= " + _("How thorough the block verification of -checkblocks is (0-4, default: 3)") + "\n"; strUsage += " -conf= " + _("Specify configuration file (default: bitcoin.conf)") + "\n"; - if (hmm == HMM_BITCOIND) + if (mode == HMM_BITCOIND) { #if !defined(WIN32) strUsage += " -daemon " + _("Run in the background as a daemon and accept commands") + "\n"; @@ -278,7 +279,7 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " " + _("If is not supplied, output all debugging information.") + "\n"; strUsage += " " + _(" can be:"); strUsage += " addrman, alert, coindb, db, lock, rand, rpc, selectcoins, mempool, net"; // Don't translate these and qt below - if (hmm == HMM_BITCOIN_QT) + if (mode == HMM_BITCOIN_QT) strUsage += ", qt"; strUsage += ".\n"; strUsage += " -gen " + _("Generate coins (default: 0)") + "\n"; -- cgit v1.2.3 From cf0c47b2698a3e23654d9fd24f6b2ef9689bde3d Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 28 Apr 2014 12:52:32 +0200 Subject: Remove getwork() RPC call --- src/init.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 6eab273526..12d2d1bb44 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -116,7 +116,6 @@ void Shutdown() RenameThread("bitcoin-shutoff"); mempool.AddTransactionsUpdated(1); StopRPCThreads(); - ShutdownRPCMining(); #ifdef ENABLE_WALLET if (pwalletMain) bitdb.Flush(false); @@ -1148,8 +1147,6 @@ bool AppInit2(boost::thread_group& threadGroup) #endif StartNode(threadGroup); - // InitRPCMining is needed here so getwork/getblocktemplate in the GUI debug console works properly. - InitRPCMining(); if (fServer) StartRPCThreads(); -- cgit v1.2.3 From f3967bcc50ea95510f12a86e90dec4c8c78fff3b Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Mon, 23 Jun 2014 14:04:24 -0400 Subject: build: fix build weirdness after 54372482. bitcoin-config.h moved, but the old file is likely to still exist when reconfiguring or switching branches. This would've caused files to not rebuild correctly, and other strange problems. Make the path explicit so that the old one cannot be found. Core libs use config/bitcoin-config.h. Libs (like crypto) which don't want access to bitcoin's headers continue to use -Iconfig and #include bitcoin-config.h. --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 12d2d1bb44..ff7a9011a5 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -4,7 +4,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) -#include "bitcoin-config.h" +#include "config/bitcoin-config.h" #endif #include "init.h" -- cgit v1.2.3 From 1c750dbd40e23be1f17cf74cd73041a1050dc98d Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Mon, 5 May 2014 20:32:56 +0200 Subject: remove -tor compatibility code (only allow -onion) - exit, if -tor option is found and give error to user --- src/init.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index ff7a9011a5..585e4ca89a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -560,6 +560,9 @@ bool AppInit2(boost::thread_group& threadGroup) // Check for -debugnet (deprecated) if (GetBoolArg("-debugnet", false)) InitWarning(_("Warning: Deprecated argument -debugnet ignored, use -debug=net")); + // Check for -tor - as this is a privacy risk to continue, exit here + if (GetBoolArg("-tor", false)) + return InitError(_("Error: Unsupported argument -tor found, use -onion.")); fBenchmark = GetBoolArg("-benchmark", false); // Checkmempool defaults to true in regtest mode @@ -766,19 +769,15 @@ bool AppInit2(boost::thread_group& threadGroup) } // -onion can override normal proxy, -noonion disables tor entirely - // -tor here is a temporary backwards compatibility measure - if (mapArgs.count("-tor")) - printf("Notice: option -tor has been replaced with -onion and will be removed in a later version.\n"); if (!(mapArgs.count("-onion") && mapArgs["-onion"] == "0") && - !(mapArgs.count("-tor") && mapArgs["-tor"] == "0") && - (fProxy || mapArgs.count("-onion") || mapArgs.count("-tor"))) { + (fProxy || mapArgs.count("-onion"))) { CService addrOnion; - if (!mapArgs.count("-onion") && !mapArgs.count("-tor")) + if (!mapArgs.count("-onion")) addrOnion = addrProxy; else - addrOnion = mapArgs.count("-onion")?CService(mapArgs["-onion"], 9050):CService(mapArgs["-tor"], 9050); + addrOnion = CService(mapArgs["-onion"], 9050); if (!addrOnion.IsValid()) - return InitError(strprintf(_("Invalid -onion address: '%s'"), mapArgs.count("-onion")?mapArgs["-onion"]:mapArgs["-tor"])); + return InitError(strprintf(_("Invalid -onion address: '%s'"), mapArgs["-onion"])); SetProxy(NET_TOR, addrOnion, 5); SetReachable(NET_TOR); } -- cgit v1.2.3 From e44fea55ea73f46bc9460597c7001e77acb58db7 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 21 Feb 2014 04:06:12 +0000 Subject: Add an option to allow users to disable relaying/mining data carrier transactions --- src/init.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index a03629d07a..c7170b0f2d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -309,6 +309,8 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -shrinkdebugfile " + _("Shrink debug.log file on client startup (default: 1 when no -debug)") + "\n"; strUsage += " -testnet " + _("Use the test network") + "\n"; + strUsage += "\n" + _("Node relay options:") + "\n"; + strUsage += " -datacarrier " + _("Relay and mine data carrier transactions (default: 1)") + "\n"; strUsage += "\n" + _("Block creation options:") + "\n"; strUsage += " -blockminsize= " + _("Set minimum block size in bytes (default: 0)") + "\n"; strUsage += " -blockmaxsize= " + strprintf(_("Set maximum block size in bytes (default: %d)"), DEFAULT_BLOCK_MAX_SIZE) + "\n"; -- cgit v1.2.3 From d640a3ceab4f4372c2a0f738c1286cfde4b41b50 Mon Sep 17 00:00:00 2001 From: Tom Harding Date: Wed, 25 Jun 2014 23:41:44 -0700 Subject: Relay double-spends, subject to anti-DOS Allows network wallets and other clients to see transactions that respend a prevout already spent in an unconfirmed transaction in this node's mempool. Knowledge of an attempted double-spend is of interest to recipients of the first spend. In some cases, it will allow these recipients to withhold goods or services upon being alerted of a double-spend that deprives them of payment. As before, respends are not added to the mempool. Anti-Denial-of-Service-Attack provisions: - Use a bloom filter to relay only one respend per mempool prevout - Rate-limit respend relays to a default of 100 thousand bytes/minute - Define tx2.IsEquivalentTo(tx1): equality when scriptSigs are not considered - Do not relay these equivalent transactions Remove an unused variable declaration in txmempool.cpp. --- src/init.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index c7170b0f2d..bd732753e4 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1175,6 +1175,7 @@ bool AppInit2(boost::thread_group& threadGroup) LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); #endif + RegisterInternalSignals(); StartNode(threadGroup); if (fServer) StartRPCThreads(); -- cgit v1.2.3 From 9004798e62e987ddf50030b17fa1881b63dd5e45 Mon Sep 17 00:00:00 2001 From: Tom Harding Date: Thu, 26 Jun 2014 18:31:40 -0700 Subject: Add -respendnotify option and new RPC data -respendnotify= Execute command when a network tx respends wallet tx input (%s=respend TxID, %t=wallet TxID) Add respendsobserved array to gettransaction, listtransactions, and listsinceblock RPCs. This omits the malleated clones that are included in the walletconflicts array. Add RPC help for respendsobserved and walletconflicts (help was missing for the latter). --- src/init.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index bd732753e4..3d0c03328f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -260,6 +260,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -upgradewallet " + _("Upgrade wallet to latest format") + " " + _("on startup") + "\n"; strUsage += " -wallet= " + _("Specify wallet file (within data directory)") + " " + _("(default: wallet.dat)") + "\n"; strUsage += " -walletnotify= " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n"; + strUsage += " -respendnotify= " + _("Execute command when a network tx respends wallet tx input (%s=respend TxID, %t=wallet TxID)") + "\n"; strUsage += " -zapwallettxes= " + _("Delete all wallet transactions and only recover those part of the blockchain through -rescan on startup") + "\n"; strUsage += " " + _("(default: 1, 1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)") + "\n"; #endif -- cgit v1.2.3 From 0da6b3fd187da3aa810aaa584d8bd197ad4fa2b9 Mon Sep 17 00:00:00 2001 From: Tom Harding Date: Wed, 2 Jul 2014 09:27:29 -0700 Subject: Remove signal DoubleSpendDetected, use function Also removes the need for forward reference to RelayableRespend. --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index da13218a94..6c0898c036 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1176,7 +1176,7 @@ bool AppInit2(boost::thread_group& threadGroup) LogPrintf("mapAddressBook.size() = %u\n", pwalletMain ? pwalletMain->mapAddressBook.size() : 0); #endif - RegisterInternalSignals(); + InitRespendFilter(); StartNode(threadGroup); if (fServer) StartRPCThreads(); -- cgit v1.2.3 From 4278b1df45d93d18dfa0a8ce8d6fd7ac9b5344a6 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 3 Jul 2014 06:26:03 +0200 Subject: Clarify error message when invalid -rpcallowip Also add to HelpMessage() what specifications are valid. --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index da13218a94..2dd141a735 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -323,7 +323,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -rpcuser= " + _("Username for JSON-RPC connections") + "\n"; strUsage += " -rpcpassword= " + _("Password for JSON-RPC connections") + "\n"; strUsage += " -rpcport= " + _("Listen for JSON-RPC connections on (default: 8332 or testnet: 18332)") + "\n"; - strUsage += " -rpcallowip= " + _("Allow JSON-RPC connections from specified IP address. This option can be specified multiple times") + "\n"; + strUsage += " -rpcallowip= " + _("Allow JSON-RPC connections from specified source. Valid for 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") + "\n"; strUsage += " -rpcthreads= " + _("Set the number of threads to service RPC calls (default: 4)") + "\n"; strUsage += "\n" + _("RPC SSL options: (see the Bitcoin Wiki for SSL setup instructions)") + "\n"; -- cgit v1.2.3 From b33d1f5ee512da5719b793b3867f75f1eea5cf52 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Tue, 27 May 2014 15:44:57 -0400 Subject: Use fee/priority estimates in wallet CreateTransaction The wallet now uses the mempool fee estimator with a new command-line option: -txconfirmtarget (default: 1) instead of using hard-coded fees or priorities. A new bitcoind that hasn't seen enough transactions to estimate will fall back to the old hard-coded minimum priority or transaction fee. -paytxfee option overrides -txconfirmtarget. Relaying and mining code isn't changed. For Qt, the coin control dialog now uses priority estimates to label transaction priority (instead of hard-coded constants); unspent outputs were consistently labeled with a much higher priority than is justified by the free transactions actually being accepted into blocks. I did not implement any GUI for setting -txconfirmtarget; I would suggest getting rid of the "Pay transaction fee" GUI and replace it with either "target number of confirmations" or maybe a "faster confirmation <--> lower fee" slider or select box. --- src/init.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 2dd141a735..3ee0f2aa39 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -254,6 +254,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += "\n" + _("Wallet options:") + "\n"; strUsage += " -disablewallet " + _("Do not load the wallet and disable wallet RPC calls") + "\n"; strUsage += " -paytxfee= " + strprintf(_("Fee (in BTC/kB) to add to transactions you send (default: %s)"), FormatMoney(payTxFee.GetFeePerK())) + "\n"; + strUsage += " -txconfirmtarget= " + _("If paytxfee is not set, include enough fee so transactions are confirmed on average within n blocks (default: 1)") + "\n"; strUsage += " -rescan " + _("Rescan the block chain for missing wallet transactions") + " " + _("on startup") + "\n"; strUsage += " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup") + "\n"; strUsage += " -spendzeroconfchange " + _("Spend unconfirmed change when sending transactions (default: 1)") + "\n"; @@ -635,7 +636,13 @@ bool AppInit2(boost::thread_group& threadGroup) if (nFeePerK > nHighTransactionFeeWarning) InitWarning(_("Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.")); payTxFee = CFeeRate(nFeePerK, 1000); + if (payTxFee < CTransaction::minRelayTxFee) + { + return InitError(strprintf(_("Invalid amount for -paytxfee=: '%s' (must be at least %s)"), + mapArgs["-paytxfee"], CTransaction::minRelayTxFee.ToString())); + } } + nTxConfirmTarget = GetArg("-txconfirmtarget", 1); bSpendZeroConfChange = GetArg("-spendzeroconfchange", true); std::string strWalletFile = GetArg("-wallet", "wallet.dat"); -- cgit v1.2.3 From 13fc83c77bb9108c00dd7709ce17719edb763273 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 3 Jul 2014 14:25:32 -0400 Subject: Move fee policy out of core --- src/init.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 3ee0f2aa39..5afae32327 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -253,15 +253,16 @@ std::string HelpMessage(HelpMessageMode mode) #ifdef ENABLE_WALLET strUsage += "\n" + _("Wallet options:") + "\n"; strUsage += " -disablewallet " + _("Do not load the wallet and disable wallet RPC calls") + "\n"; + strUsage += " -mintxfee= " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)"), FormatMoney(CWallet::minTxFee.GetFeePerK())) + "\n"; strUsage += " -paytxfee= " + strprintf(_("Fee (in BTC/kB) to add to transactions you send (default: %s)"), FormatMoney(payTxFee.GetFeePerK())) + "\n"; - strUsage += " -txconfirmtarget= " + _("If paytxfee is not set, include enough fee so transactions are confirmed on average within n blocks (default: 1)") + "\n"; strUsage += " -rescan " + _("Rescan the block chain for missing wallet transactions") + " " + _("on startup") + "\n"; + strUsage += " -respendnotify= " + _("Execute command when a network tx respends wallet tx input (%s=respend TxID, %t=wallet TxID)") + "\n"; strUsage += " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup") + "\n"; strUsage += " -spendzeroconfchange " + _("Spend unconfirmed change when sending transactions (default: 1)") + "\n"; + strUsage += " -txconfirmtarget= " + _("If paytxfee is not set, include enough fee so transactions are confirmed on average within n blocks (default: 1)") + "\n"; strUsage += " -upgradewallet " + _("Upgrade wallet to latest format") + " " + _("on startup") + "\n"; strUsage += " -wallet= " + _("Specify wallet file (within data directory)") + " " + _("(default: wallet.dat)") + "\n"; strUsage += " -walletnotify= " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n"; - strUsage += " -respendnotify= " + _("Execute command when a network tx respends wallet tx input (%s=respend TxID, %t=wallet TxID)") + "\n"; strUsage += " -zapwallettxes= " + _("Delete all wallet transactions and only recover those part of the blockchain through -rescan on startup") + "\n"; strUsage += " " + _("(default: 1, 1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)") + "\n"; #endif @@ -295,8 +296,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -limitfreerelay= " + _("Continuously rate-limit free transactions to *1000 bytes per minute (default:15)") + "\n"; strUsage += " -maxsigcachesize= " + _("Limit size of signature cache to entries (default: 50000)") + "\n"; } - strUsage += " -mintxfee= " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)"), FormatMoney(CTransaction::minTxFee.GetFeePerK())) + "\n"; - strUsage += " -minrelaytxfee= " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for relaying (default: %s)"), FormatMoney(CTransaction::minRelayTxFee.GetFeePerK())) + "\n"; + strUsage += " -minrelaytxfee= " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for relaying (default: %s)"), FormatMoney(::minRelayTxFee.GetFeePerK())) + "\n"; strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n"; if (GetBoolArg("-help-debug", false)) { @@ -610,24 +610,24 @@ bool AppInit2(boost::thread_group& threadGroup) // a transaction spammer can cheaply fill blocks using // 1-satoshi-fee transactions. It should be set above the real // cost to you of processing a transaction. - if (mapArgs.count("-mintxfee")) - { - int64_t n = 0; - if (ParseMoney(mapArgs["-mintxfee"], n) && n > 0) - CTransaction::minTxFee = CFeeRate(n); - else - return InitError(strprintf(_("Invalid amount for -mintxfee=: '%s'"), mapArgs["-mintxfee"])); - } if (mapArgs.count("-minrelaytxfee")) { int64_t n = 0; if (ParseMoney(mapArgs["-minrelaytxfee"], n) && n > 0) - CTransaction::minRelayTxFee = CFeeRate(n); + ::minRelayTxFee = CFeeRate(n); else return InitError(strprintf(_("Invalid amount for -minrelaytxfee=: '%s'"), mapArgs["-minrelaytxfee"])); } #ifdef ENABLE_WALLET + if (mapArgs.count("-mintxfee")) + { + int64_t n = 0; + if (ParseMoney(mapArgs["-mintxfee"], n) && n > 0) + CWallet::minTxFee = CFeeRate(n); + else + return InitError(strprintf(_("Invalid amount for -mintxfee=: '%s'"), mapArgs["-mintxfee"])); + } if (mapArgs.count("-paytxfee")) { int64_t nFeePerK = 0; @@ -636,10 +636,10 @@ bool AppInit2(boost::thread_group& threadGroup) if (nFeePerK > nHighTransactionFeeWarning) InitWarning(_("Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.")); payTxFee = CFeeRate(nFeePerK, 1000); - if (payTxFee < CTransaction::minRelayTxFee) + if (payTxFee < ::minRelayTxFee) { return InitError(strprintf(_("Invalid amount for -paytxfee=: '%s' (must be at least %s)"), - mapArgs["-paytxfee"], CTransaction::minRelayTxFee.ToString())); + mapArgs["-paytxfee"], ::minRelayTxFee.ToString())); } } nTxConfirmTarget = GetArg("-txconfirmtarget", 1); -- cgit v1.2.3 From 2e36866fecb7420cd73047a7aa762a6e5e225695 Mon Sep 17 00:00:00 2001 From: R E Broadley Date: Wed, 26 Feb 2014 17:55:04 -0800 Subject: Show nodeid instead of addresses (for anonymity) unless otherwise requested. --- src/init.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index da13218a94..397ce6e065 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -288,6 +288,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -gen " + _("Generate coins (default: 0)") + "\n"; strUsage += " -genproclimit= " + _("Set the processor limit for when generation is on (-1 = unlimited, default: -1)") + "\n"; strUsage += " -help-debug " + _("Show all debugging options (usage: --help -help-debug)") + "\n"; + strUsage += " -logips " + _("Include IP addresses in debug output (default: 0)") + "\n"; strUsage += " -logtimestamps " + _("Prepend debug output with timestamp (default: 1)") + "\n"; if (GetBoolArg("-help-debug", false)) { @@ -585,6 +586,7 @@ bool AppInit2(boost::thread_group& threadGroup) fServer = GetBoolArg("-server", false); fPrintToConsole = GetBoolArg("-printtoconsole", false); fLogTimestamps = GetBoolArg("-logtimestamps", true); + fLogIPs = GetBoolArg("-logips", false); setvbuf(stdout, NULL, _IOLBF, 0); #ifdef ENABLE_WALLET bool fDisableWallet = GetBoolArg("-disablewallet", false); -- cgit v1.2.3 From 0127a9be14089b3f352ec349b2ecf4488234a4d8 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Wed, 11 Jun 2014 13:20:59 +0200 Subject: remove SOCKS4 support from core and GUI - now we support SOCKS5 only --- src/init.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index c514facbbe..a92d2aad67 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -238,9 +238,8 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -onion= " + _("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: -proxy)") + "\n"; strUsage += " -onlynet= " + _("Only connect to nodes in network (IPv4, IPv6 or Tor)") + "\n"; strUsage += " -port= " + _("Listen for connections on (default: 8333 or testnet: 18333)") + "\n"; - strUsage += " -proxy= " + _("Connect through SOCKS proxy") + "\n"; + strUsage += " -proxy= " + _("Connect through SOCKS5 proxy") + "\n"; strUsage += " -seednode= " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n"; - strUsage += " -socks= " + _("Select SOCKS version for -proxy (4 or 5, default: 5)") + "\n"; strUsage += " -timeout= " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n"; #ifdef USE_UPNP #if USE_UPNP @@ -745,10 +744,6 @@ bool AppInit2(boost::thread_group& threadGroup) RegisterNodeSignals(GetNodeSignals()); - int nSocksVersion = GetArg("-socks", 5); - if (nSocksVersion != 4 && nSocksVersion != 5) - return InitError(strprintf(_("Unknown -socks proxy version requested: %i"), nSocksVersion)); - if (mapArgs.count("-onlynet")) { std::set nets; BOOST_FOREACH(std::string snet, mapMultiArgs["-onlynet"]) { @@ -772,12 +767,10 @@ bool AppInit2(boost::thread_group& threadGroup) return InitError(strprintf(_("Invalid -proxy address: '%s'"), mapArgs["-proxy"])); if (!IsLimited(NET_IPV4)) - SetProxy(NET_IPV4, addrProxy, nSocksVersion); - if (nSocksVersion > 4) { - if (!IsLimited(NET_IPV6)) - SetProxy(NET_IPV6, addrProxy, nSocksVersion); - SetNameProxy(addrProxy, nSocksVersion); - } + SetProxy(NET_IPV4, addrProxy); + if (!IsLimited(NET_IPV6)) + SetProxy(NET_IPV6, addrProxy); + SetNameProxy(addrProxy); fProxy = true; } @@ -791,7 +784,7 @@ bool AppInit2(boost::thread_group& threadGroup) addrOnion = CService(mapArgs["-onion"], 9050); if (!addrOnion.IsValid()) return InitError(strprintf(_("Invalid -onion address: '%s'"), mapArgs["-onion"])); - SetProxy(NET_TOR, addrOnion, 5); + SetProxy(NET_TOR, addrOnion); SetReachable(NET_TOR); } -- cgit v1.2.3 From a339a37b28176135c7fe5adbd3b50da77a45373d Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Mon, 16 Jun 2014 08:48:32 +0200 Subject: error out, when we detect -socks argument --- src/init.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index a92d2aad67..db9247ef6f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -565,6 +565,9 @@ bool AppInit2(boost::thread_group& threadGroup) // Check for -debugnet (deprecated) if (GetBoolArg("-debugnet", false)) InitWarning(_("Warning: Deprecated argument -debugnet ignored, use -debug=net")); + // Check for -socks - as this is a privacy risk to continue, exit here + if (mapArgs.count("-socks")) + return InitError(_("Error: Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported.")); // Check for -tor - as this is a privacy risk to continue, exit here if (GetBoolArg("-tor", false)) return InitError(_("Error: Unsupported argument -tor found, use -onion.")); -- cgit v1.2.3 From 73ac7abd08a70adf22e24d0f5f7631e7f8b7c5bb Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 3 Jul 2014 07:45:16 +0200 Subject: Move ui_interface to bitcoin_server.a There is no need for it in the utility libraries or tools. Put it in init.cpp, and in the tests separately (as they can't link init). --- src/init.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index c514facbbe..dcb71c4206 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -62,6 +62,7 @@ enum BindFlags { }; static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat"; +CClientUIInterface uiInterface; ////////////////////////////////////////////////////////////////////////////// // -- cgit v1.2.3