From 426a74ed3c3c98b791a8445dd276e89fc5d6175e Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Tue, 23 Sep 2014 05:18:47 -0400 Subject: [PATCH 01/88] Add scriptPubKey field to validateaddress RPC call --- src/rpcmisc.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index dd45eefd5..d1ab5093f 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -161,6 +161,7 @@ Value validateaddress(const Array& params, bool fHelp) "{\n" " \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n" " \"address\" : \"bitcoinaddress\", (string) The bitcoin address validated\n" + " \"scriptPubKey\" : \"hex\", (string) The hex encoded scriptPubKey generated by the address\n" " \"ismine\" : true|false, (boolean) If the address is yours or not\n" " \"isscript\" : true|false, (boolean) If the key is a script\n" " \"pubkey\" : \"publickeyhex\", (string) The hex value of the raw public key\n" @@ -182,6 +183,10 @@ Value validateaddress(const Array& params, bool fHelp) CTxDestination dest = address.Get(); string currentAddress = address.ToString(); ret.push_back(Pair("address", currentAddress)); + + CScript scriptPubKey = GetScriptForDestination(dest); + ret.push_back(Pair("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()))); + #ifdef ENABLE_WALLET isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; ret.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false)); From ba7fcc8de06602576ab6a5911879d3d8df80d36a Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Sun, 25 Aug 2013 14:13:25 -0400 Subject: [PATCH 02/88] Discourage fee sniping with nLockTime --- src/wallet.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/wallet.cpp b/src/wallet.cpp index 026c53aa2..a64d27a94 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1347,6 +1347,28 @@ bool CWallet::CreateTransaction(const vector >& vecSend, wtxNew.BindWallet(this); CMutableTransaction txNew; + // Discourage fee sniping. + // + // However because of a off-by-one-error in previous versions we need to + // neuter it by setting nLockTime to at least one less than nBestHeight. + // Secondly currently propagation of transactions created for block heights + // corresponding to blocks that were just mined may be iffy - transactions + // aren't re-accepted into the mempool - we additionally neuter the code by + // going ten blocks back. Doesn't yet do anything for sniping, but does act + // to shake out wallet bugs like not showing nLockTime'd transactions at + // all. + txNew.nLockTime = std::max(0, chainActive.Height() - 10); + + // Secondly occasionally randomly pick a nLockTime even further back, so + // that transactions that are delayed after signing for whatever reason, + // e.g. high-latency mix networks and some CoinJoin implementations, have + // better privacy. + if (GetRandInt(10) == 0) + txNew.nLockTime = std::max(0, (int)txNew.nLockTime - GetRandInt(100)); + + assert(txNew.nLockTime <= (unsigned int)chainActive.Height()); + assert(txNew.nLockTime < LOCKTIME_THRESHOLD); + { LOCK2(cs_main, cs_wallet); { @@ -1440,8 +1462,12 @@ bool CWallet::CreateTransaction(const vector >& vecSend, reservekey.ReturnKey(); // Fill vin + // + // Note how the sequence number is set to max()-1 so that the + // nLockTime set above actually works. BOOST_FOREACH(const PAIRTYPE(const CWalletTx*,unsigned int)& coin, setCoins) - txNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second)); + txNew.vin.push_back(CTxIn(coin.first->GetHash(),coin.second,CScript(), + std::numeric_limits::max()-1)); // Sign int nIn = 0; From 7c041b3b91aa08a8f5863382b865a5174281ad03 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Mon, 10 Nov 2014 02:52:28 -0500 Subject: [PATCH 03/88] Check against MANDATORY flags prior to accepting to mempool Previously transactions were only tested again the STANDARD_SCRIPT_VERIFY_FLAGS prior to mempool acceptance, so any bugs in those flags that allowed actually-invalid transactions to pass would result in allowing invalid transactions into the mempool. Fortunately there is a second check in CreateNewBlock() that would prevent those transactions from being mined, resulting in an invalid block, however this could still be exploited as a DoS attack. --- src/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 4aa49531b..8d4a9e59f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1039,6 +1039,21 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa { return error("AcceptToMemoryPool: : ConnectInputs failed %s", hash.ToString()); } + + // Check again against just the consensus-critical mandatory script + // verification flags, in case of bugs in the standard flags that cause + // transactions to pass as valid when they're actually invalid. For + // instance the STRICTENC flag was incorrectly allowing certain + // CHECKSIG NOT scripts to pass, even though they were invalid. + // + // There is a similar check in CreateNewBlock() to prevent creating + // invalid blocks, however allowing such transactions into the mempool + // can be exploited as a DoS attack. + if (!CheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true)) + { + return error("AcceptToMemoryPool: : BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags %s", hash.ToString()); + } + // Store transaction in memory pool.addUnchecked(hash, entry); } From 13f903187c3aed26993b89dd3a135e646cfc7437 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Thu, 13 Nov 2014 15:15:53 +0100 Subject: [PATCH 04/88] init: minor parameter interaction updates - use __func__ instead of hard-coded function name for logging - update -discover help message to reflect newly added parameter interaction - use DEFAULT_LISTEN in a parameter interaction check instead a hard coded value --- src/init.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index b290d5415..fd5fcb09d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -254,7 +254,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -bantime= " + strprintf(_("Number of seconds to keep misbehaving peers from reconnecting (default: %u)"), 86400) + "\n"; strUsage += " -bind= " + _("Bind to given address and always listen on it. Use [host]:port notation for IPv6") + "\n"; strUsage += " -connect= " + _("Connect only to the specified node(s)") + "\n"; - strUsage += " -discover " + _("Discover own IP address (default: 1 when listening and no -externalip)") + "\n"; + strUsage += " -discover " + _("Discover own IP addresses (default: 1 when listening and no -externalip or -proxy)") + "\n"; strUsage += " -dns " + _("Allow DNS lookups for -addnode, -seednode and -connect") + " " + _("(default: 1)") + "\n"; strUsage += " -dnsseed " + _("Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)") + "\n"; strUsage += " -externalip= " + _("Specify your own public address") + "\n"; @@ -550,59 +550,64 @@ bool AppInit2(boost::thread_group& threadGroup) #endif // ********************************************************* Step 2: parameter interactions + // Set this early so that parameter interactions go to console fPrintToConsole = GetBoolArg("-printtoconsole", false); fLogTimestamps = GetBoolArg("-logtimestamps", true); fLogIPs = GetBoolArg("-logips", false); - if (mapArgs.count("-bind") || mapArgs.count("-whitebind")) { - // when specifying an explicit binding address, you want to listen on it - // even when -connect or -proxy is specified + // when specifying an explicit binding address, you want to listen on it + // even when -connect or -proxy is specified + if (mapArgs.count("-bind")) { if (SoftSetBoolArg("-listen", true)) - LogPrintf("AppInit2 : parameter interaction: -bind or -whitebind set -> setting -listen=1\n"); + LogPrintf("%s: parameter interaction: -bind set -> setting -listen=1\n", __func__); + } + if (mapArgs.count("-whitebind")) { + if (SoftSetBoolArg("-listen", true)) + LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__); } if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) { // when only connecting to trusted nodes, do not seed via DNS, or listen by default if (SoftSetBoolArg("-dnsseed", false)) - LogPrintf("AppInit2 : parameter interaction: -connect set -> setting -dnsseed=0\n"); + LogPrintf("%s: parameter interaction: -connect set -> setting -dnsseed=0\n", __func__); if (SoftSetBoolArg("-listen", false)) - LogPrintf("AppInit2 : parameter interaction: -connect set -> setting -listen=0\n"); + LogPrintf("%s: parameter interaction: -connect set -> setting -listen=0\n", __func__); } if (mapArgs.count("-proxy")) { // to protect privacy, do not listen by default if a default proxy server is specified if (SoftSetBoolArg("-listen", false)) - LogPrintf("AppInit2 : parameter interaction: -proxy set -> setting -listen=0\n"); + LogPrintf("%s: parameter interaction: -proxy set -> setting -listen=0\n", __func__); // to protect privacy, do not discover addresses by default if (SoftSetBoolArg("-discover", false)) - LogPrintf("AppInit2 : parameter interaction: -proxy set -> setting -discover=0\n"); + LogPrintf("%s: parameter interaction: -proxy set -> setting -discover=0\n", __func__); } - if (!GetBoolArg("-listen", true)) { + if (!GetBoolArg("-listen", DEFAULT_LISTEN)) { // do not map ports or try to retrieve public IP when not listening (pointless) if (SoftSetBoolArg("-upnp", false)) - LogPrintf("AppInit2 : parameter interaction: -listen=0 -> setting -upnp=0\n"); + LogPrintf("%s: parameter interaction: -listen=0 -> setting -upnp=0\n", __func__); if (SoftSetBoolArg("-discover", false)) - LogPrintf("AppInit2 : parameter interaction: -listen=0 -> setting -discover=0\n"); + LogPrintf("%s: parameter interaction: -listen=0 -> setting -discover=0\n", __func__); } if (mapArgs.count("-externalip")) { // if an explicit public IP is specified, do not try to find others if (SoftSetBoolArg("-discover", false)) - LogPrintf("AppInit2 : parameter interaction: -externalip set -> setting -discover=0\n"); + LogPrintf("%s: parameter interaction: -externalip set -> setting -discover=0\n", __func__); } if (GetBoolArg("-salvagewallet", false)) { // Rewrite just private keys: rescan to find transactions if (SoftSetBoolArg("-rescan", true)) - LogPrintf("AppInit2 : parameter interaction: -salvagewallet=1 -> setting -rescan=1\n"); + LogPrintf("%s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n", __func__); } // -zapwallettx implies a rescan if (GetBoolArg("-zapwallettxes", false)) { if (SoftSetBoolArg("-rescan", true)) - LogPrintf("AppInit2 : parameter interaction: -zapwallettxes= -> setting -rescan=1\n"); + LogPrintf("%s: parameter interaction: -zapwallettxes= -> setting -rescan=1\n", __func__); } // Make sure enough file descriptors are available From eef747bba81e66b2d551a3670a659bbe9dd4a8ce Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 20 Nov 2014 20:45:24 +0000 Subject: [PATCH 05/88] libbitcoinconsensus: Add pkg-config support --- Makefile.am | 5 +++++ configure.ac | 1 + libbitcoinconsensus.pc.in | 11 +++++++++++ 3 files changed, 17 insertions(+) create mode 100644 libbitcoinconsensus.pc.in diff --git a/Makefile.am b/Makefile.am index 6bc004431..9b4d52c63 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,6 +4,11 @@ SUBDIRS = src GZIP_ENV="-9n" +if BUILD_BITCOIN_LIBS +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libbitcoinconsensus.pc +endif + BITCOIND_BIN=$(top_builddir)/src/bitcoind$(EXEEXT) BITCOIN_QT_BIN=$(top_builddir)/src/qt/bitcoin-qt$(EXEEXT) BITCOIN_CLI_BIN=$(top_builddir)/src/bitcoin-cli$(EXEEXT) diff --git a/configure.ac b/configure.ac index 6784521d8..86c7cc948 100644 --- a/configure.ac +++ b/configure.ac @@ -680,6 +680,7 @@ AC_MSG_CHECKING([whether to build libraries]) AM_CONDITIONAL([BUILD_BITCOIN_LIBS], [test x$build_bitcoin_libs = xyes]) if test x$build_bitcoin_libs = xyes; then AC_DEFINE(HAVE_CONSENSUS_LIB, 1, [Define this symbol if the consensus lib has been built]) + AC_CONFIG_FILES([libbitcoinconsensus.pc:libbitcoinconsensus.pc.in]) fi AC_MSG_RESULT($build_bitcoin_libs) diff --git a/libbitcoinconsensus.pc.in b/libbitcoinconsensus.pc.in new file mode 100644 index 000000000..3ca1696a3 --- /dev/null +++ b/libbitcoinconsensus.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: Bitcoin Core consensus library +Description: Library for the Bitcoin consensus protocol. +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -lbitcoinconsensus +Cflags: -I${includedir} +Requires.private: libcrypto From 2747f7cf77f6ef3515899a0d8dbe1bad68114da7 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Fri, 21 Nov 2014 13:49:39 +0100 Subject: [PATCH 06/88] [Qt] fix missing plural form for a string in sendcoinsdialog - this was reported on Transifex by pryds (Thank you!) --- src/qt/sendcoinsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 46eb58ca4..2bacd48a4 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -631,7 +631,7 @@ void SendCoinsDialog::updateSmartFeeLabel() { ui->labelSmartFee->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), feeRate.GetFeePerK()) + "/kB"); ui->labelSmartFee2->hide(); - ui->labelFeeEstimation->setText(tr("Estimated to begin confirmation within %1 block(s).").arg(nBlocksToConfirm)); + ui->labelFeeEstimation->setText(tr("Estimated to begin confirmation within %n block(s).", "", nBlocksToConfirm)); } updateFeeMinimizedLabel(); From 50db7d9f09f2fda7c97816d810e478c10dba3cb2 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Fri, 21 Nov 2014 13:52:26 +0100 Subject: [PATCH 07/88] [Qt] change some strings to reflect name change to Bitcoin Core --- src/qt/askpassphrasedialog.cpp | 2 +- src/qt/bitcoingui.cpp | 2 +- src/qt/forms/optionsdialog.ui | 6 +++--- src/qt/forms/rpcconsole.ui | 2 +- src/qt/rpcconsole.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index fa9ac6b13..2c8d93fba 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -119,7 +119,7 @@ void AskPassphraseDialog::accept() { QMessageBox::warning(this, tr("Wallet encrypted"), "" + - tr("Bitcoin will close now to finish the encryption process. " + tr("Bitcoin Core will close now to finish the encryption process. " "Remember that encrypting your wallet cannot fully protect " "your bitcoins from being stolen by malware infecting your computer.") + "

" + diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 6a457d361..f52075ce1 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -296,7 +296,7 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle) aboutQtAction->setStatusTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); - optionsAction->setStatusTip(tr("Modify configuration options for Bitcoin")); + optionsAction->setStatusTip(tr("Modify configuration options for Bitcoin Core")); optionsAction->setMenuRole(QAction::PreferencesRole); toggleHideAction = new QAction(networkStyle->getAppIcon(), tr("&Show / Hide"), this); toggleHideAction->setStatusTip(tr("Show or hide the main Window")); diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 51156ade4..19421dc81 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -30,10 +30,10 @@ - Automatically start Bitcoin after logging in to the system. + Automatically start Bitcoin Core after logging in to the system. - &Start Bitcoin on system login + &Start Bitcoin Core on system login @@ -375,7 +375,7 @@ - The user interface language can be set here. This setting will take effect after restarting Bitcoin. + The user interface language can be set here. This setting will take effect after restarting Bitcoin Core. diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index c5ac37161..b62e9475a 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -331,7 +331,7 @@ - Open the Bitcoin debug log file from the current data directory. This can take a few seconds for large log files. + Open the Bitcoin Core debug log file from the current data directory. This can take a few seconds for large log files. &Open diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 2d2d448b4..27de9e3d5 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -361,7 +361,7 @@ void RPCConsole::clear() "b { color: #006060; } " ); - message(CMD_REPLY, (tr("Welcome to the Bitcoin RPC console.") + "
" + + message(CMD_REPLY, (tr("Welcome to the Bitcoin Core RPC console.") + "
" + tr("Use up and down arrows to navigate history, and Ctrl-L to clear screen.") + "
" + tr("Type help for an overview of available commands.")), true); } From 4709160b506e09a14386adb24f08493108d2ba8c Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 2 Dec 2014 15:06:55 +0100 Subject: [PATCH 08/88] [Qt] fix a translation that occurs 2 times but was a little different --- src/qt/forms/sendcoinsdialog.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 0bf04c75e..eebb45932 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -855,7 +855,7 @@ - If the custom fee is set to 1000 satoshis and the transaction is only 250 bytes, then "per kilobyte" only pays 250 satoshis in fee, while "at least" pays 1000 satoshis. For transactions bigger than a kilobyte both pay by kilobyte. + If the custom fee is set to 1000 satoshis and the transaction is only 250 bytes, then "per kilobyte" only pays 250 satoshis in fee, while "total at least" pays 1000 satoshis. For transactions bigger than a kilobyte both pay by kilobyte. per kilobyte From cac15bedb1398a1eb72837b74ab76266305172e1 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Thu, 4 Dec 2014 00:53:16 -0500 Subject: [PATCH 09/88] Test unexecuted OP_CODESEPARATOR OP_CODESEPARATOR is an actual executed instruction, not a declarative thing, so if it's wrapped in an OP_IF it can be turned off. Using this to implement Rivest's Paywords is left as an exercise for the reader. --- src/test/data/tx_invalid.json | 12 ++++++++++++ src/test/data/tx_valid.json | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/src/test/data/tx_invalid.json b/src/test/data/tx_invalid.json index 638a705f9..456e0d2f7 100644 --- a/src/test/data/tx_invalid.json +++ b/src/test/data/tx_invalid.json @@ -103,5 +103,17 @@ [[["ad503f72c18df5801ee64d76090afe4c607fb2b822e9b7b63c5826c50e22fc3b", 0, "0x21 0x027c3a97665bf283a102a587a62a30a0c102d4d3b141015e2cae6f64e2543113e5 CHECKSIG NOT"]], "01000000013bfc220ec526583cb6b7e922b8b27f604cfe0a09764de61e80f58dc1723f50ad0000000000ffffffff0101000000000000002321027c3a97665bf283a102a587a62a30a0c102d4d3b141015e2cae6f64e2543113e5ac00000000", "P2SH"], + +["Inverted versions of tx_valid CODESEPARATOR IF block tests"], + +["CODESEPARATOR in an unexecuted IF block does not change what is hashed"], +[[["a955032f4d6b0c9bfe8cad8f00a8933790b9c1dc28c82e0f48e75b35da0e4944", 0, "IF CODESEPARATOR ENDIF 0x21 0x0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71 CHECKSIGVERIFY CODESEPARATOR 1"]], +"010000000144490eda355be7480f2ec828dcc1b9903793a8008fad8cfe9b0c6b4d2f0355a9000000004a48304502207a6974a77c591fa13dff60cabbb85a0de9e025c09c65a4b2285e47ce8e22f761022100f0efaac9ff8ac36b10721e0aae1fb975c90500b50c56e8a0cc52b0403f0425dd0151ffffffff010000000000000000016a00000000", "P2SH"], + +["As above, with the IF block executed"], +[[["a955032f4d6b0c9bfe8cad8f00a8933790b9c1dc28c82e0f48e75b35da0e4944", 0, "IF CODESEPARATOR ENDIF 0x21 0x0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71 CHECKSIGVERIFY CODESEPARATOR 1"]], +"010000000144490eda355be7480f2ec828dcc1b9903793a8008fad8cfe9b0c6b4d2f0355a9000000004a483045022100fa4a74ba9fd59c59f46c3960cf90cbe0d2b743c471d24a3d5d6db6002af5eebb02204d70ec490fd0f7055a7c45f86514336e3a7f03503dacecabb247fc23f15c83510100ffffffff010000000000000000016a00000000", "P2SH"], + + ["Make diffs cleaner by leaving a comment here without comma at the end"] ] diff --git a/src/test/data/tx_valid.json b/src/test/data/tx_valid.json index aa8e5ca6c..182b88ef6 100644 --- a/src/test/data/tx_valid.json +++ b/src/test/data/tx_valid.json @@ -149,6 +149,15 @@ [[["a955032f4d6b0c9bfe8cad8f00a8933790b9c1dc28c82e0f48e75b35da0e4944", 0, "0x21 0x038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041 CHECKSIGVERIFY CODESEPARATOR 0x21 0x038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041 CHECKSIGVERIFY CODESEPARATOR 1"]], "010000000144490eda355be7480f2ec828dcc1b9903793a8008fad8cfe9b0c6b4d2f0355a900000000924830450221009c0a27f886a1d8cb87f6f595fbc3163d28f7a81ec3c4b252ee7f3ac77fd13ffa02203caa8dfa09713c8c4d7ef575c75ed97812072405d932bd11e6a1593a98b679370148304502201e3861ef39a526406bad1e20ecad06be7375ad40ddb582c9be42d26c3a0d7b240221009d0a3985e96522e59635d19cc4448547477396ce0ef17a58e7d74c3ef464292301ffffffff010000000000000000016a00000000", "P2SH"], +["CODESEPARATOR in an unexecuted IF block does not change what is hashed"], +[[["a955032f4d6b0c9bfe8cad8f00a8933790b9c1dc28c82e0f48e75b35da0e4944", 0, "IF CODESEPARATOR ENDIF 0x21 0x0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71 CHECKSIGVERIFY CODESEPARATOR 1"]], +"010000000144490eda355be7480f2ec828dcc1b9903793a8008fad8cfe9b0c6b4d2f0355a9000000004a48304502207a6974a77c591fa13dff60cabbb85a0de9e025c09c65a4b2285e47ce8e22f761022100f0efaac9ff8ac36b10721e0aae1fb975c90500b50c56e8a0cc52b0403f0425dd0100ffffffff010000000000000000016a00000000", "P2SH"], + +["As above, with the IF block executed"], +[[["a955032f4d6b0c9bfe8cad8f00a8933790b9c1dc28c82e0f48e75b35da0e4944", 0, "IF CODESEPARATOR ENDIF 0x21 0x0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71 CHECKSIGVERIFY CODESEPARATOR 1"]], +"010000000144490eda355be7480f2ec828dcc1b9903793a8008fad8cfe9b0c6b4d2f0355a9000000004a483045022100fa4a74ba9fd59c59f46c3960cf90cbe0d2b743c471d24a3d5d6db6002af5eebb02204d70ec490fd0f7055a7c45f86514336e3a7f03503dacecabb247fc23f15c83510151ffffffff010000000000000000016a00000000", "P2SH"], + + ["CHECKSIG is legal in scriptSigs"], [[["ccf7f4053a02e653c36ac75c891b7496d0dc5ce5214f6c913d9cf8f1329ebee0", 0, "DUP HASH160 0x14 0xee5a6aa40facefb2655ac23c0c28c57c65c41f9b EQUALVERIFY CHECKSIG"]], "0100000001e0be9e32f1f89c3d916c4f21e55cdcd096741b895cc76ac353e6023a05f4f7cc00000000d86149304602210086e5f736a2c3622ebb62bd9d93d8e5d76508b98be922b97160edc3dcca6d8c47022100b23c312ac232a4473f19d2aeb95ab7bdf2b65518911a0d72d50e38b5dd31dc820121038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041ac4730440220508fa761865c8abd81244a168392876ee1d94e8ed83897066b5e2df2400dad24022043f5ee7538e87e9c6aef7ef55133d3e51da7cc522830a9c4d736977a76ef755c0121038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041ffffffff010000000000000000016a00000000", "P2SH"], From 88eb44d30f205d8e3f170db44d994c3c4c95736a Mon Sep 17 00:00:00 2001 From: Blake Jakopovic Date: Wed, 3 Dec 2014 11:22:12 +1000 Subject: [PATCH 10/88] Revised translation process doc --- doc/translation_process.md | 164 +++++++++++++++++++++---------------- 1 file changed, 93 insertions(+), 71 deletions(-) diff --git a/doc/translation_process.md b/doc/translation_process.md index 9475b1dc7..eed467706 100644 --- a/doc/translation_process.md +++ b/doc/translation_process.md @@ -1,21 +1,100 @@ Translations ============ -The Bitcoin Core GUI can be easily translated into other languages. Here's how we -handle those translations. +The Bitcoin-Core project has been designed to support multiple localisations. This makes adding new phrases, and completely new languages easily achievable. For managing all application translations, Bitcoin-Core makes use of the Transifex online translation management tool. -Files and Folders ------------------ +### Helping to translate (using Transifex) +Transifex is setup to monitor the Github repo for updates, and when code containing new translations is found, Transifex will process any changes. It may take several hours after a pull-request has been merged, to appear in the Transifex web interface. -### bitcoin-qt.pro +Multiple language support is critical in assisting Bitcoin’s global adoption, and growth. One of Bitcoin’s greatest strengths is cross-boarder money transfers, any help making that easier is greatly appreciated. -This file takes care of generating `.qm` files from `.ts` files. It is mostly -automated. +See the [Transifex Bitcoin project](https://www.transifex.com/projects/p/bitcoin/) to assist in translations. You should also join the translation mailing list for announcements - see details below. -### src/qt/bitcoin.qrc +### Writing code with translations +We use automated scripts to help extract translations in both Qt, and non-Qt source files. It is rarely necessary to manually edit the files in `src/qt/locale/`. The translation source files must adhere to the following format: +`bitcoin_xx_YY.ts or bitcoin_xx.ts` -This file must be updated whenever a new translation is added. Please note that -files must end with `.qm`, not `.ts`. +`src/qt/locale/bitcoin_en.ts` is treated in a special way. It is used as the source for all other translations. Whenever a string in the source code is changed, this file must be updated to reflect those changes. A custom script is used to extract strings from the non-Qt parts. This script makes use of `gettext`, so make sure that utility is installed (ie, `apt-get install gettext` on Ubuntu/Debian). Once this has been updated, `lupdate` (included in the Qt SDK) is used to update `bitcoin_en.ts`. + +To automatically regenerate the `bitcoin_en.ts` file, run the following commands: +```sh +cd src/ +make translate +``` + +`contrib/bitcoin-qt.pro` takes care of generating `.qm` (binary compiled) files from `.ts` (source files) files. It’s mostly automated, and you shouldn’t need to worry about it. + +**Example Qt translation** +```cpp +QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); +``` + +### Creating a pull-request +For general PRs, you shouldn’t include any updates to the translation source files. They will be updated periodically, primarily around pre-releases, allowing time for any new phrases to be translated before public releases. This is also important in avoiding translation related merge conflicts. + +When an updated source file is merged into the Github repo, Transifex will automatically detect it (although it can take several hours). Once processed, the new strings will show up as "Remaining" in the Transifex web interface and are ready for translators. + +To create the pull-request, use the following commands: +``` +git add src/qt/bitcoinstrings.cpp src/qt/locale/bitcoin_en.ts +git commit +``` + +### Creating a Transifex account +Visit the [Transifex Signup](https://www.transifex.com/signup/) page to create an account. Take note of your username and password, as they will be required to configure the command-line tool. + +You can find the Bitcoin translation project at [https://www.transifex.com/projects/p/bitcoin/](https://www.transifex.com/projects/p/bitcoin/). + +### Installing the Transifex client command-line tool +The client it used to fetch updated translations. If you are having problems, or need more details, see [http://docs.transifex.com/developer/client/setup](http://docs.transifex.com/developer/client/setup) + +**For Linux and Mac** + +`pip install transifex-client` + +Setup your transifex client config as follows. Please *ignore the token field*. + +```ini +nano ~/.transifexrc + +[https://www.transifex.com] +hostname = https://www.transifex.com +password = PASSWORD +token = +username = USERNAME +``` + +**For Windows** + +Please see [http://docs.transifex.com/developer/client/setup#windows](http://docs.transifex.com/developer/client/setup#windows) for details on installation. + +The Transifex Bitcoin project config file is included as part of the repo. It can be found at `.tx/config`, however you shouldn’t need change anything. + +### Synchronising translations +To assist in updating translations, we have created a script to help. + +1. `python contrib/devtools/update-translations.py` +2. Update `src/qt/bitcoin.qrc` manually or via + `ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(bitcoin_\(.*\)\).ts/locale\/\1.qm<\/file>/'` +3. Update `src/qt/Makefile.am` manually or via + `ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(bitcoin_\(.*\)\).ts/ locale\/\1.ts \\/'` +4. `git add` new translations from `src/qt/locale/` + +**Do not directly download translations** one by one from the Transifex website, as we do a few post-processing steps before committing the translations. + +### Handling Plurals (in source files) +When new plurals are added to the source file, it's important to do the following steps: + +1. Open `bitcoin_en.ts` in Qt Linguist (included in the Qt SDK) +2. Search for `%n`, which will take you to the parts in the translation that use plurals +3. Look for empty `English Translation (Singular)` and `English Translation (Plural)` fields +4. Add the appropriate strings for the singular and plural form of the base string +5. Mark the item as done (via the green arrow symbol in the toolbar) +6. Repeat from step 2, until all singular and plural forms are in the source file +7. Save the source file + +### Translating a new language +To create a new language template, you will need to edit the languages manifest file `src/qt/bitcoin.qrc` and add a new entry. Below is an example of the english language entry. ```xml @@ -24,66 +103,9 @@ files must end with `.qm`, not `.ts`. ``` -### src/qt/locale/ +**Note:** that the language translation file **must end in `.qm`** (the compiled extension), and not `.ts`. -This directory contains all translations. Filenames must adhere to this format: +### Questions and general assistance +The Bitcoin-Core translation maintainers include *tcatm, seone, Diapolo, wumpus and luke-jr*.You can find them, and others, in the Freenode IRC chatroom - `irc.freenode.net #bitcoin-dev`. - bitcoin_xx_YY.ts or bitcoin_xx.ts - -#### bitcoin_en.ts (Source file) - -`src/qt/locale/bitcoin_en.ts` is treated in a special way. It is used as the -source for all other translations. Whenever a string in the code is changed -this file must be updated to reflect those changes. A custom script is used -to extract strings from the non-Qt parts. This script makes use of `gettext`, -so make sure that utility is installed (ie, `apt-get install gettext` on -Ubuntu/Debian). Once this has been updated, lupdate (included in the Qt SDK) -is used to update bitcoin_en.ts. This process has been automated, from src/qt, -simply run: - make translate - -##### Handling of plurals in the source file - -When new plurals are added to the source file, it's important to do the following steps: - -1. Open bitcoin_en.ts in Qt Linguist (also included in the Qt SDK) -2. Search for `%n`, which will take you to the parts in the translation that use plurals -3. Look for empty `English Translation (Singular)` and `English Translation (Plural)` fields -4. Add the appropriate strings for the singular and plural form of the base string -5. Mark the item as done (via the green arrow symbol in the toolbar) -6. Repeat from step 2. until all singular and plural forms are in the source file -7. Save the source file - -##### Creating the pull-request - -An updated source file should be merged to github and Transifex will pick it -up from there (can take some hours). Afterwards the new strings show up as "Remaining" -in Transifex and can be translated. - -To create the pull-request you have to do: - - git add src/qt/bitcoinstrings.cpp src/qt/locale/bitcoin_en.ts - git commit - -Syncing with Transifex ----------------------- - -We are using https://transifex.com as a frontend for translating the client. - -https://www.transifex.com/projects/p/bitcoin/resource/tx/ - -The "Transifex client" (see: http://support.transifex.com/customer/portal/topics/440187-transifex-client/articles) -is used to fetch new translations from Transifex. The configuration for this client (`.tx/config`) -is part of the repository. - -Do not directly download translations one by one from the Transifex website, as we do a few -postprocessing steps before committing the translations. - -### Fetching new translations - -1. `python contrib/devtools/update-translations.py` -2. update `src/qt/bitcoin.qrc` manually or via - `ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(bitcoin_\(.*\)\).ts/locale\/\1.qm<\/file>/'` -3. update `src/qt/Makefile.am` manually or via - `ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(bitcoin_\(.*\)\).ts/ locale\/\1.ts \\/'` -4. `git add` new translations from `src/qt/locale/` +If you are a translator, you should also subscribe to the mailing list, https://groups.google.com/forum/#!forum/bitcoin-translators. Announcements will be posted during application pre-releases to notify translators to check for updates. \ No newline at end of file From 012598880cf69a6a4d4d495c78e40ab4abb4eb39 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 22 Nov 2014 15:44:43 +0100 Subject: [PATCH 11/88] Implement test for merkle tree malleability in CPartialMerkleTree This is a check that is mentioned in BIP 37, but never implemented in the reference code. As Bitcoin Core so far never decodes partial merkle trees, this is not a problem. But perhaps others use the code as a reference. --- src/merkleblock.cpp | 10 ++++++++-- src/test/pmt_tests.cpp | 11 +++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/merkleblock.cpp b/src/merkleblock.cpp index 8618e355d..0500cfde8 100644 --- a/src/merkleblock.cpp +++ b/src/merkleblock.cpp @@ -93,10 +93,16 @@ uint256 CPartialMerkleTree::TraverseAndExtract(int height, unsigned int pos, uns } else { // otherwise, descend into the subtrees to extract matched txids and hashes uint256 left = TraverseAndExtract(height-1, pos*2, nBitsUsed, nHashUsed, vMatch), right; - if (pos*2+1 < CalcTreeWidth(height-1)) + if (pos*2+1 < CalcTreeWidth(height-1)) { right = TraverseAndExtract(height-1, pos*2+1, nBitsUsed, nHashUsed, vMatch); - else + if (right == left) { + // If the left and right branch should never be identical as the transaction + // hashes covered by them must be unique. + fBad = true; + } + } else { right = left; + } // and combine them before returning return Hash(BEGIN(left), END(left), BEGIN(right), END(right)); } diff --git a/src/test/pmt_tests.cpp b/src/test/pmt_tests.cpp index 3b535a84f..eea5b0af4 100644 --- a/src/test/pmt_tests.cpp +++ b/src/test/pmt_tests.cpp @@ -10,6 +10,7 @@ #include +#include #include using namespace std; @@ -104,4 +105,14 @@ BOOST_AUTO_TEST_CASE(pmt_test1) } } +BOOST_AUTO_TEST_CASE(pmt_malleability) +{ + std::vector vTxid = boost::assign::list_of(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(9)(10); + std::vector vMatch = boost::assign::list_of(false)(false)(false)(false)(false)(false)(false)(false)(false)(true)(true)(false); + + CPartialMerkleTree tree(vTxid, vMatch); + std::vector vTxid2; + BOOST_CHECK(tree.ExtractMatches(vTxid) == 0); +} + BOOST_AUTO_TEST_SUITE_END() From 26a6bae7537c73cb4b713293ce29b7c6d71a542d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jan=C3=ADk?= Date: Mon, 15 Dec 2014 11:06:15 +0100 Subject: [PATCH 12/88] Add time offset to getpeerinfo output --- src/main.cpp | 4 +++- src/net.cpp | 2 ++ src/net.h | 2 ++ src/rpcnet.cpp | 2 ++ src/timedata.cpp | 4 +--- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 7533c3261..d917c6e0e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3450,7 +3450,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, pfrom->nStartingHeight, addrMe.ToString(), pfrom->id, remoteAddr); - AddTimeData(pfrom->addr, nTime); + int64_t nTimeOffset = nTime - GetTime(); + pfrom->nTimeOffset = nTimeOffset; + AddTimeData(pfrom->addr, nTimeOffset); } diff --git a/src/net.cpp b/src/net.cpp index 42b3c30fb..95524a8b0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -523,6 +523,7 @@ void CNode::copyStats(CNodeStats &stats) X(nLastSend); X(nLastRecv); X(nTimeConnected); + X(nTimeOffset); X(addrName); X(nVersion); X(cleanSubVer); @@ -1934,6 +1935,7 @@ CNode::CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn, bool fIn nSendBytes = 0; nRecvBytes = 0; nTimeConnected = GetTime(); + nTimeOffset = 0; addr = addrIn; addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; nVersion = 0; diff --git a/src/net.h b/src/net.h index a475be0b3..af200cf89 100644 --- a/src/net.h +++ b/src/net.h @@ -154,6 +154,7 @@ public: int64_t nLastSend; int64_t nLastRecv; int64_t nTimeConnected; + int64_t nTimeOffset; std::string addrName; int nVersion; std::string cleanSubVer; @@ -235,6 +236,7 @@ public: int64_t nLastSend; int64_t nLastRecv; int64_t nTimeConnected; + int64_t nTimeOffset; CAddress addr; std::string addrName; CService addrLocal; diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 6ddbd62fc..e579856b1 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -91,6 +91,7 @@ Value getpeerinfo(const Array& params, bool fHelp) " \"bytessent\": n, (numeric) The total bytes sent\n" " \"bytesrecv\": n, (numeric) The total bytes received\n" " \"conntime\": ttt, (numeric) The connection time in seconds since epoch (Jan 1 1970 GMT)\n" + " \"timeoffset\": ttt, (numeric) The time offset in seconds\n" " \"pingtime\": n, (numeric) ping time\n" " \"pingwait\": n, (numeric) ping wait\n" " \"version\": v, (numeric) The peer version, such as 7001\n" @@ -131,6 +132,7 @@ Value getpeerinfo(const Array& params, bool fHelp) obj.push_back(Pair("bytessent", stats.nSendBytes)); obj.push_back(Pair("bytesrecv", stats.nRecvBytes)); obj.push_back(Pair("conntime", stats.nTimeConnected)); + obj.push_back(Pair("timeoffset", stats.nTimeOffset)); obj.push_back(Pair("pingtime", stats.dPingTime)); if (stats.dPingWait > 0.0) obj.push_back(Pair("pingwait", stats.dPingWait)); diff --git a/src/timedata.cpp b/src/timedata.cpp index 59f7778db..2192ed2ef 100644 --- a/src/timedata.cpp +++ b/src/timedata.cpp @@ -40,10 +40,8 @@ static int64_t abs64(int64_t n) return (n >= 0 ? n : -n); } -void AddTimeData(const CNetAddr& ip, int64_t nTime) +void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample) { - int64_t nOffsetSample = nTime - GetTime(); - LOCK(cs_nTimeOffset); // Ignore duplicates static set setKnown; From 73caf47dfe9c398aac75b5f6bcd1e0a644479a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jan=C3=ADk?= Date: Mon, 15 Dec 2014 11:07:55 +0100 Subject: [PATCH 13/88] Display time offset in the debug window's Peers tab --- src/qt/forms/rpcconsole.ui | 25 ++++++++++++++++++++++++- src/qt/guiutil.cpp | 5 +++++ src/qt/guiutil.h | 5 ++++- src/qt/rpcconsole.cpp | 1 + 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index c5ac37161..c3cb20750 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -1043,7 +1043,30 @@ - + + + + Time Offset + + + + + + + IBeamCursor + + + N/A + + + Qt::PlainText + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + Qt::Vertical diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index a1ae756c4..98c556db7 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -843,4 +843,9 @@ QString formatPingTime(double dPingTime) return dPingTime == 0 ? QObject::tr("N/A") : QString(QObject::tr("%1 ms")).arg(QString::number((int)(dPingTime * 1000), 10)); } +QString formatTimeOffset(int64_t nTimeOffset) +{ + return QString(QObject::tr("%1 s")).arg(QString::number((int)nTimeOffset, 10)); +} + } // namespace GUIUtil diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 09c79db2d..d39fad7d8 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -188,7 +188,10 @@ namespace GUIUtil /* Format a CNodeCombinedStats.dPingTime into a user-readable string or display N/A, if 0*/ QString formatPingTime(double dPingTime); - + + /* Format a CNodeCombinedStats.nTimeOffset into a user-readable string. */ + QString formatTimeOffset(int64_t nTimeOffset); + #if defined(Q_OS_MAC) && QT_VERSION >= 0x050000 // workaround for Qt OSX Bug: // https://bugreports.qt-project.org/browse/QTBUG-15631 diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 2d2d448b4..4b7c5a963 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -607,6 +607,7 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats) ui->peerBytesRecv->setText(FormatBytes(stats->nodeStats.nRecvBytes)); ui->peerConnTime->setText(GUIUtil::formatDurationStr(GetTime() - stats->nodeStats.nTimeConnected)); ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingTime)); + ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset)); ui->peerVersion->setText(QString("%1").arg(stats->nodeStats.nVersion)); ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer)); ui->peerDirection->setText(stats->nodeStats.fInbound ? tr("Inbound") : tr("Outbound")); From 64849306905e625fd44d297e8d58c3e1dd98cb90 Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Mon, 15 Dec 2014 14:38:25 -0800 Subject: [PATCH 14/88] Apply AreSane() checks to the fees from the network. 'Sane' was already defined by this code as: fee.GetFeePerK() > minRelayFee.GetFeePerK() * 10000 But sanity was only enforced for data loaded from disk. Note that this is a pretty expansive definition of 'sane': A 10 BTC fee is still passes the test if its on a 100kb transaction. This prevents a single insane fee on the network from making us reject our stored fee data at start. We still may reject valid saved fee state if minRelayFee is changed between executions. This also reduces the risk and limits the damage from a cascading failure where one party pays a bunch of insane fees which cases others to pay insane fees. --- src/txmempool.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 840eb536b..dcdf5653f 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -91,22 +91,32 @@ public: * Used as belt-and-suspenders check when reading to detect * file corruption */ - bool AreSane(const std::vector& vecFee, const CFeeRate& minRelayFee) + static bool AreSane(const CFeeRate fee, const CFeeRate& minRelayFee) + { + if (fee < CFeeRate(0)) + return false; + if (fee.GetFeePerK() > minRelayFee.GetFeePerK() * 10000) + return false; + return true; + } + static bool AreSane(const std::vector& vecFee, const CFeeRate& minRelayFee) { BOOST_FOREACH(CFeeRate fee, vecFee) { - if (fee < CFeeRate(0)) - return false; - if (fee.GetFeePerK() > minRelayFee.GetFeePerK() * 10000) + if (!AreSane(fee, minRelayFee)) return false; } return true; } - bool AreSane(const std::vector vecPriority) + static bool AreSane(const double priority) + { + return priority >= 0; + } + static bool AreSane(const std::vector vecPriority) { BOOST_FOREACH(double priority, vecPriority) { - if (priority < 0) + if (!AreSane(priority)) return false; } return true; @@ -167,12 +177,12 @@ private: bool sufficientFee = (feeRate > minRelayFee); bool sufficientPriority = AllowFree(dPriority); const char* assignedTo = "unassigned"; - if (sufficientFee && !sufficientPriority) + if (sufficientFee && !sufficientPriority && CBlockAverage::AreSane(feeRate, minRelayFee)) { history[nBlocksTruncated].RecordFee(feeRate); assignedTo = "fee"; } - else if (sufficientPriority && !sufficientFee) + else if (sufficientPriority && !sufficientFee && CBlockAverage::AreSane(dPriority)) { history[nBlocksTruncated].RecordPriority(dPriority); assignedTo = "priority"; From 78253fcbad69b28f1c0c3cfc7f8dcaecbb68c390 Mon Sep 17 00:00:00 2001 From: Michael Ford Date: Sat, 13 Dec 2014 12:09:33 +0800 Subject: [PATCH 15/88] Remove references to X11 licence --- contrib/bitcoind.bash-completion | 2 +- contrib/devtools/symbol-check.py | 2 +- contrib/devtools/update-translations.py | 2 +- contrib/linearize/linearize-data.py | 2 +- contrib/linearize/linearize-hashes.py | 2 +- doc/README.md | 2 +- doc/README_windows.txt | 2 +- qa/rpc-tests/wallet.py | 2 +- qa/rpc-tests/walletbackup.py | 2 +- src/alert.h | 2 +- src/allocators.cpp | 2 +- src/allocators.h | 2 +- src/bitcoin-cli-res.rc | 2 +- src/bitcoin-cli.cpp | 2 +- src/bitcoin-tx.cpp | 2 +- src/bitcoind-res.rc | 2 +- src/bitcoind.cpp | 2 +- src/coincontrol.h | 2 +- src/compat.h | 2 +- src/core_io.h | 2 +- src/core_read.cpp | 2 +- src/core_write.cpp | 2 +- src/crypter.cpp | 2 +- src/db.cpp | 2 +- src/miner.cpp | 2 +- src/miner.h | 2 +- src/mruset.h | 2 +- src/net.cpp | 2 +- src/net.h | 2 +- src/netbase.cpp | 2 +- src/netbase.h | 2 +- src/noui.cpp | 2 +- src/noui.h | 2 +- src/pow.cpp | 2 +- src/pow.h | 2 +- src/primitives/block.cpp | 2 +- src/primitives/block.h | 2 +- src/protocol.cpp | 2 +- src/protocol.h | 2 +- src/qt/addressbookpage.cpp | 2 +- src/qt/addressbookpage.h | 2 +- src/qt/addresstablemodel.cpp | 2 +- src/qt/addresstablemodel.h | 2 +- src/qt/askpassphrasedialog.cpp | 2 +- src/qt/askpassphrasedialog.h | 2 +- src/qt/bitcoin.cpp | 2 +- src/qt/bitcoinaddressvalidator.cpp | 2 +- src/qt/bitcoinaddressvalidator.h | 2 +- src/qt/bitcoinamountfield.cpp | 2 +- src/qt/bitcoinamountfield.h | 2 +- src/qt/bitcoingui.cpp | 2 +- src/qt/bitcoingui.h | 2 +- src/qt/bitcoinunits.cpp | 2 +- src/qt/bitcoinunits.h | 2 +- src/qt/clientmodel.cpp | 2 +- src/qt/clientmodel.h | 2 +- src/qt/coincontroldialog.cpp | 2 +- src/qt/coincontroldialog.h | 2 +- src/qt/coincontroltreewidget.cpp | 2 +- src/qt/coincontroltreewidget.h | 2 +- src/qt/csvmodelwriter.cpp | 2 +- src/qt/csvmodelwriter.h | 2 +- src/qt/editaddressdialog.cpp | 2 +- src/qt/editaddressdialog.h | 2 +- src/qt/guiconstants.h | 2 +- src/qt/guiutil.cpp | 2 +- src/qt/guiutil.h | 2 +- src/qt/intro.cpp | 2 +- src/qt/intro.h | 2 +- src/qt/macdockiconhandler.h | 2 +- src/qt/macdockiconhandler.mm | 2 +- src/qt/macnotificationhandler.h | 2 +- src/qt/macnotificationhandler.mm | 2 +- src/qt/notificator.cpp | 2 +- src/qt/notificator.h | 2 +- src/qt/openuridialog.cpp | 2 +- src/qt/openuridialog.h | 2 +- src/qt/optionsdialog.cpp | 2 +- src/qt/optionsdialog.h | 2 +- src/qt/optionsmodel.cpp | 2 +- src/qt/optionsmodel.h | 2 +- src/qt/overviewpage.cpp | 2 +- src/qt/overviewpage.h | 2 +- src/qt/peertablemodel.cpp | 2 +- src/qt/peertablemodel.h | 2 +- src/qt/qvalidatedlineedit.cpp | 2 +- src/qt/qvalidatedlineedit.h | 2 +- src/qt/qvaluecombobox.cpp | 2 +- src/qt/qvaluecombobox.h | 2 +- src/qt/receivecoinsdialog.cpp | 2 +- src/qt/receivecoinsdialog.h | 2 +- src/qt/receiverequestdialog.cpp | 2 +- src/qt/receiverequestdialog.h | 2 +- src/qt/recentrequeststablemodel.cpp | 2 +- src/qt/recentrequeststablemodel.h | 2 +- src/qt/res/bitcoin-qt-res.rc | 2 +- src/qt/rpcconsole.cpp | 2 +- src/qt/rpcconsole.h | 2 +- src/qt/sendcoinsdialog.cpp | 2 +- src/qt/sendcoinsdialog.h | 2 +- src/qt/sendcoinsentry.cpp | 2 +- src/qt/sendcoinsentry.h | 2 +- src/qt/signverifymessagedialog.cpp | 2 +- src/qt/signverifymessagedialog.h | 2 +- src/qt/splashscreen.cpp | 2 +- src/qt/splashscreen.h | 2 +- src/qt/trafficgraphwidget.cpp | 2 +- src/qt/trafficgraphwidget.h | 2 +- src/qt/transactiondesc.cpp | 2 +- src/qt/transactiondesc.h | 2 +- src/qt/transactiondescdialog.cpp | 2 +- src/qt/transactiondescdialog.h | 2 +- src/qt/transactionfilterproxy.cpp | 2 +- src/qt/transactionfilterproxy.h | 2 +- src/qt/transactionrecord.cpp | 2 +- src/qt/transactionrecord.h | 2 +- src/qt/transactiontablemodel.cpp | 2 +- src/qt/transactiontablemodel.h | 2 +- src/qt/transactionview.cpp | 2 +- src/qt/transactionview.h | 2 +- src/qt/utilitydialog.cpp | 2 +- src/qt/utilitydialog.h | 2 +- src/qt/walletframe.cpp | 2 +- src/qt/walletframe.h | 2 +- src/qt/walletmodel.cpp | 2 +- src/qt/walletmodel.h | 2 +- src/qt/walletmodeltransaction.cpp | 2 +- src/qt/walletmodeltransaction.h | 2 +- src/qt/walletview.cpp | 2 +- src/qt/walletview.h | 2 +- src/qt/winshutdownmonitor.cpp | 2 +- src/qt/winshutdownmonitor.h | 2 +- src/random.cpp | 2 +- src/random.h | 2 +- src/streams.h | 2 +- src/sync.cpp | 2 +- src/sync.h | 2 +- src/test/Checkpoints_tests.cpp | 2 +- src/test/DoS_tests.cpp | 2 +- src/test/accounting_tests.cpp | 2 +- src/test/alert_tests.cpp | 2 +- src/test/allocator_tests.cpp | 2 +- src/test/base32_tests.cpp | 2 +- src/test/base58_tests.cpp | 2 +- src/test/base64_tests.cpp | 2 +- src/test/bctest.py | 2 +- src/test/bignum.h | 2 +- src/test/bip32_tests.cpp | 2 +- src/test/bitcoin-util-test.py | 2 +- src/test/bloom_tests.cpp | 2 +- src/test/checkblock_tests.cpp | 2 +- src/test/compress_tests.cpp | 2 +- src/test/crypto_tests.cpp | 2 +- src/test/data/README.md | 2 +- src/test/getarg_tests.cpp | 2 +- src/test/hash_tests.cpp | 2 +- src/test/key_tests.cpp | 2 +- src/test/main_tests.cpp | 2 +- src/test/miner_tests.cpp | 2 +- src/test/mruset_tests.cpp | 2 +- src/test/multisig_tests.cpp | 2 +- src/test/netbase_tests.cpp | 2 +- src/test/pmt_tests.cpp | 2 +- src/test/rpc_tests.cpp | 2 +- src/test/rpc_wallet_tests.cpp | 2 +- src/test/script_P2SH_tests.cpp | 2 +- src/test/scriptnum_tests.cpp | 2 +- src/test/serialize_tests.cpp | 2 +- src/test/sighash_tests.cpp | 2 +- src/test/sigopcount_tests.cpp | 2 +- src/test/skiplist_tests.cpp | 2 +- src/test/test_bitcoin.cpp | 2 +- src/test/timedata_tests.cpp | 2 +- src/test/transaction_tests.cpp | 2 +- src/test/uint256_tests.cpp | 2 +- src/test/univalue_tests.cpp | 2 +- src/test/util_tests.cpp | 2 +- src/test/wallet_tests.cpp | 2 +- src/threadsafety.h | 2 +- src/txdb.cpp | 2 +- src/ui_interface.h | 2 +- src/uint256.cpp | 2 +- src/univalue/gen.cpp | 2 +- src/univalue/univalue.cpp | 2 +- src/univalue/univalue.h | 2 +- src/univalue/univalue_read.cpp | 2 +- src/univalue/univalue_write.cpp | 2 +- src/walletdb.cpp | 2 +- src/walletdb.h | 2 +- 189 files changed, 189 insertions(+), 189 deletions(-) diff --git a/contrib/bitcoind.bash-completion b/contrib/bitcoind.bash-completion index 37ece2589..3cc959c0a 100644 --- a/contrib/bitcoind.bash-completion +++ b/contrib/bitcoind.bash-completion @@ -1,6 +1,6 @@ # bash programmable completion for bitcoind(1) and bitcoin-cli(1) # Copyright (c) 2012,2014 Christian von Roques -# Distributed under the MIT/X11 software license, see the accompanying +# Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. have bitcoind && { diff --git a/contrib/devtools/symbol-check.py b/contrib/devtools/symbol-check.py index f3999f1c0..fad891f80 100755 --- a/contrib/devtools/symbol-check.py +++ b/contrib/devtools/symbol-check.py @@ -1,6 +1,6 @@ #!/usr/bin/python # Copyright (c) 2014 Wladimir J. van der Laan -# Distributed under the MIT/X11 software license, see the accompanying +# Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' A script to check that the (Linux) executables produced by gitian only contain diff --git a/contrib/devtools/update-translations.py b/contrib/devtools/update-translations.py index 0be632069..f955e4a1f 100755 --- a/contrib/devtools/update-translations.py +++ b/contrib/devtools/update-translations.py @@ -1,6 +1,6 @@ #!/usr/bin/python # Copyright (c) 2014 Wladimir J. van der Laan -# Distributed under the MIT/X11 software license, see the accompanying +# Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Run this script from the root of the repository to update all translations from diff --git a/contrib/linearize/linearize-data.py b/contrib/linearize/linearize-data.py index f59fe9f6e..4079844e3 100755 --- a/contrib/linearize/linearize-data.py +++ b/contrib/linearize/linearize-data.py @@ -3,7 +3,7 @@ # linearize-data.py: Construct a linear, no-fork version of the chain. # # Copyright (c) 2013-2014 The Bitcoin developers -# Distributed under the MIT/X11 software license, see the accompanying +# Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # diff --git a/contrib/linearize/linearize-hashes.py b/contrib/linearize/linearize-hashes.py index dc7f65404..707dfcf87 100755 --- a/contrib/linearize/linearize-hashes.py +++ b/contrib/linearize/linearize-hashes.py @@ -3,7 +3,7 @@ # linearize-hashes.py: List blocks in a linear, no-fork version of the chain. # # Copyright (c) 2013-2014 The Bitcoin developers -# Distributed under the MIT/X11 software license, see the accompanying +# Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # diff --git a/doc/README.md b/doc/README.md index 3ec5f11df..812d8bf1f 100644 --- a/doc/README.md +++ b/doc/README.md @@ -71,6 +71,6 @@ The Bitcoin repo's [root README](https://github.com/bitcoin/bitcoin/blob/master/ License --------------------- -Distributed under the [MIT/X11 software license](http://www.opensource.org/licenses/mit-license.php). +Distributed under the [MIT software license](http://www.opensource.org/licenses/mit-license.php). This product includes software developed by the OpenSSL Project for use in the [OpenSSL Toolkit](https://www.openssl.org/). This product includes cryptographic software written by Eric Young ([eay@cryptsoft.com](mailto:eay@cryptsoft.com)), and UPnP software written by Thomas Bernard. diff --git a/doc/README_windows.txt b/doc/README_windows.txt index 9780a2cb1..226ce4576 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -2,7 +2,7 @@ Bitcoin 0.10.99 BETA Copyright (c) 2009-2014 Bitcoin Core Developers -Distributed under the MIT/X11 software license, see the accompanying +Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (https://www.openssl.org/). This product includes diff --git a/qa/rpc-tests/wallet.py b/qa/rpc-tests/wallet.py index bf71d5ebc..d99540b58 100755 --- a/qa/rpc-tests/wallet.py +++ b/qa/rpc-tests/wallet.py @@ -1,6 +1,6 @@ #!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers -# Distributed under the MIT/X11 software license, see the accompanying +# Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # diff --git a/qa/rpc-tests/walletbackup.py b/qa/rpc-tests/walletbackup.py index 6a42d9dfa..049697c2d 100755 --- a/qa/rpc-tests/walletbackup.py +++ b/qa/rpc-tests/walletbackup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers -# Distributed under the MIT/X11 software license, see the accompanying +# Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ diff --git a/src/alert.h b/src/alert.h index 96c203b55..de4aad814 100644 --- a/src/alert.h +++ b/src/alert.h @@ -1,6 +1,6 @@ // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_ALERT_H diff --git a/src/allocators.cpp b/src/allocators.cpp index dfe26f1b1..b1a6a8f98 100644 --- a/src/allocators.cpp +++ b/src/allocators.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "allocators.h" diff --git a/src/allocators.h b/src/allocators.h index 78a3b76d0..599a4ddc4 100644 --- a/src/allocators.h +++ b/src/allocators.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_ALLOCATORS_H diff --git a/src/bitcoin-cli-res.rc b/src/bitcoin-cli-res.rc index b1aa1b0e1..4ea1f38e4 100644 --- a/src/bitcoin-cli-res.rc +++ b/src/bitcoin-cli-res.rc @@ -21,7 +21,7 @@ BEGIN VALUE "FileVersion", VER_FILEVERSION_STR VALUE "InternalName", "bitcoin-cli" VALUE "LegalCopyright", COPYRIGHT_STR - VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." + VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." VALUE "OriginalFilename", "bitcoin-cli.exe" VALUE "ProductName", "Bitcoin-cli" VALUE "ProductVersion", VER_PRODUCTVERSION_STR diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index ea349b197..e7e04b3ec 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chainparamsbase.h" diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 7308d9366..582f04f3d 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" diff --git a/src/bitcoind-res.rc b/src/bitcoind-res.rc index 2e6d75449..d183179b1 100644 --- a/src/bitcoind-res.rc +++ b/src/bitcoind-res.rc @@ -21,7 +21,7 @@ BEGIN VALUE "FileVersion", VER_FILEVERSION_STR VALUE "InternalName", "bitcoind" VALUE "LegalCopyright", COPYRIGHT_STR - VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." + VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." VALUE "OriginalFilename", "bitcoind.exe" VALUE "ProductName", "Bitcoind" VALUE "ProductVersion", VER_PRODUCTVERSION_STR diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index be7757b0b..ea945f54f 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "clientversion.h" diff --git a/src/coincontrol.h b/src/coincontrol.h index cf6199872..634cc3a29 100644 --- a/src/coincontrol.h +++ b/src/coincontrol.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_COINCONTROL_H diff --git a/src/compat.h b/src/compat.h index dffd4ecf5..44bf0d1ff 100644 --- a/src/compat.h +++ b/src/compat.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_COMPAT_H diff --git a/src/core_io.h b/src/core_io.h index aba1928a3..c805dbc6d 100644 --- a/src/core_io.h +++ b/src/core_io.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CORE_IO_H diff --git a/src/core_read.cpp b/src/core_read.cpp index 65c3a08c5..1de92594c 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "core_io.h" diff --git a/src/core_write.cpp b/src/core_write.cpp index 760b6a71b..400b4c623 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "core_io.h" diff --git a/src/crypter.cpp b/src/crypter.cpp index 756538836..de32dc412 100644 --- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypter.h" diff --git a/src/db.cpp b/src/db.cpp index 12650e459..cb24912fe 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "db.h" diff --git a/src/miner.cpp b/src/miner.cpp index ad2943142..ce6752567 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "miner.h" diff --git a/src/miner.h b/src/miner.h index aede0e6d4..998ea57a7 100644 --- a/src/miner.h +++ b/src/miner.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_MINER_H diff --git a/src/mruset.h b/src/mruset.h index 1691875f5..bf7c7fdee 100644 --- a/src/mruset.h +++ b/src/mruset.h @@ -1,5 +1,5 @@ // Copyright (c) 2012 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_MRUSET_H diff --git a/src/net.cpp b/src/net.cpp index 42b3c30fb..e6a066a4e 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) diff --git a/src/net.h b/src/net.h index a475be0b3..c705a85c8 100644 --- a/src/net.h +++ b/src/net.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_NET_H diff --git a/src/netbase.cpp b/src/netbase.cpp index 053c645a1..1fc3334b7 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifdef HAVE_CONFIG_H diff --git a/src/netbase.h b/src/netbase.h index 09fe09494..fe5d64320 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_NETBASE_H diff --git a/src/noui.cpp b/src/noui.cpp index 8f3b0275b..630b095d0 100644 --- a/src/noui.cpp +++ b/src/noui.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "noui.h" diff --git a/src/noui.h b/src/noui.h index dbd4320fa..c7e4aaa1e 100644 --- a/src/noui.h +++ b/src/noui.h @@ -1,5 +1,5 @@ // Copyright (c) 2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_NOUI_H diff --git a/src/pow.cpp b/src/pow.cpp index bdcfa852f..3b41083f9 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "pow.h" diff --git a/src/pow.h b/src/pow.h index cf28656bd..293634be6 100644 --- a/src/pow.h +++ b/src/pow.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_POW_H diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index 225bb80be..cf7a392a3 100644 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "primitives/block.h" diff --git a/src/primitives/block.h b/src/primitives/block.h index a18959253..9c0a6decc 100644 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_PRIMITIVES_BLOCK_H diff --git a/src/protocol.cpp b/src/protocol.cpp index 72fdd753a..f8f43a05f 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "protocol.h" diff --git a/src/protocol.h b/src/protocol.h index 2ac8f3d8f..e578c1ec9 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef __cplusplus diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index f336d47e8..303c7c233 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h index 031c42478..b3c308dc0 100644 --- a/src/qt/addressbookpage.h +++ b/src/qt/addressbookpage.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_ADDRESSBOOKPAGE_H diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 8d5284d5e..c42a55ec2 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "addresstablemodel.h" diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h index 310647d7c..33504e0c6 100644 --- a/src/qt/addresstablemodel.h +++ b/src/qt/addresstablemodel.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_ADDRESSTABLEMODEL_H diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index fa9ac6b13..dbfab0e93 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "askpassphrasedialog.h" diff --git a/src/qt/askpassphrasedialog.h b/src/qt/askpassphrasedialog.h index 660508606..bedbea213 100644 --- a/src/qt/askpassphrasedialog.h +++ b/src/qt/askpassphrasedialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_ASKPASSPHRASEDIALOG_H diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 123777a71..962a44f07 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) diff --git a/src/qt/bitcoinaddressvalidator.cpp b/src/qt/bitcoinaddressvalidator.cpp index 293cc168b..d7c4d2706 100644 --- a/src/qt/bitcoinaddressvalidator.cpp +++ b/src/qt/bitcoinaddressvalidator.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bitcoinaddressvalidator.h" diff --git a/src/qt/bitcoinaddressvalidator.h b/src/qt/bitcoinaddressvalidator.h index 15a6245da..568926608 100644 --- a/src/qt/bitcoinaddressvalidator.h +++ b/src/qt/bitcoinaddressvalidator.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_BITCOINADDRESSVALIDATOR_H diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 5b8ab23b2..408634dec 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bitcoinamountfield.h" diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h index 1bad8ce1b..4bab91eaf 100644 --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_BITCOINAMOUNTFIELD_H diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 6a457d361..4366a42ff 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bitcoingui.h" diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 662ef9d9e..7cda8c15c 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_BITCOINGUI_H diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index 5c542b59a..863d4a01a 100644 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bitcoinunits.h" diff --git a/src/qt/bitcoinunits.h b/src/qt/bitcoinunits.h index 7a4f38274..c40fd8b16 100644 --- a/src/qt/bitcoinunits.h +++ b/src/qt/bitcoinunits.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_BITCOINUNITS_H diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index aedda4907..a121ec587 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "clientmodel.h" diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index c7a05e287..5a8b43660 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_CLIENTMODEL_H diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 85b43b7b1..5647661ba 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "coincontroldialog.h" diff --git a/src/qt/coincontroldialog.h b/src/qt/coincontroldialog.h index bd4f5d7f1..8945bf180 100644 --- a/src/qt/coincontroldialog.h +++ b/src/qt/coincontroldialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_COINCONTROLDIALOG_H diff --git a/src/qt/coincontroltreewidget.cpp b/src/qt/coincontroltreewidget.cpp index 907b5caa0..bb8f385bb 100644 --- a/src/qt/coincontroltreewidget.cpp +++ b/src/qt/coincontroltreewidget.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "coincontroltreewidget.h" diff --git a/src/qt/coincontroltreewidget.h b/src/qt/coincontroltreewidget.h index 643eaf0c7..e9bfe2352 100644 --- a/src/qt/coincontroltreewidget.h +++ b/src/qt/coincontroltreewidget.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_COINCONTROLTREEWIDGET_H diff --git a/src/qt/csvmodelwriter.cpp b/src/qt/csvmodelwriter.cpp index ac8c6b41d..a99885019 100644 --- a/src/qt/csvmodelwriter.cpp +++ b/src/qt/csvmodelwriter.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "csvmodelwriter.h" diff --git a/src/qt/csvmodelwriter.h b/src/qt/csvmodelwriter.h index c613ce73e..d3cf5d732 100644 --- a/src/qt/csvmodelwriter.h +++ b/src/qt/csvmodelwriter.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_CSVMODELWRITER_H diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp index 46982cc33..2be7598e7 100644 --- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "editaddressdialog.h" diff --git a/src/qt/editaddressdialog.h b/src/qt/editaddressdialog.h index aa1103a2f..e25db7a11 100644 --- a/src/qt/editaddressdialog.h +++ b/src/qt/editaddressdialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_EDITADDRESSDIALOG_H diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h index 8f3e476fd..819e5c9e2 100644 --- a/src/qt/guiconstants.h +++ b/src/qt/guiconstants.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_GUICONSTANTS_H diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index a1ae756c4..5adf17361 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "guiutil.h" diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 09c79db2d..73b63789b 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_GUIUTIL_H diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 7618bff69..5cf53cdcb 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "intro.h" diff --git a/src/qt/intro.h b/src/qt/intro.h index c9c0d448f..03974841b 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_INTRO_H diff --git a/src/qt/macdockiconhandler.h b/src/qt/macdockiconhandler.h index 1ffab75c9..989136984 100644 --- a/src/qt/macdockiconhandler.h +++ b/src/qt/macdockiconhandler.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_MACDOCKICONHANDLER_H diff --git a/src/qt/macdockiconhandler.mm b/src/qt/macdockiconhandler.mm index a2ff148d9..e7b58b9cc 100644 --- a/src/qt/macdockiconhandler.mm +++ b/src/qt/macdockiconhandler.mm @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "macdockiconhandler.h" diff --git a/src/qt/macnotificationhandler.h b/src/qt/macnotificationhandler.h index f7a4cb7f5..c08c32799 100644 --- a/src/qt/macnotificationhandler.h +++ b/src/qt/macnotificationhandler.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_MACNOTIFICATIONHANDLER_H diff --git a/src/qt/macnotificationhandler.mm b/src/qt/macnotificationhandler.mm index aa50a0d9f..dd3f62281 100644 --- a/src/qt/macnotificationhandler.mm +++ b/src/qt/macnotificationhandler.mm @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "macnotificationhandler.h" diff --git a/src/qt/notificator.cpp b/src/qt/notificator.cpp index 3d588cd31..86b205ed8 100644 --- a/src/qt/notificator.cpp +++ b/src/qt/notificator.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "notificator.h" diff --git a/src/qt/notificator.h b/src/qt/notificator.h index 61c27e7ff..a7605f83b 100644 --- a/src/qt/notificator.h +++ b/src/qt/notificator.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_NOTIFICATOR_H diff --git a/src/qt/openuridialog.cpp b/src/qt/openuridialog.cpp index 06189aeaf..a1de7acea 100644 --- a/src/qt/openuridialog.cpp +++ b/src/qt/openuridialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "openuridialog.h" diff --git a/src/qt/openuridialog.h b/src/qt/openuridialog.h index f04ec71b3..4f4fdccaf 100644 --- a/src/qt/openuridialog.h +++ b/src/qt/openuridialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_OPENURIDIALOG_H diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 069080219..8ce9fd7a6 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h index 511719f53..019749150 100644 --- a/src/qt/optionsdialog.h +++ b/src/qt/optionsdialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_OPTIONSDIALOG_H diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 7054509fe..1e11de3c1 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index 84fd49a7b..061ae1ad9 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_OPTIONSMODEL_H diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 669d5474f..18c900d02 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "overviewpage.h" diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index e889eae8b..803816fa4 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_OVERVIEWPAGE_H diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index cfa05300c..7840b9283 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "peertablemodel.h" diff --git a/src/qt/peertablemodel.h b/src/qt/peertablemodel.h index 23e71fc68..ac3a18c05 100644 --- a/src/qt/peertablemodel.h +++ b/src/qt/peertablemodel.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_PEERTABLEMODEL_H diff --git a/src/qt/qvalidatedlineedit.cpp b/src/qt/qvalidatedlineedit.cpp index c2567835c..d960e4b19 100644 --- a/src/qt/qvalidatedlineedit.cpp +++ b/src/qt/qvalidatedlineedit.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "qvalidatedlineedit.h" diff --git a/src/qt/qvalidatedlineedit.h b/src/qt/qvalidatedlineedit.h index 0996164b0..810d5f276 100644 --- a/src/qt/qvalidatedlineedit.h +++ b/src/qt/qvalidatedlineedit.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_QVALIDATEDLINEEDIT_H diff --git a/src/qt/qvaluecombobox.cpp b/src/qt/qvaluecombobox.cpp index ad083f635..8c578dfa5 100644 --- a/src/qt/qvaluecombobox.cpp +++ b/src/qt/qvaluecombobox.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "qvaluecombobox.h" diff --git a/src/qt/qvaluecombobox.h b/src/qt/qvaluecombobox.h index 821f41716..62b1d90dd 100644 --- a/src/qt/qvaluecombobox.h +++ b/src/qt/qvaluecombobox.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_QVALUECOMBOBOX_H diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index f2c76c835..ee3a046aa 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "receivecoinsdialog.h" diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h index 220fb5c7a..ae93b5aa8 100644 --- a/src/qt/receivecoinsdialog.h +++ b/src/qt/receivecoinsdialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_RECEIVECOINSDIALOG_H diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index cc2f00916..9d932cfc9 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "receiverequestdialog.h" diff --git a/src/qt/receiverequestdialog.h b/src/qt/receiverequestdialog.h index 6f3b9838e..b69ef4257 100644 --- a/src/qt/receiverequestdialog.h +++ b/src/qt/receiverequestdialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_RECEIVEREQUESTDIALOG_H diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index 5533adab8..adc4e115e 100644 --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "recentrequeststablemodel.h" diff --git a/src/qt/recentrequeststablemodel.h b/src/qt/recentrequeststablemodel.h index ec6a49070..741a8148f 100644 --- a/src/qt/recentrequeststablemodel.h +++ b/src/qt/recentrequeststablemodel.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H diff --git a/src/qt/res/bitcoin-qt-res.rc b/src/qt/res/bitcoin-qt-res.rc index 809235be5..d71438d21 100644 --- a/src/qt/res/bitcoin-qt-res.rc +++ b/src/qt/res/bitcoin-qt-res.rc @@ -24,7 +24,7 @@ BEGIN VALUE "FileVersion", VER_FILEVERSION_STR VALUE "InternalName", "bitcoin-qt" VALUE "LegalCopyright", COPYRIGHT_STR - VALUE "LegalTrademarks1", "Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." + VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." VALUE "OriginalFilename", "bitcoin-qt.exe" VALUE "ProductName", "Bitcoin Core" VALUE "ProductVersion", VER_PRODUCTVERSION_STR diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 2d2d448b4..6f2efa009 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpcconsole.h" diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 4bb9b62e9..eda103329 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_RPCCONSOLE_H diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 46eb58ca4..0e331e21d 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "sendcoinsdialog.h" diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h index 15d39782a..9db9252f7 100644 --- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_SENDCOINSDIALOG_H diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 52545c385..6a7108199 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "sendcoinsentry.h" diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index 69ad1032d..b3d846c94 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_SENDCOINSENTRY_H diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp index d4d021e21..c793262ad 100644 --- a/src/qt/signverifymessagedialog.cpp +++ b/src/qt/signverifymessagedialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "signverifymessagedialog.h" diff --git a/src/qt/signverifymessagedialog.h b/src/qt/signverifymessagedialog.h index 36550edc8..d8e240b55 100644 --- a/src/qt/signverifymessagedialog.h +++ b/src/qt/signverifymessagedialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_SIGNVERIFYMESSAGEDIALOG_H diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index b4b81440c..f65ceac62 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "splashscreen.h" diff --git a/src/qt/splashscreen.h b/src/qt/splashscreen.h index 4d9651f02..63eb0714c 100644 --- a/src/qt/splashscreen.h +++ b/src/qt/splashscreen.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_SPLASHSCREEN_H diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index 5f14b8079..a1a03b297 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "trafficgraphwidget.h" diff --git a/src/qt/trafficgraphwidget.h b/src/qt/trafficgraphwidget.h index 50571e0b2..18336de94 100644 --- a/src/qt/trafficgraphwidget.h +++ b/src/qt/trafficgraphwidget.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_TRAFFICGRAPHWIDGET_H diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 1efad8259..ed8be628a 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "transactiondesc.h" diff --git a/src/qt/transactiondesc.h b/src/qt/transactiondesc.h index fc958a097..04f54ba08 100644 --- a/src/qt/transactiondesc.h +++ b/src/qt/transactiondesc.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_TRANSACTIONDESC_H diff --git a/src/qt/transactiondescdialog.cpp b/src/qt/transactiondescdialog.cpp index 5ca575fdd..56e1fc050 100644 --- a/src/qt/transactiondescdialog.cpp +++ b/src/qt/transactiondescdialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "transactiondescdialog.h" diff --git a/src/qt/transactiondescdialog.h b/src/qt/transactiondescdialog.h index c12c18e82..f10a13621 100644 --- a/src/qt/transactiondescdialog.h +++ b/src/qt/transactiondescdialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_TRANSACTIONDESCDIALOG_H diff --git a/src/qt/transactionfilterproxy.cpp b/src/qt/transactionfilterproxy.cpp index 2a0f621d1..67733d311 100644 --- a/src/qt/transactionfilterproxy.cpp +++ b/src/qt/transactionfilterproxy.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "transactionfilterproxy.h" diff --git a/src/qt/transactionfilterproxy.h b/src/qt/transactionfilterproxy.h index 5836b114a..42f4df4d6 100644 --- a/src/qt/transactionfilterproxy.h +++ b/src/qt/transactionfilterproxy.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_TRANSACTIONFILTERPROXY_H diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 5278c8673..9905ca76f 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "transactionrecord.h" diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index e26453cda..3accbb26e 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_TRANSACTIONRECORD_H diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 79cb4a629..73e3d9de7 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "transactiontablemodel.h" diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index cfefe4cf1..525b23bfe 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_TRANSACTIONTABLEMODEL_H diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index d15397387..58f33f95a 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "transactionview.h" diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h index be6989ade..baad0fcbf 100644 --- a/src/qt/transactionview.h +++ b/src/qt/transactionview.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_TRANSACTIONVIEW_H diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 58bf04062..929f8156d 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "utilitydialog.h" diff --git a/src/qt/utilitydialog.h b/src/qt/utilitydialog.h index e10b4dc8a..1cbded025 100644 --- a/src/qt/utilitydialog.h +++ b/src/qt/utilitydialog.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_UTILITYDIALOG_H diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index fead02292..4084adc96 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "walletframe.h" diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h index ae8592840..68bd1ce21 100644 --- a/src/qt/walletframe.h +++ b/src/qt/walletframe.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_WALLETFRAME_H diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index b20465794..8355125c4 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "walletmodel.h" diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index d7e391f8d..17f1b9f2e 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_WALLETMODEL_H diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp index e9e20c7d5..a9183d11a 100644 --- a/src/qt/walletmodeltransaction.cpp +++ b/src/qt/walletmodeltransaction.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "walletmodeltransaction.h" diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h index 4272529ab..48bcbc884 100644 --- a/src/qt/walletmodeltransaction.h +++ b/src/qt/walletmodeltransaction.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_WALLETMODELTRANSACTION_H diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 9bab18010..77db9757f 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "walletview.h" diff --git a/src/qt/walletview.h b/src/qt/walletview.h index 95890ccd6..6c2c3ca61 100644 --- a/src/qt/walletview.h +++ b/src/qt/walletview.h @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_WALLETVIEW_H diff --git a/src/qt/winshutdownmonitor.cpp b/src/qt/winshutdownmonitor.cpp index a06f42f66..51391a933 100644 --- a/src/qt/winshutdownmonitor.cpp +++ b/src/qt/winshutdownmonitor.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "winshutdownmonitor.h" diff --git a/src/qt/winshutdownmonitor.h b/src/qt/winshutdownmonitor.h index 26f5d8036..a8176f951 100644 --- a/src/qt/winshutdownmonitor.h +++ b/src/qt/winshutdownmonitor.h @@ -1,5 +1,5 @@ // Copyright (c) 2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_QT_WINSHUTDOWNMONITOR_H diff --git a/src/random.cpp b/src/random.cpp index fc9505ae7..3a1311cb5 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "random.h" diff --git a/src/random.h b/src/random.h index aa55ca2b6..214ee0a79 100644 --- a/src/random.h +++ b/src/random.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_RANDOM_H diff --git a/src/streams.h b/src/streams.h index b07b11eb3..ba074a4c2 100644 --- a/src/streams.h +++ b/src/streams.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_STREAMS_H diff --git a/src/sync.cpp b/src/sync.cpp index ef35c9d64..e2f05e62a 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2012 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "sync.h" diff --git a/src/sync.h b/src/sync.h index cd0aa7b20..29006b3ed 100644 --- a/src/sync.h +++ b/src/sync.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SYNC_H diff --git a/src/test/Checkpoints_tests.cpp b/src/test/Checkpoints_tests.cpp index 8f70f18c7..4ea6a91d5 100644 --- a/src/test/Checkpoints_tests.cpp +++ b/src/test/Checkpoints_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp index f9746fdaa..9407511ec 100644 --- a/src/test/DoS_tests.cpp +++ b/src/test/DoS_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // diff --git a/src/test/accounting_tests.cpp b/src/test/accounting_tests.cpp index af2a9a214..bed63991e 100644 --- a/src/test/accounting_tests.cpp +++ b/src/test/accounting_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "wallet.h" diff --git a/src/test/alert_tests.cpp b/src/test/alert_tests.cpp index 4869ba52a..c77a360d0 100644 --- a/src/test/alert_tests.cpp +++ b/src/test/alert_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // diff --git a/src/test/allocator_tests.cpp b/src/test/allocator_tests.cpp index 69888da3d..991b4ac09 100644 --- a/src/test/allocator_tests.cpp +++ b/src/test/allocator_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util.h" diff --git a/src/test/base32_tests.cpp b/src/test/base32_tests.cpp index 68617abbd..5d20a90ad 100644 --- a/src/test/base32_tests.cpp +++ b/src/test/base32_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "utilstrencodings.h" diff --git a/src/test/base58_tests.cpp b/src/test/base58_tests.cpp index e495435b8..e7d028188 100644 --- a/src/test/base58_tests.cpp +++ b/src/test/base58_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" diff --git a/src/test/base64_tests.cpp b/src/test/base64_tests.cpp index f2bf3326a..9e6cb342c 100644 --- a/src/test/base64_tests.cpp +++ b/src/test/base64_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "utilstrencodings.h" diff --git a/src/test/bctest.py b/src/test/bctest.py index ef461014e..3a8d0ea51 100644 --- a/src/test/bctest.py +++ b/src/test/bctest.py @@ -1,5 +1,5 @@ # Copyright 2014 BitPay, Inc. -# Distributed under the MIT/X11 software license, see the accompanying +# Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import subprocess diff --git a/src/test/bignum.h b/src/test/bignum.h index f64c98720..7ed62606f 100644 --- a/src/test/bignum.h +++ b/src/test/bignum.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_TEST_BIGNUM_H diff --git a/src/test/bip32_tests.cpp b/src/test/bip32_tests.cpp index 9cf07fc38..3d28e06ff 100644 --- a/src/test/bip32_tests.cpp +++ b/src/test/bip32_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include diff --git a/src/test/bitcoin-util-test.py b/src/test/bitcoin-util-test.py index 0eece14cf..20afb16a9 100755 --- a/src/test/bitcoin-util-test.py +++ b/src/test/bitcoin-util-test.py @@ -1,6 +1,6 @@ #!/usr/bin/python # Copyright 2014 BitPay, Inc. -# Distributed under the MIT/X11 software license, see the accompanying +# Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import os diff --git a/src/test/bloom_tests.cpp b/src/test/bloom_tests.cpp index 2de226fdd..c32098efa 100644 --- a/src/test/bloom_tests.cpp +++ b/src/test/bloom_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bloom.h" diff --git a/src/test/checkblock_tests.cpp b/src/test/checkblock_tests.cpp index fc36b43e1..a4121caa8 100644 --- a/src/test/checkblock_tests.cpp +++ b/src/test/checkblock_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2013-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // diff --git a/src/test/compress_tests.cpp b/src/test/compress_tests.cpp index bf404cf0c..b4e4f2046 100644 --- a/src/test/compress_tests.cpp +++ b/src/test/compress_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "compressor.h" diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp index 26708f507..47bfd710c 100644 --- a/src/test/crypto_tests.cpp +++ b/src/test/crypto_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypto/rfc6979_hmac_sha256.h" diff --git a/src/test/data/README.md b/src/test/data/README.md index f69a021ca..55ac95739 100644 --- a/src/test/data/README.md +++ b/src/test/data/README.md @@ -9,6 +9,6 @@ License The data files in this directory are Copyright (c) 2012-2014 The Bitcoin Core developers - Distributed under the MIT/X11 software license, see the accompanying + Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/test/getarg_tests.cpp b/src/test/getarg_tests.cpp index 8a984304f..5fb0f4ccd 100644 --- a/src/test/getarg_tests.cpp +++ b/src/test/getarg_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util.h" diff --git a/src/test/hash_tests.cpp b/src/test/hash_tests.cpp index b8e290f07..f1ad25e6e 100644 --- a/src/test/hash_tests.cpp +++ b/src/test/hash_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "hash.h" diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp index 43b18ce61..1333aba47 100644 --- a/src/test/key_tests.cpp +++ b/src/test/key_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index bf57dd81d..2a72a220a 100644 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "primitives/transaction.h" diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index 53c2e7b26..44c57a8ea 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "main.h" diff --git a/src/test/mruset_tests.cpp b/src/test/mruset_tests.cpp index 547cd1090..813ec9b8b 100644 --- a/src/test/mruset_tests.cpp +++ b/src/test/mruset_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "mruset.h" diff --git a/src/test/multisig_tests.cpp b/src/test/multisig_tests.cpp index 8d06caa14..42a159cda 100644 --- a/src/test/multisig_tests.cpp +++ b/src/test/multisig_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index c26e73838..936145994 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "netbase.h" diff --git a/src/test/pmt_tests.cpp b/src/test/pmt_tests.cpp index 3b535a84f..807a5d1e5 100644 --- a/src/test/pmt_tests.cpp +++ b/src/test/pmt_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "merkleblock.h" diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index d5475a92b..c7355d1e3 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpcserver.h" diff --git a/src/test/rpc_wallet_tests.cpp b/src/test/rpc_wallet_tests.cpp index 91da0c442..a83bd120c 100644 --- a/src/test/rpc_wallet_tests.cpp +++ b/src/test/rpc_wallet_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2013-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpcserver.h" diff --git a/src/test/script_P2SH_tests.cpp b/src/test/script_P2SH_tests.cpp index a969eefa0..63553556e 100644 --- a/src/test/script_P2SH_tests.cpp +++ b/src/test/script_P2SH_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" diff --git a/src/test/scriptnum_tests.cpp b/src/test/scriptnum_tests.cpp index 5621e1272..cfbaf26e7 100644 --- a/src/test/scriptnum_tests.cpp +++ b/src/test/scriptnum_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "bignum.h" diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp index 59e95f2fd..fe49af711 100644 --- a/src/test/serialize_tests.cpp +++ b/src/test/serialize_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "serialize.h" diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index 8abde887c..a9d2f9e8c 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "data/sighash.json.h" diff --git a/src/test/sigopcount_tests.cpp b/src/test/sigopcount_tests.cpp index 5bf0862c7..332660149 100644 --- a/src/test/sigopcount_tests.cpp +++ b/src/test/sigopcount_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "pubkey.h" diff --git a/src/test/skiplist_tests.cpp b/src/test/skiplist_tests.cpp index a123f1d19..646c7e6ad 100644 --- a/src/test/skiplist_tests.cpp +++ b/src/test/skiplist_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "main.h" diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp index e50218d8e..f2dae99d6 100644 --- a/src/test/test_bitcoin.cpp +++ b/src/test/test_bitcoin.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #define BOOST_TEST_MODULE Bitcoin Test Suite diff --git a/src/test/timedata_tests.cpp b/src/test/timedata_tests.cpp index aa4fa0d50..58ed96327 100644 --- a/src/test/timedata_tests.cpp +++ b/src/test/timedata_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // #include "timedata.h" diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index e939e8997..2594f89ac 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "data/tx_invalid.json.h" diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp index 4b1a2ae58..d05b28956 100644 --- a/src/test/uint256_tests.cpp +++ b/src/test/uint256_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2013 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include diff --git a/src/test/univalue_tests.cpp b/src/test/univalue_tests.cpp index 23bc5f6b1..5f0c1deb8 100644 --- a/src/test/univalue_tests.cpp +++ b/src/test/univalue_tests.cpp @@ -1,5 +1,5 @@ // Copyright 2014 BitPay, Inc. -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index feea14035..1c5778abe 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2011-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util.h" diff --git a/src/test/wallet_tests.cpp b/src/test/wallet_tests.cpp index 90fc470e0..289cc8c90 100644 --- a/src/test/wallet_tests.cpp +++ b/src/test/wallet_tests.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2012-2014 The Bitcoin Core developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "wallet.h" diff --git a/src/threadsafety.h b/src/threadsafety.h index 7515d050e..5409c0301 100644 --- a/src/threadsafety.h +++ b/src/threadsafety.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_THREADSAFETY_H diff --git a/src/txdb.cpp b/src/txdb.cpp index 29ef35037..44f7d15da 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "txdb.h" diff --git a/src/ui_interface.h b/src/ui_interface.h index 1231d5ed0..8d63e0464 100644 --- a/src/ui_interface.h +++ b/src/ui_interface.h @@ -1,6 +1,6 @@ // Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2012 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_UI_INTERFACE_H diff --git a/src/uint256.cpp b/src/uint256.cpp index 79406f247..9dbf68aee 100644 --- a/src/uint256.cpp +++ b/src/uint256.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "uint256.h" diff --git a/src/univalue/gen.cpp b/src/univalue/gen.cpp index f0b352eef..abebe8863 100644 --- a/src/univalue/gen.cpp +++ b/src/univalue/gen.cpp @@ -1,5 +1,5 @@ // Copyright 2014 BitPay Inc. -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // diff --git a/src/univalue/univalue.cpp b/src/univalue/univalue.cpp index b0171e48c..4e445a542 100644 --- a/src/univalue/univalue.cpp +++ b/src/univalue/univalue.cpp @@ -1,5 +1,5 @@ // Copyright 2014 BitPay Inc. -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include diff --git a/src/univalue/univalue.h b/src/univalue/univalue.h index 5ac301d9e..88d73b8c6 100644 --- a/src/univalue/univalue.h +++ b/src/univalue/univalue.h @@ -1,5 +1,5 @@ // Copyright 2014 BitPay Inc. -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_UNIVALUE_UNIVALUE_H diff --git a/src/univalue/univalue_read.cpp b/src/univalue/univalue_read.cpp index 405be3e81..5cea77899 100644 --- a/src/univalue/univalue_read.cpp +++ b/src/univalue/univalue_read.cpp @@ -1,5 +1,5 @@ // Copyright 2014 BitPay Inc. -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include diff --git a/src/univalue/univalue_write.cpp b/src/univalue/univalue_write.cpp index 9565cfa11..9a1d364c9 100644 --- a/src/univalue/univalue_write.cpp +++ b/src/univalue/univalue_write.cpp @@ -1,5 +1,5 @@ // Copyright 2014 BitPay Inc. -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include diff --git a/src/walletdb.cpp b/src/walletdb.cpp index ffddd8106..d2233aeea 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "walletdb.h" diff --git a/src/walletdb.h b/src/walletdb.h index 7ff41c7c8..38699043b 100644 --- a/src/walletdb.h +++ b/src/walletdb.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_WALLETDB_H From 7c8e4c5cfb3dd88bbe89cc14b703d7c59bafed6e Mon Sep 17 00:00:00 2001 From: Daniel Kraft Date: Tue, 16 Dec 2014 13:45:27 +0100 Subject: [PATCH 16/88] Make pass-by-ref arguments const. Make some of the arguments in rest.cpp, that are passed by reference but never modified, const to emphasise that. --- src/rest.cpp | 30 +++++++++++++++--------------- src/rpcserver.h | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/rest.cpp b/src/rest.cpp index c52dbb3cd..69e6c0888 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -90,8 +90,8 @@ static bool ParseHashStr(const string& strReq, uint256& v) } static bool rest_headers(AcceptedConnection* conn, - string& strReq, - map& mapHeaders, + const std::string& strReq, + const std::map& mapHeaders, bool fRun) { vector params; @@ -153,8 +153,8 @@ static bool rest_headers(AcceptedConnection* conn, } static bool rest_block(AcceptedConnection* conn, - string& strReq, - map& mapHeaders, + const std::string& strReq, + const std::map& mapHeaders, bool fRun, bool showTxDetails) { @@ -211,24 +211,24 @@ static bool rest_block(AcceptedConnection* conn, } static bool rest_block_extended(AcceptedConnection* conn, - string& strReq, - map& mapHeaders, + const std::string& strReq, + const std::map& mapHeaders, bool fRun) { return rest_block(conn, strReq, mapHeaders, fRun, true); } static bool rest_block_notxdetails(AcceptedConnection* conn, - string& strReq, - map& mapHeaders, + const std::string& strReq, + const std::map& mapHeaders, bool fRun) { return rest_block(conn, strReq, mapHeaders, fRun, false); } static bool rest_tx(AcceptedConnection* conn, - string& strReq, - map& mapHeaders, + const std::string& strReq, + const std::map& mapHeaders, bool fRun) { vector params; @@ -280,8 +280,8 @@ static bool rest_tx(AcceptedConnection* conn, static const struct { const char* prefix; bool (*handler)(AcceptedConnection* conn, - string& strURI, - map& mapHeaders, + const std::string& strURI, + const std::map& mapHeaders, bool fRun); } uri_prefixes[] = { {"/rest/tx/", rest_tx}, @@ -291,8 +291,8 @@ static const struct { }; bool HTTPReq_REST(AcceptedConnection* conn, - string& strURI, - map& mapHeaders, + const std::string& strURI, + const std::map& mapHeaders, bool fRun) { try { @@ -307,7 +307,7 @@ bool HTTPReq_REST(AcceptedConnection* conn, return uri_prefixes[i].handler(conn, strReq, mapHeaders, fRun); } } - } catch (RestErr& re) { + } catch (const RestErr& re) { conn->stream() << HTTPReply(re.status, re.message + "\r\n", false, false, "text/plain") << std::flush; return false; } diff --git a/src/rpcserver.h b/src/rpcserver.h index 2b2428445..8fea38126 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -227,8 +227,8 @@ extern json_spirit::Value reconsiderblock(const json_spirit::Array& params, bool // in rest.cpp extern bool HTTPReq_REST(AcceptedConnection *conn, - std::string& strURI, - std::map& mapHeaders, + const std::string& strURI, + const std::map& mapHeaders, bool fRun); #endif // BITCOIN_RPCSERVER_H From 27df4123c433e5ad4e5592f0a8fbc40ca933865b Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Sun, 7 Dec 2014 13:29:06 +0100 Subject: [PATCH 17/88] make all catch() arguments const - I saw this on http://en.cppreference.com/w/cpp/language/try_catch and thought it would be a good idea - also unify used format to better be able to search for exception uses in our codebase --- src/bitcoin-cli.cpp | 12 ++++++------ src/bitcoin-tx.cpp | 8 ++++---- src/bitcoind.cpp | 4 ++-- src/core_read.cpp | 4 ++-- src/init.cpp | 6 +++--- src/main.cpp | 24 ++++++++++++------------ src/miner.cpp | 2 +- src/net.cpp | 10 +++++----- src/qt/bitcoin.cpp | 12 ++++++------ src/qt/intro.cpp | 4 ++-- src/qt/paymentrequestplus.cpp | 3 +-- src/qt/rpcconsole.cpp | 6 +++--- src/rest.cpp | 2 +- src/rpcprotocol.h | 3 +-- src/rpcrawtransaction.cpp | 2 +- src/rpcserver.cpp | 16 ++++++++-------- src/script/bitcoinconsensus.cpp | 2 +- src/test/alert_tests.cpp | 2 +- src/test/rpc_tests.cpp | 3 +-- src/txdb.cpp | 4 ++-- src/txmempool.cpp | 4 ++-- src/util.cpp | 9 ++++----- src/util.h | 10 +++++----- src/walletdb.cpp | 8 ++++---- 24 files changed, 78 insertions(+), 82 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index ea349b197..51ab14785 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -86,7 +86,7 @@ static bool AppInitRPC(int argc, char* argv[]) } try { ReadConfigFile(mapArgs, mapMultiArgs); - } catch(std::exception &e) { + } catch (const std::exception& e) { fprintf(stderr,"Error reading configuration file: %s\n", e.what()); return false; } @@ -206,7 +206,7 @@ int CommandLineRPC(int argc, char *argv[]) // Connection succeeded, no need to retry. break; } - catch (const CConnectionFailed& e) { + catch (const CConnectionFailed&) { if (fWait) MilliSleep(1000); else @@ -214,10 +214,10 @@ int CommandLineRPC(int argc, char *argv[]) } } while (fWait); } - catch (boost::thread_interrupted) { + catch (const boost::thread_interrupted&) { throw; } - catch (std::exception& e) { + catch (const std::exception& e) { strPrint = string("error: ") + e.what(); nRet = EXIT_FAILURE; } @@ -240,7 +240,7 @@ int main(int argc, char* argv[]) if(!AppInitRPC(argc, argv)) return EXIT_FAILURE; } - catch (std::exception& e) { + catch (const std::exception& e) { PrintExceptionContinue(&e, "AppInitRPC()"); return EXIT_FAILURE; } catch (...) { @@ -252,7 +252,7 @@ int main(int argc, char* argv[]) try { ret = CommandLineRPC(argc, argv); } - catch (std::exception& e) { + catch (const std::exception& e) { PrintExceptionContinue(&e, "CommandLineRPC()"); } catch (...) { PrintExceptionContinue(NULL, "CommandLineRPC()"); diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 7308d9366..890eaaedb 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -586,10 +586,10 @@ static int CommandLineRawTx(int argc, char* argv[]) OutputTx(tx); } - catch (boost::thread_interrupted) { + catch (const boost::thread_interrupted&) { throw; } - catch (std::exception& e) { + catch (const std::exception& e) { strPrint = string("error: ") + e.what(); nRet = EXIT_FAILURE; } @@ -612,7 +612,7 @@ int main(int argc, char* argv[]) if(!AppInitRawTx(argc, argv)) return EXIT_FAILURE; } - catch (std::exception& e) { + catch (const std::exception& e) { PrintExceptionContinue(&e, "AppInitRawTx()"); return EXIT_FAILURE; } catch (...) { @@ -624,7 +624,7 @@ int main(int argc, char* argv[]) try { ret = CommandLineRawTx(argc, argv); } - catch (std::exception& e) { + catch (const std::exception& e) { PrintExceptionContinue(&e, "CommandLineRawTx()"); } catch (...) { PrintExceptionContinue(NULL, "CommandLineRawTx()"); diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index be7757b0b..6e735fe3d 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -97,7 +97,7 @@ bool AppInit(int argc, char* argv[]) try { ReadConfigFile(mapArgs, mapMultiArgs); - } catch(std::exception &e) { + } catch (const std::exception& e) { fprintf(stderr,"Error reading configuration file: %s\n", e.what()); return false; } @@ -147,7 +147,7 @@ bool AppInit(int argc, char* argv[]) detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup)); fRet = AppInit2(threadGroup); } - catch (std::exception& e) { + catch (const std::exception& e) { PrintExceptionContinue(&e, "AppInit()"); } catch (...) { PrintExceptionContinue(NULL, "AppInit()"); diff --git a/src/core_read.cpp b/src/core_read.cpp index 65c3a08c5..c15b97876 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -102,7 +102,7 @@ bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx) try { ssData >> tx; } - catch (const std::exception &) { + catch (const std::exception&) { return false; } @@ -119,7 +119,7 @@ bool DecodeHexBlk(CBlock& block, const std::string& strHexBlk) try { ssBlock >> block; } - catch (const std::exception &) { + catch (const std::exception&) { return false; } diff --git a/src/init.cpp b/src/init.cpp index 11329c16a..63199b320 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -778,7 +778,7 @@ bool AppInit2(boost::thread_group& threadGroup) try { boost::filesystem::rename(pathDatabase, pathDatabaseBak); LogPrintf("Moved old %s to %s. Retrying.\n", pathDatabase.string(), pathDatabaseBak.string()); - } catch(boost::filesystem::filesystem_error &error) { + } catch (const boost::filesystem::filesystem_error&) { // failure is ok (well, not really, but it's not worse than what we started with) } @@ -931,7 +931,7 @@ bool AppInit2(boost::thread_group& threadGroup) filesystem::create_hard_link(source, dest); LogPrintf("Hardlinked %s -> %s\n", source.string(), dest.string()); linked = true; - } catch (filesystem::filesystem_error & e) { + } catch (const filesystem::filesystem_error& e) { // Note: hardlink creation failing is not a disaster, it just means // blocks will get re-downloaded from peers. LogPrintf("Error hardlinking blk%04u.dat : %s\n", i, e.what()); @@ -1008,7 +1008,7 @@ bool AppInit2(boost::thread_group& threadGroup) strLoadError = _("Corrupted block database detected"); break; } - } catch(std::exception &e) { + } catch (const std::exception& e) { if (fDebug) LogPrintf("%s\n", e.what()); strLoadError = _("Error opening block database"); break; diff --git a/src/main.cpp b/src/main.cpp index 4160e4b78..9c038f90f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1091,7 +1091,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock file >> header; fseek(file.Get(), postx.nTxOffset, SEEK_CUR); file >> txOut; - } catch (std::exception &e) { + } catch (const std::exception& e) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } hashBlock = header.GetHash(); @@ -1174,7 +1174,7 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos) try { filein >> block; } - catch (std::exception &e) { + catch (const std::exception& e) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } @@ -2598,7 +2598,7 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex, return state.Abort("Failed to write block"); if (!ReceivedBlockTransactions(block, state, pindex, blockPos)) return error("AcceptBlock() : ReceivedBlockTransactions failed"); - } catch(std::runtime_error &e) { + } catch (const std::runtime_error& e) { return state.Abort(std::string("System error: ") + e.what()); } @@ -2990,7 +2990,7 @@ bool InitBlockIndex() { return error("LoadBlockIndex() : genesis block cannot be activated"); // Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data return FlushStateToDisk(state, FLUSH_STATE_ALWAYS); - } catch(std::runtime_error &e) { + } catch (const std::runtime_error& e) { return error("LoadBlockIndex() : failed to initialize block database: %s", e.what()); } } @@ -3030,7 +3030,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) blkdat >> nSize; if (nSize < 80 || nSize > MAX_BLOCK_SIZE) continue; - } catch (const std::exception &) { + } catch (const std::exception&) { // no valid block header found; don't complain break; } @@ -3090,11 +3090,11 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) mapBlocksUnknownParent.erase(it); } } - } catch (std::exception &e) { + } catch (const std::exception& e) { LogPrintf("%s : Deserialize or I/O error - %s", __func__, e.what()); } } - } catch(std::runtime_error &e) { + } catch (const std::runtime_error& e) { AbortNode(std::string("System error: ") + e.what()); } if (nLoaded > 0) @@ -4088,7 +4088,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, ss << ": hash " << hash.ToString(); } LogPrint("net", "Reject %s\n", SanitizeString(ss.str())); - } catch (std::ios_base::failure& e) { + } catch (const std::ios_base::failure&) { // Avoid feedback loops by preventing reject messages from triggering a new reject message. LogPrint("net", "Unparseable reject message received\n"); } @@ -4192,7 +4192,7 @@ bool ProcessMessages(CNode* pfrom) fRet = ProcessMessage(pfrom, strCommand, vRecv, msg.nTime); boost::this_thread::interruption_point(); } - catch (std::ios_base::failure& e) + catch (const std::ios_base::failure& e) { pfrom->PushMessage("reject", strCommand, REJECT_MALFORMED, string("error parsing message")); if (strstr(e.what(), "end of data")) @@ -4210,10 +4210,10 @@ bool ProcessMessages(CNode* pfrom) PrintExceptionContinue(&e, "ProcessMessages()"); } } - catch (boost::thread_interrupted) { + catch (const boost::thread_interrupted&) { throw; } - catch (std::exception& e) { + catch (const std::exception& e) { PrintExceptionContinue(&e, "ProcessMessages()"); } catch (...) { PrintExceptionContinue(NULL, "ProcessMessages()"); @@ -4507,7 +4507,7 @@ bool CBlockUndo::ReadFromDisk(const CDiskBlockPos &pos, const uint256 &hashBlock filein >> *this; filein >> hashChecksum; } - catch (std::exception &e) { + catch (const std::exception& e) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } diff --git a/src/miner.cpp b/src/miner.cpp index ad2943142..09c505ffd 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -565,7 +565,7 @@ void static BitcoinMiner(CWallet *pwallet) } } } - catch (boost::thread_interrupted) + catch (const boost::thread_interrupted&) { LogPrintf("BitcoinMiner terminated\n"); throw; diff --git a/src/net.cpp b/src/net.cpp index 42b3c30fb..9e492d2fc 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -601,7 +601,7 @@ int CNetMessage::readHeader(const char *pch, unsigned int nBytes) try { hdrbuf >> hdr; } - catch (const std::exception &) { + catch (const std::exception&) { return -1; } @@ -1068,7 +1068,7 @@ void ThreadMapPort() MilliSleep(20*60*1000); // Refresh every 20 minutes } } - catch (boost::thread_interrupted) + catch (const boost::thread_interrupted&) { r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0); LogPrintf("UPNP_DeletePortMapping() returned : %d\n", r); @@ -1854,7 +1854,7 @@ bool CAddrDB::Write(const CAddrMan& addr) try { fileout << ssPeers; } - catch (std::exception &e) { + catch (const std::exception& e) { return error("%s : Serialize or I/O error - %s", __func__, e.what()); } FileCommit(fileout.Get()); @@ -1890,7 +1890,7 @@ bool CAddrDB::Read(CAddrMan& addr) filein.read((char *)&vchData[0], dataSize); filein >> hashIn; } - catch (std::exception &e) { + catch (const std::exception& e) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } filein.fclose(); @@ -1914,7 +1914,7 @@ bool CAddrDB::Read(CAddrMan& addr) // de-serialize address data into one CAddrMan object ssPeers >> addr; } - catch (std::exception &e) { + catch (const std::exception& e) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 123777a71..9b0265079 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -173,7 +173,7 @@ private: boost::thread_group threadGroup; /// Pass fatal exception message to UI thread - void handleRunawayException(std::exception *e); + void handleRunawayException(const std::exception *e); }; /** Main Bitcoin application object */ @@ -240,7 +240,7 @@ BitcoinCore::BitcoinCore(): { } -void BitcoinCore::handleRunawayException(std::exception *e) +void BitcoinCore::handleRunawayException(const std::exception *e) { PrintExceptionContinue(e, "Runaway exception"); emit runawayException(QString::fromStdString(strMiscWarning)); @@ -260,7 +260,7 @@ void BitcoinCore::initialize() StartDummyRPCThread(); } emit initializeResult(rv); - } catch (std::exception& e) { + } catch (const std::exception& e) { handleRunawayException(&e); } catch (...) { handleRunawayException(NULL); @@ -277,7 +277,7 @@ void BitcoinCore::shutdown() Shutdown(); qDebug() << __func__ << ": Shutdown finished"; emit shutdownResult(1); - } catch (std::exception& e) { + } catch (const std::exception& e) { handleRunawayException(&e); } catch (...) { handleRunawayException(NULL); @@ -551,7 +551,7 @@ int main(int argc, char *argv[]) } try { ReadConfigFile(mapArgs, mapMultiArgs); - } catch(std::exception &e) { + } catch (const std::exception& e) { QMessageBox::critical(0, QObject::tr("Bitcoin Core"), QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what())); return false; @@ -628,7 +628,7 @@ int main(int argc, char *argv[]) app.exec(); app.requestShutdown(); app.exec(); - } catch (std::exception& e) { + } catch (const std::exception& e) { PrintExceptionContinue(&e, "Runaway exception"); app.handleRunawayException(QString::fromStdString(strMiscWarning)); } catch (...) { diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 7618bff69..65486a02f 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -95,7 +95,7 @@ void FreespaceChecker::check() replyMessage = tr("Path already exists, and is not a directory."); } } - } catch(fs::filesystem_error &e) + } catch (const fs::filesystem_error&) { /* Parent directory does not exist or is not accessible */ replyStatus = ST_ERROR; @@ -180,7 +180,7 @@ void Intro::pickDataDirectory() try { TryCreateDirectory(GUIUtil::qstringToBoostPath(dataDir)); break; - } catch(fs::filesystem_error &e) { + } catch (const fs::filesystem_error&) { QMessageBox::critical(0, tr("Bitcoin Core"), tr("Error: Specified data directory \"%1\" cannot be created.").arg(dataDir)); /* fall through, back to choosing screen */ diff --git a/src/qt/paymentrequestplus.cpp b/src/qt/paymentrequestplus.cpp index a40b5bbcd..ca3f06962 100644 --- a/src/qt/paymentrequestplus.cpp +++ b/src/qt/paymentrequestplus.cpp @@ -181,8 +181,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c } // TODO: detect EV certificates and set merchant = business name instead of unfriendly NID_commonName ? } - catch (SSLVerifyError& err) - { + catch (const SSLVerifyError& err) { fResult = false; qWarning() << "PaymentRequestPlus::getMerchant : SSL error: " << err.what(); } diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 2defdf8bb..9fb15dc6f 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -180,7 +180,7 @@ void RPCExecutor::request(const QString &command) emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint)); } - catch (json_spirit::Object& objError) + catch (const json_spirit::Object& objError) { try // Nice formatting for standard-format error { @@ -188,12 +188,12 @@ void RPCExecutor::request(const QString &command) std::string message = find_value(objError, "message").get_str(); emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")"); } - catch(std::runtime_error &) // raised when converting to invalid type, i.e. missing code or message + catch (const std::runtime_error&) // raised when converting to invalid type, i.e. missing code or message { // Show raw JSON object emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(write_string(json_spirit::Value(objError), false))); } } - catch (std::exception& e) + catch (const std::exception& e) { emit reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what())); } diff --git a/src/rest.cpp b/src/rest.cpp index c52dbb3cd..304e1d747 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -307,7 +307,7 @@ bool HTTPReq_REST(AcceptedConnection* conn, return uri_prefixes[i].handler(conn, strReq, mapHeaders, fRun); } } - } catch (RestErr& re) { + } catch (const RestErr& re) { conn->stream() << HTTPReply(re.status, re.message + "\r\n", false, false, "text/plain") << std::flush; return false; } diff --git a/src/rpcprotocol.h b/src/rpcprotocol.h index f7cd50f9f..f4a4877d3 100644 --- a/src/rpcprotocol.h +++ b/src/rpcprotocol.h @@ -122,8 +122,7 @@ public: tcp::resolver::query query(server.c_str(), port.c_str()); endpoint_iterator = resolver.resolve(query); #if BOOST_VERSION >= 104300 - } catch(boost::system::system_error &e) - { + } catch (const boost::system::system_error&) { // If we at first don't succeed, try blanket lookup (IPv4+IPv6 independent of configured interfaces) tcp::resolver::query query(server.c_str(), port.c_str(), resolver_query_base::flags()); endpoint_iterator = resolver.resolve(query); diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 4a1af2207..f596c358a 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -545,7 +545,7 @@ Value signrawtransaction(const Array& params, bool fHelp) ssData >> tx; txVariants.push_back(tx); } - catch (const std::exception &) { + catch (const std::exception&) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); } } diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 252b0866a..c0f0d253f 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -174,7 +174,7 @@ string CRPCTable::help(string strCommand) const if (setDone.insert(pfn).second) (*pfn)(params, true); } - catch (std::exception& e) + catch (const std::exception& e) { // Help text is returned in an exception string strHelp = string(e.what()); @@ -631,7 +631,7 @@ void StartRPCThreads() try { vEndpoints.push_back(ParseEndpoint(addr, defaultPort)); } - catch(const boost::system::system_error &) + catch (const boost::system::system_error&) { uiInterface.ThreadSafeMessageBox( strprintf(_("Could not parse -rpcbind value %s as network address"), addr), @@ -676,7 +676,7 @@ void StartRPCThreads() if(bBindAny && bindAddress == asio::ip::address_v6::any() && !v6_only_error) break; } - catch(boost::system::system_error &e) + catch (const boost::system::system_error& e) { LogPrintf("ERROR: Binding RPC on address %s port %i failed: %s\n", bindAddress.to_string(), endpoint.port(), e.what()); strerr = strprintf(_("An error occurred while setting up the RPC address %s port %u for listening: %s"), bindAddress.to_string(), endpoint.port(), e.what()); @@ -842,11 +842,11 @@ static Object JSONRPCExecOne(const Value& req) Value result = tableRPC.execute(jreq.strMethod, jreq.params); rpc_result = JSONRPCReplyObj(result, Value::null, jreq.id); } - catch (Object& objError) + catch (const Object& objError) { rpc_result = JSONRPCReplyObj(Value::null, objError, jreq.id); } - catch (std::exception& e) + catch (const std::exception& e) { rpc_result = JSONRPCReplyObj(Value::null, JSONRPCError(RPC_PARSE_ERROR, e.what()), jreq.id); @@ -922,12 +922,12 @@ static bool HTTPReq_JSONRPC(AcceptedConnection *conn, conn->stream() << HTTPReplyHeader(HTTP_OK, fRun, strReply.size()) << strReply << std::flush; } - catch (Object& objError) + catch (const Object& objError) { ErrorReply(conn->stream(), objError, jreq.id); return false; } - catch (std::exception& e) + catch (const std::exception& e) { ErrorReply(conn->stream(), JSONRPCError(RPC_PARSE_ERROR, e.what()), jreq.id); return false; @@ -1013,7 +1013,7 @@ json_spirit::Value CRPCTable::execute(const std::string &strMethod, const json_s } return result; } - catch (std::exception& e) + catch (const std::exception& e) { throw JSONRPCError(RPC_MISC_ERROR, e.what()); } diff --git a/src/script/bitcoinconsensus.cpp b/src/script/bitcoinconsensus.cpp index d4fd2ad7d..e80e55df7 100644 --- a/src/script/bitcoinconsensus.cpp +++ b/src/script/bitcoinconsensus.cpp @@ -79,7 +79,7 @@ int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned i set_error(err, bitcoinconsensus_ERR_OK); return VerifyScript(tx.vin[nIn].scriptSig, CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), flags, SignatureChecker(tx, nIn), NULL); - } catch (std::exception &e) { + } catch (const std::exception&) { return set_error(err, bitcoinconsensus_ERR_TX_DESERIALIZE); // Error deserializing } } diff --git a/src/test/alert_tests.cpp b/src/test/alert_tests.cpp index 4869ba52a..614960fa6 100644 --- a/src/test/alert_tests.cpp +++ b/src/test/alert_tests.cpp @@ -92,7 +92,7 @@ struct ReadAlerts alerts.push_back(alert); } } - catch (std::exception) { } + catch (const std::exception&) { } } ~ReadAlerts() { } diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index d5475a92b..4826fae52 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -39,8 +39,7 @@ Value CallRPC(string args) Value result = (*method)(params, false); return result; } - catch (Object& objError) - { + catch (const Object& objError) { throw runtime_error(find_value(objError, "message").get_str()); } } diff --git a/src/txdb.cpp b/src/txdb.cpp index 29ef35037..bb108f38b 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -129,7 +129,7 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) const { ss << VARINT(0); } pcursor->Next(); - } catch (std::exception &e) { + } catch (const std::exception& e) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } } @@ -218,7 +218,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts() } else { break; // if shutdown requested or finished loading block index } - } catch (std::exception &e) { + } catch (const std::exception& e) { return error("%s : Deserialize or I/O error - %s", __func__, e.what()); } } diff --git a/src/txmempool.cpp b/src/txmempool.cpp index a9567d3b1..1df9c5c79 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -648,7 +648,7 @@ CTxMemPool::WriteFeeEstimates(CAutoFile& fileout) const fileout << CLIENT_VERSION; // version that wrote the file minerPolicyEstimator->Write(fileout); } - catch (const std::exception &) { + catch (const std::exception&) { LogPrintf("CTxMemPool::WriteFeeEstimates() : unable to write policy estimator data (non-fatal)"); return false; } @@ -667,7 +667,7 @@ CTxMemPool::ReadFeeEstimates(CAutoFile& filein) LOCK(cs); minerPolicyEstimator->Read(filein, minRelayFee); } - catch (const std::exception &) { + catch (const std::exception&) { LogPrintf("CTxMemPool::ReadFeeEstimates() : unable to read policy estimator data (non-fatal)"); return false; } diff --git a/src/util.cpp b/src/util.cpp index 0cdf4e614..282e54e48 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -346,7 +346,7 @@ bool SoftSetBoolArg(const std::string& strArg, bool fValue) return SoftSetArg(strArg, std::string("0")); } -static std::string FormatException(std::exception* pex, const char* pszThread) +static std::string FormatException(const std::exception* pex, const char* pszThread) { #ifdef WIN32 char pszModule[MAX_PATH] = ""; @@ -362,7 +362,7 @@ static std::string FormatException(std::exception* pex, const char* pszThread) "UNKNOWN EXCEPTION \n%s in %s \n", pszModule, pszThread); } -void PrintExceptionContinue(std::exception* pex, const char* pszThread) +void PrintExceptionContinue(const std::exception* pex, const char* pszThread) { std::string message = FormatException(pex, pszThread); LogPrintf("\n\n************************\n%s\n", message); @@ -514,7 +514,7 @@ bool TryCreateDirectory(const boost::filesystem::path& p) try { return boost::filesystem::create_directory(p); - } catch (boost::filesystem::filesystem_error) { + } catch (const boost::filesystem::filesystem_error&) { if (!boost::filesystem::exists(p) || !boost::filesystem::is_directory(p)) throw; } @@ -721,8 +721,7 @@ void SetupEnvironment() #else // boost filesystem v2 std::locale(); // Raises runtime error if current locale is invalid #endif - } catch(std::runtime_error &e) - { + } catch (const std::runtime_error&) { setenv("LC_ALL", "C", 1); // Force C locale } #endif diff --git a/src/util.h b/src/util.h index a4aaf29f9..623c24f5c 100644 --- a/src/util.h +++ b/src/util.h @@ -84,7 +84,7 @@ static inline bool error(const char* format) return false; } -void PrintExceptionContinue(std::exception* pex, const char* pszThread); +void PrintExceptionContinue(const std::exception *pex, const char* pszThread); void ParseParameters(int argc, const char*const argv[]); void FileCommit(FILE *fileout); bool TruncateFile(FILE *file, unsigned int length); @@ -186,12 +186,12 @@ template void LoopForever(const char* name, Callable func, func(); } } - catch (boost::thread_interrupted) + catch (const boost::thread_interrupted&) { LogPrintf("%s thread stop\n", name); throw; } - catch (std::exception& e) { + catch (const std::exception& e) { PrintExceptionContinue(&e, name); throw; } @@ -214,12 +214,12 @@ template void TraceThread(const char* name, Callable func) func(); LogPrintf("%s thread exit\n", name); } - catch (boost::thread_interrupted) + catch (const boost::thread_interrupted&) { LogPrintf("%s thread interrupt\n", name); throw; } - catch (std::exception& e) { + catch (const std::exception& e) { PrintExceptionContinue(&e, name); throw; } diff --git a/src/walletdb.cpp b/src/walletdb.cpp index ffddd8106..94e17c6a5 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -460,7 +460,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, { ssValue >> hash; } - catch(...){} + catch (...) {} bool fSkipCheck = false; @@ -664,7 +664,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet) } pcursor->close(); } - catch (boost::thread_interrupted) { + catch (const boost::thread_interrupted&) { throw; } catch (...) { @@ -757,7 +757,7 @@ DBErrors CWalletDB::FindWalletTx(CWallet* pwallet, vector& vTxHash, vec } pcursor->close(); } - catch (boost::thread_interrupted) { + catch (const boost::thread_interrupted&) { throw; } catch (...) { @@ -878,7 +878,7 @@ bool BackupWallet(const CWallet& wallet, const string& strDest) #endif LogPrintf("copied wallet.dat to %s\n", pathDest.string()); return true; - } catch(const filesystem::filesystem_error &e) { + } catch (const filesystem::filesystem_error& e) { LogPrintf("error copying wallet.dat to %s - %s\n", pathDest.string(), e.what()); return false; } From 7f718139191d67da29c5d856d29e035bbc51e659 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 17 Dec 2014 09:34:09 +0000 Subject: [PATCH 18/88] Bugfix: prioritisetransaction: Do some basic sanity checking on txid Besides giving a nicer error, this also prevents logging arbitrary data (which could have been used to exploit log readers) into debug.log --- src/core_io.h | 1 + src/core_read.cpp | 5 +++++ src/rpcmining.cpp | 3 +-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core_io.h b/src/core_io.h index aba1928a3..bc2eb1edd 100644 --- a/src/core_io.h +++ b/src/core_io.h @@ -19,6 +19,7 @@ extern CScript ParseScript(std::string s); extern bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx); extern bool DecodeHexBlk(CBlock&, const std::string& strHexBlk); extern uint256 ParseHashUV(const UniValue& v, const std::string& strName); +extern uint256 ParseHashStr(const std::string&, const std::string& strName); extern std::vector ParseHexUV(const UniValue& v, const std::string& strName); // core_write.cpp diff --git a/src/core_read.cpp b/src/core_read.cpp index 65c3a08c5..beb746ce9 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -131,6 +131,11 @@ uint256 ParseHashUV(const UniValue& v, const string& strName) string strHex; if (v.isStr()) strHex = v.getValStr(); + return ParseHashStr(strHex, strName); // Note: ParseHashStr("") throws a runtime_error +} + +uint256 ParseHashStr(const std::string& strHex, const std::string& strName) +{ if (!IsHex(strHex)) // Note: IsHex("") is false throw runtime_error(strName+" must be hexadecimal string (not '"+strHex+"')"); diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 45899d3db..9694ec2ea 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -288,8 +288,7 @@ Value prioritisetransaction(const Array& params, bool fHelp) + HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000") ); - uint256 hash; - hash.SetHex(params[0].get_str()); + uint256 hash = ParseHashStr(params[0].get_str(), "txid"); CAmount nAmount = params[2].get_int64(); From e85855fa557214ab28f77548a7e2c4baf088ed9d Mon Sep 17 00:00:00 2001 From: Michael Ford Date: Wed, 17 Dec 2014 19:36:20 +0800 Subject: [PATCH 19/88] Drop beta suffixes from readmes --- doc/README.md | 2 +- doc/README_windows.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/README.md b/doc/README.md index 3ec5f11df..73a268ee9 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,4 +1,4 @@ -Bitcoin 0.10.99 BETA +Bitcoin 0.10.99 ===================== Copyright (c) 2009-2014 Bitcoin Developers diff --git a/doc/README_windows.txt b/doc/README_windows.txt index 9780a2cb1..80e6f779a 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -1,4 +1,4 @@ -Bitcoin 0.10.99 BETA +Bitcoin 0.10.99 Copyright (c) 2009-2014 Bitcoin Core Developers From e36e619886fd0beba4dfc8155c1c068f9d7df0db Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 17 Dec 2014 13:20:11 +0100 Subject: [PATCH 20/88] Add mips, mipsel and aarch64 to depends platforms --- depends/packages/openssl.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/depends/packages/openssl.mk b/depends/packages/openssl.mk index 6d7a556c1..ad64494c1 100644 --- a/depends/packages/openssl.mk +++ b/depends/packages/openssl.mk @@ -14,6 +14,9 @@ $(package)_config_opts_linux=-fPIC $(package)_config_opts_x86_64_linux=linux-x86_64 $(package)_config_opts_i686_linux=linux-generic32 $(package)_config_opts_arm_linux=linux-generic32 +$(package)_config_opts_aarch64_linux=linux-generic64 +$(package)_config_opts_mipsel_linux=linux-generic32 +$(package)_config_opts_mips_linux=linux-generic32 $(package)_config_opts_x86_64_darwin=darwin64-x86_64-cc $(package)_config_opts_x86_64_mingw32=mingw64 $(package)_config_opts_i686_mingw32=mingw From 7a3b83269ec26612aa3399ae3f978264996c32fd Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Wed, 17 Dec 2014 22:37:54 +0100 Subject: [PATCH 21/88] [QA] fix httpbasics RPC test typo --- qa/rpc-tests/httpbasics.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qa/rpc-tests/httpbasics.py b/qa/rpc-tests/httpbasics.py index a94edaffa..85e85e7f0 100755 --- a/qa/rpc-tests/httpbasics.py +++ b/qa/rpc-tests/httpbasics.py @@ -20,7 +20,7 @@ try: except ImportError: import urlparse -class RESTTest (BitcoinTestFramework): +class HTTPBasicsTest (BitcoinTestFramework): def run_test(self): ################################################# @@ -73,4 +73,4 @@ class RESTTest (BitcoinTestFramework): if __name__ == '__main__': - RESTTest ().main () + HTTPBasicsTest ().main () From 469d564951a47f704a08e8265aa165e2d0fc78ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jan=C3=ADk?= Date: Thu, 18 Dec 2014 13:34:16 +0100 Subject: [PATCH 22/88] Build winshutdownmonitor.cpp on Windows only. --- src/Makefile.qt.include | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 25d76c146..c0cc8f34e 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -279,8 +279,11 @@ BITCOIN_QT_CPP = \ qt/rpcconsole.cpp \ qt/splashscreen.cpp \ qt/trafficgraphwidget.cpp \ - qt/utilitydialog.cpp \ - qt/winshutdownmonitor.cpp + qt/utilitydialog.cpp + +if TARGET_WINDOWS +BITCOIN_QT_CPP += qt/winshutdownmonitor.cpp +endif if ENABLE_WALLET BITCOIN_QT_CPP += \ From 146c0a7c5acc06070badf1db442520fab5395614 Mon Sep 17 00:00:00 2001 From: 21E14 <21xe14@gmail.com> Date: Thu, 18 Dec 2014 20:25:04 -0500 Subject: [PATCH 23/88] Add RandAddSeedPerfmon to MakeNewKey --- src/key.cpp | 1 + src/wallet.cpp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/key.cpp b/src/key.cpp index 36613342b..3d5886d35 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -34,6 +34,7 @@ bool CKey::Check(const unsigned char *vch) { } void CKey::MakeNewKey(bool fCompressedIn) { + RandAddSeedPerfmon(); do { GetRandBytes(vch, sizeof(vch)); } while (!Check(vch)); diff --git a/src/wallet.cpp b/src/wallet.cpp index 32a64daac..b6699a41d 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -70,7 +70,6 @@ CPubKey CWallet::GenerateNewKey() AssertLockHeld(cs_wallet); // mapKeyMetadata bool fCompressed = CanSupportFeature(FEATURE_COMPRPUBKEY); // default to compressed public keys if we want 0.6.0 wallets - RandAddSeedPerfmon(); CKey secret; secret.MakeNewKey(fCompressed); From 3bf5f52808a5f7cd3958c9eea273d99fd11417ca Mon Sep 17 00:00:00 2001 From: Michael Ford Date: Sat, 13 Dec 2014 12:35:39 +0800 Subject: [PATCH 24/88] Create developer-notes.md Moves coding guidelines and development tips/tricks into a single file. Also adds a section explaining pull request terminology. --- README.md | 37 +-------------------- doc/README.md | 2 +- doc/{coding.md => developer-notes.md} | 48 +++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 37 deletions(-) rename doc/{coding.md => developer-notes.md} (67%) diff --git a/README.md b/README.md index cf650fe54..03a698996 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ submitter will be asked to start a discussion (if they haven't already) on the The patch will be accepted if there is broad consensus that it is a good thing. Developers should expect to rework and resubmit patches if the code doesn't -match the project's coding conventions (see [doc/coding.md](doc/coding.md)) or are +match the project's coding conventions (see [doc/developer-notes.md](doc/developer-notes.md)) or are controversial. The `master` branch is regularly built and tested, but is not guaranteed to be @@ -85,38 +85,3 @@ Translations are periodically pulled from Transifex and merged into the git repo pull from Transifex would automatically overwrite them again. Translators should also subscribe to the [mailing list](https://groups.google.com/forum/#!forum/bitcoin-translators). - -Development tips and tricks ---------------------------- - -**compiling for debugging** - -Run configure with the --enable-debug option, then make. Or run configure with -CXXFLAGS="-g -ggdb -O0" or whatever debug flags you need. - -**debug.log** - -If the code is behaving strangely, take a look in the debug.log file in the data directory; -error and debugging messages are written there. - -The -debug=... command-line option controls debugging; running with just -debug will turn -on all categories (and give you a very large debug.log file). - -The Qt code routes qDebug() output to debug.log under category "qt": run with -debug=qt -to see it. - -**testnet and regtest modes** - -Run with the -testnet option to run with "play bitcoins" on the test network, if you -are testing multi-machine code that needs to operate across the internet. - -If you are testing something that can run on one machine, run with the -regtest option. -In regression test mode, blocks can be created on-demand; see qa/rpc-tests/ for tests -that run in -regtest mode. - -**DEBUG_LOCKORDER** - -Bitcoin Core is a multithreaded application, and deadlocks or other multithreading bugs -can be very difficult to track down. Compiling with -DDEBUG_LOCKORDER (configure -CXXFLAGS="-DDEBUG_LOCKORDER -g") inserts run-time checks to keep track of which locks -are held, and adds warnings to the debug.log file if inconsistencies are detected. diff --git a/doc/README.md b/doc/README.md index 3ec5f11df..50753b5ee 100644 --- a/doc/README.md +++ b/doc/README.md @@ -51,7 +51,7 @@ Development --------------------- The Bitcoin repo's [root README](https://github.com/bitcoin/bitcoin/blob/master/README.md) contains relevant information on the development process and automated testing. -- [Coding Guidelines](coding.md) +- [Developer Notes](developer-notes.md) - [Multiwallet Qt Development](multiwallet-qt.md) - [Release Notes](release-notes.md) - [Release Process](release-process.md) diff --git a/doc/coding.md b/doc/developer-notes.md similarity index 67% rename from doc/coding.md rename to doc/developer-notes.md index 43294dbe4..eaeb90da1 100644 --- a/doc/coding.md +++ b/doc/developer-notes.md @@ -89,6 +89,41 @@ Not OK (used plenty in the current source, but not picked up): A full list of comment syntaxes picked up by doxygen can be found at http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html, but if possible use one of the above styles. +Development tips and tricks +--------------------------- + +**compiling for debugging** + +Run configure with the --enable-debug option, then make. Or run configure with +CXXFLAGS="-g -ggdb -O0" or whatever debug flags you need. + +**debug.log** + +If the code is behaving strangely, take a look in the debug.log file in the data directory; +error and debugging messages are written there. + +The -debug=... command-line option controls debugging; running with just -debug will turn +on all categories (and give you a very large debug.log file). + +The Qt code routes qDebug() output to debug.log under category "qt": run with -debug=qt +to see it. + +**testnet and regtest modes** + +Run with the -testnet option to run with "play bitcoins" on the test network, if you +are testing multi-machine code that needs to operate across the internet. + +If you are testing something that can run on one machine, run with the -regtest option. +In regression test mode, blocks can be created on-demand; see qa/rpc-tests/ for tests +that run in -regtest mode. + +**DEBUG_LOCKORDER** + +Bitcoin Core is a multithreaded application, and deadlocks or other multithreading bugs +can be very difficult to track down. Compiling with -DDEBUG_LOCKORDER (configure +CXXFLAGS="-DDEBUG_LOCKORDER -g") inserts run-time checks to keep track of which locks +are held, and adds warnings to the debug.log file if inconsistencies are detected. + Locking/mutex usage notes ------------------------- @@ -136,3 +171,16 @@ Threads - BitcoinMiner : Generates bitcoins (if wallet is enabled). - Shutdown : Does an orderly shutdown of everything. + +Pull Request Terminology +------------------------ + +Concept ACK - Agree with the idea and overall direction, but haven't reviewed the code changes or tested them. + +utACK (untested ACK) - Reviewed and agree with the code changes but haven't actually tested them. + +Tested ACK - Reviewed the code changes and have verified the functionality or bug fix. + +ACK - A loose ACK can be confusing. It's best to avoid them unless it's a documentation/comment only change in which case there is nothing to test/verify; therefore the tested/untested distinction is not there. + +NACK - Disagree with the code changes/concept. Should be accompanied by an explanation. From 6e718f94358bd023e5867d94c683a5635a1ff3f9 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 19 Dec 2014 16:24:15 +0100 Subject: [PATCH 25/88] Remove outdated comment about NTP The comment has been around since 0.1, but NTP inside the client isn't deemed necessary so remove the comment to avoid confusion. --- src/net.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/net.cpp b/src/net.cpp index 9e492d2fc..2773b63f7 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -445,7 +445,6 @@ void CNode::PushVersion() { int nBestHeight = g_signals.GetHeight().get_value_or(0); - /// when NTP implemented, change to just nTime = GetAdjustedTime() int64_t nTime = (fInbound ? GetAdjustedTime() : GetTime()); CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0))); CAddress addrMe = GetLocalAddress(&addr); From 84857e87e42e412336ea60d0f8544c1679bab827 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Sun, 7 Dec 2014 12:57:11 +0100 Subject: [PATCH 26/88] add missing CAutoFile::IsNull() check in main Rebased-From: ccd056a30db0ba5e04b858a682907b378e464d34 Github-Pull: #5437 --- src/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 9c038f90f..3e0741ae7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1086,6 +1086,8 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock CDiskTxPos postx; if (pblocktree->ReadTxIndex(hash, postx)) { CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION); + if (file.IsNull()) + return error("%s: OpenBlockFile failed", __func__); CBlockHeader header; try { file >> header; From f914f1a746d7f91951c1da262a4a749dd3ebfa71 Mon Sep 17 00:00:00 2001 From: sandakersmann Date: Wed, 17 Dec 2014 02:47:57 +0100 Subject: [PATCH 27/88] Added "Core" to copyright headers Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60 --- contrib/devtools/README.md | 4 ++-- contrib/devtools/fix-copyright-headers.py | 4 ++-- contrib/linearize/linearize-data.py | 2 +- contrib/linearize/linearize-hashes.py | 2 +- src/alert.cpp | 2 +- src/alert.h | 2 +- src/allocators.cpp | 2 +- src/allocators.h | 2 +- src/amount.cpp | 2 +- src/amount.h | 2 +- src/base58.cpp | 2 +- src/base58.h | 2 +- src/bitcoin-cli.cpp | 2 +- src/bitcoin-tx.cpp | 2 +- src/bitcoind.cpp | 2 +- src/bloom.cpp | 2 +- src/bloom.h | 2 +- src/chain.cpp | 2 +- src/chain.h | 2 +- src/chainparams.cpp | 2 +- src/chainparams.h | 2 +- src/chainparamsbase.cpp | 2 +- src/chainparamsbase.h | 2 +- src/checkpoints.cpp | 2 +- src/checkpoints.h | 2 +- src/checkqueue.h | 2 +- src/clientversion.cpp | 2 +- src/clientversion.h | 2 +- src/coincontrol.h | 2 +- src/coins.cpp | 2 +- src/coins.h | 2 +- src/compat.h | 2 +- src/compat/glibc_compat.cpp | 2 +- src/compat/glibc_sanity.cpp | 2 +- src/compat/glibcxx_compat.cpp | 2 +- src/compat/glibcxx_sanity.cpp | 2 +- src/compat/sanity.h | 2 +- src/compat/strnlen.cpp | 2 +- src/compressor.cpp | 2 +- src/compressor.h | 2 +- src/core_io.h | 2 +- src/core_read.cpp | 2 +- src/core_write.cpp | 2 +- src/crypter.cpp | 2 +- src/crypter.h | 2 +- src/crypto/common.h | 2 +- src/crypto/hmac_sha256.cpp | 2 +- src/crypto/hmac_sha256.h | 2 +- src/crypto/hmac_sha512.cpp | 2 +- src/crypto/hmac_sha512.h | 2 +- src/crypto/rfc6979_hmac_sha256.cpp | 2 +- src/crypto/rfc6979_hmac_sha256.h | 2 +- src/crypto/ripemd160.cpp | 2 +- src/crypto/ripemd160.h | 2 +- src/crypto/sha1.cpp | 2 +- src/crypto/sha1.h | 2 +- src/crypto/sha256.cpp | 2 +- src/crypto/sha256.h | 2 +- src/crypto/sha512.cpp | 2 +- src/crypto/sha512.h | 2 +- src/db.cpp | 2 +- src/db.h | 2 +- src/eccryptoverify.cpp | 2 +- src/eccryptoverify.h | 2 +- src/ecwrapper.cpp | 2 +- src/ecwrapper.h | 2 +- src/hash.cpp | 2 +- src/hash.h | 2 +- src/init.cpp | 2 +- src/init.h | 2 +- src/key.cpp | 2 +- src/key.h | 2 +- src/keystore.cpp | 2 +- src/keystore.h | 2 +- src/leveldbwrapper.cpp | 2 +- src/leveldbwrapper.h | 2 +- src/limitedmap.h | 2 +- src/main.cpp | 2 +- src/main.h | 2 +- src/merkleblock.cpp | 2 +- src/merkleblock.h | 2 +- src/miner.cpp | 2 +- src/miner.h | 2 +- src/mruset.h | 2 +- src/net.cpp | 2 +- src/net.h | 2 +- src/netbase.cpp | 2 +- src/netbase.h | 2 +- src/noui.cpp | 2 +- src/noui.h | 2 +- src/pow.cpp | 2 +- src/pow.h | 2 +- src/primitives/block.cpp | 2 +- src/primitives/block.h | 2 +- src/primitives/transaction.cpp | 2 +- src/primitives/transaction.h | 2 +- src/protocol.cpp | 2 +- src/protocol.h | 2 +- src/pubkey.cpp | 2 +- src/pubkey.h | 2 +- src/qt/addressbookpage.cpp | 2 +- src/qt/addressbookpage.h | 2 +- src/qt/addresstablemodel.cpp | 2 +- src/qt/addresstablemodel.h | 2 +- src/qt/askpassphrasedialog.cpp | 2 +- src/qt/askpassphrasedialog.h | 2 +- src/qt/bitcoin.cpp | 2 +- src/qt/bitcoinaddressvalidator.cpp | 2 +- src/qt/bitcoinaddressvalidator.h | 2 +- src/qt/bitcoinamountfield.cpp | 2 +- src/qt/bitcoinamountfield.h | 2 +- src/qt/bitcoingui.cpp | 2 +- src/qt/bitcoingui.h | 2 +- src/qt/bitcoinunits.cpp | 2 +- src/qt/bitcoinunits.h | 2 +- src/qt/clientmodel.cpp | 2 +- src/qt/clientmodel.h | 2 +- src/qt/coincontroldialog.cpp | 2 +- src/qt/coincontroldialog.h | 2 +- src/qt/coincontroltreewidget.cpp | 2 +- src/qt/coincontroltreewidget.h | 2 +- src/qt/csvmodelwriter.cpp | 2 +- src/qt/csvmodelwriter.h | 2 +- src/qt/editaddressdialog.cpp | 2 +- src/qt/editaddressdialog.h | 2 +- src/qt/guiconstants.h | 2 +- src/qt/guiutil.cpp | 2 +- src/qt/guiutil.h | 2 +- src/qt/intro.cpp | 2 +- src/qt/intro.h | 2 +- src/qt/macdockiconhandler.h | 2 +- src/qt/macnotificationhandler.h | 2 +- src/qt/networkstyle.cpp | 2 +- src/qt/networkstyle.h | 2 +- src/qt/notificator.cpp | 2 +- src/qt/notificator.h | 2 +- src/qt/openuridialog.cpp | 2 +- src/qt/openuridialog.h | 2 +- src/qt/optionsdialog.cpp | 2 +- src/qt/optionsdialog.h | 2 +- src/qt/optionsmodel.cpp | 2 +- src/qt/optionsmodel.h | 2 +- src/qt/overviewpage.cpp | 2 +- src/qt/overviewpage.h | 2 +- src/qt/paymentrequestplus.cpp | 2 +- src/qt/paymentserver.cpp | 2 +- src/qt/paymentserver.h | 2 +- src/qt/peertablemodel.cpp | 2 +- src/qt/peertablemodel.h | 2 +- src/qt/qvalidatedlineedit.cpp | 2 +- src/qt/qvalidatedlineedit.h | 2 +- src/qt/qvaluecombobox.cpp | 2 +- src/qt/qvaluecombobox.h | 2 +- src/qt/receivecoinsdialog.cpp | 2 +- src/qt/receivecoinsdialog.h | 2 +- src/qt/receiverequestdialog.cpp | 2 +- src/qt/receiverequestdialog.h | 2 +- src/qt/recentrequeststablemodel.cpp | 2 +- src/qt/recentrequeststablemodel.h | 2 +- src/qt/rpcconsole.cpp | 2 +- src/qt/rpcconsole.h | 2 +- src/qt/sendcoinsdialog.cpp | 2 +- src/qt/sendcoinsdialog.h | 2 +- src/qt/sendcoinsentry.cpp | 2 +- src/qt/sendcoinsentry.h | 2 +- src/qt/signverifymessagedialog.cpp | 2 +- src/qt/signverifymessagedialog.h | 2 +- src/qt/splashscreen.cpp | 2 +- src/qt/splashscreen.h | 2 +- src/qt/test/paymentrequestdata.h | 2 +- src/qt/test/paymentservertests.cpp | 2 +- src/qt/test/paymentservertests.h | 2 +- src/qt/test/test_main.cpp | 2 +- src/qt/test/uritests.cpp | 2 +- src/qt/test/uritests.h | 2 +- src/qt/trafficgraphwidget.cpp | 2 +- src/qt/trafficgraphwidget.h | 2 +- src/qt/transactiondesc.cpp | 2 +- src/qt/transactiondesc.h | 2 +- src/qt/transactiondescdialog.cpp | 2 +- src/qt/transactiondescdialog.h | 2 +- src/qt/transactionfilterproxy.cpp | 2 +- src/qt/transactionfilterproxy.h | 2 +- src/qt/transactionrecord.cpp | 2 +- src/qt/transactionrecord.h | 2 +- src/qt/transactiontablemodel.cpp | 2 +- src/qt/transactiontablemodel.h | 2 +- src/qt/transactionview.cpp | 2 +- src/qt/transactionview.h | 2 +- src/qt/utilitydialog.cpp | 2 +- src/qt/utilitydialog.h | 2 +- src/qt/walletframe.cpp | 2 +- src/qt/walletframe.h | 2 +- src/qt/walletmodel.cpp | 2 +- src/qt/walletmodel.h | 2 +- src/qt/walletmodeltransaction.cpp | 2 +- src/qt/walletmodeltransaction.h | 2 +- src/qt/walletview.cpp | 2 +- src/qt/walletview.h | 2 +- src/qt/winshutdownmonitor.cpp | 2 +- src/qt/winshutdownmonitor.h | 2 +- src/random.cpp | 2 +- src/random.h | 2 +- src/rest.cpp | 2 +- src/rpcblockchain.cpp | 2 +- src/rpcclient.cpp | 2 +- src/rpcclient.h | 2 +- src/rpcdump.cpp | 2 +- src/rpcmining.cpp | 2 +- src/rpcmisc.cpp | 2 +- src/rpcnet.cpp | 2 +- src/rpcprotocol.cpp | 2 +- src/rpcprotocol.h | 2 +- src/rpcrawtransaction.cpp | 2 +- src/rpcserver.cpp | 2 +- src/rpcserver.h | 2 +- src/rpcwallet.cpp | 2 +- src/script/bitcoinconsensus.cpp | 2 +- src/script/bitcoinconsensus.h | 2 +- src/script/interpreter.cpp | 2 +- src/script/interpreter.h | 2 +- src/script/script.cpp | 2 +- src/script/script.h | 2 +- src/script/script_error.cpp | 2 +- src/script/script_error.h | 2 +- src/script/sigcache.cpp | 2 +- src/script/sigcache.h | 2 +- src/script/sign.cpp | 2 +- src/script/sign.h | 2 +- src/script/standard.cpp | 2 +- src/script/standard.h | 2 +- src/serialize.h | 2 +- src/streams.h | 2 +- src/sync.cpp | 2 +- src/sync.h | 2 +- src/test/bignum.h | 2 +- src/threadsafety.h | 2 +- src/timedata.cpp | 2 +- src/timedata.h | 2 +- src/txdb.cpp | 2 +- src/txdb.h | 2 +- src/txmempool.cpp | 2 +- src/txmempool.h | 2 +- src/ui_interface.h | 2 +- src/uint256.cpp | 2 +- src/uint256.h | 2 +- src/undo.h | 2 +- src/util.cpp | 2 +- src/util.h | 2 +- src/utilmoneystr.cpp | 2 +- src/utilmoneystr.h | 2 +- src/utilstrencodings.cpp | 2 +- src/utilstrencodings.h | 2 +- src/utiltime.cpp | 2 +- src/utiltime.h | 2 +- src/version.h | 2 +- src/wallet.cpp | 2 +- src/wallet.h | 2 +- src/wallet_ismine.cpp | 2 +- src/wallet_ismine.h | 2 +- src/walletdb.cpp | 2 +- src/walletdb.h | 2 +- 262 files changed, 264 insertions(+), 264 deletions(-) diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md index a57b4e561..40495cce8 100644 --- a/contrib/devtools/README.md +++ b/contrib/devtools/README.md @@ -44,10 +44,10 @@ If you run this script from src/ it will automatically update the year on the co .cpp and .h files if these have a git commit from the current year. For example a file changed in 2014 (with 2014 being the current year): -```// Copyright (c) 2009-2013 The Bitcoin developers``` +```// Copyright (c) 2009-2013 The Bitcoin Core developers``` would be changed to: -```// Copyright (c) 2009-2014 The Bitcoin developers``` +```// Copyright (c) 2009-2014 The Bitcoin Core developers``` symbol-check.py ================== diff --git a/contrib/devtools/fix-copyright-headers.py b/contrib/devtools/fix-copyright-headers.py index 52fdc9914..5e8495254 100755 --- a/contrib/devtools/fix-copyright-headers.py +++ b/contrib/devtools/fix-copyright-headers.py @@ -7,11 +7,11 @@ a perl regex one liner. For example: if it finds something like this and we're in 2014 -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers it will change it to -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers It will do this for all the files in the folder and its children. diff --git a/contrib/linearize/linearize-data.py b/contrib/linearize/linearize-data.py index 4079844e3..a3a1173b1 100755 --- a/contrib/linearize/linearize-data.py +++ b/contrib/linearize/linearize-data.py @@ -2,7 +2,7 @@ # # linearize-data.py: Construct a linear, no-fork version of the chain. # -# Copyright (c) 2013-2014 The Bitcoin developers +# Copyright (c) 2013-2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # diff --git a/contrib/linearize/linearize-hashes.py b/contrib/linearize/linearize-hashes.py index 707dfcf87..854cf1f9e 100755 --- a/contrib/linearize/linearize-hashes.py +++ b/contrib/linearize/linearize-hashes.py @@ -2,7 +2,7 @@ # # linearize-hashes.py: List blocks in a linear, no-fork version of the chain. # -# Copyright (c) 2013-2014 The Bitcoin developers +# Copyright (c) 2013-2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # diff --git a/src/alert.cpp b/src/alert.cpp index 64399a426..370d0cecc 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/alert.h b/src/alert.h index de4aad814..af42171af 100644 --- a/src/alert.h +++ b/src/alert.h @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/allocators.cpp b/src/allocators.cpp index b1a6a8f98..d3958aa4d 100644 --- a/src/allocators.cpp +++ b/src/allocators.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/allocators.h b/src/allocators.h index 599a4ddc4..6a131c351 100644 --- a/src/allocators.h +++ b/src/allocators.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/amount.cpp b/src/amount.cpp index e6f5b7d44..0a394c96f 100644 --- a/src/amount.cpp +++ b/src/amount.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/amount.h b/src/amount.h index c0d37954c..9212244a8 100644 --- a/src/amount.h +++ b/src/amount.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/base58.cpp b/src/base58.cpp index c594993ea..980d3cbf4 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/base58.h b/src/base58.h index c4cb96814..ed134e6e7 100644 --- a/src/base58.h +++ b/src/base58.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 14d9fcd0f..668d492d6 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 549b5ab6d..337cd44cd 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index b882f104a..8a1745b50 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/bloom.cpp b/src/bloom.cpp index da30e6f35..e60576f4b 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2014 The Bitcoin developers +// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/bloom.h b/src/bloom.h index f54922edb..191ffa19b 100644 --- a/src/bloom.h +++ b/src/bloom.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2014 The Bitcoin developers +// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/chain.cpp b/src/chain.cpp index 3dbaf5a36..719256106 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/chain.h b/src/chain.h index 98db98987..b459c975f 100644 --- a/src/chain.h +++ b/src/chain.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 8a6a061ea..7562509bd 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/chainparams.h b/src/chainparams.h index 5d1ee1d3c..60c7b4758 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index 8646a3160..e45536ce7 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h index eaf3fea1b..24db9b284 100644 --- a/src/chainparamsbase.h +++ b/src/chainparamsbase.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index 0fb4411e6..71579bb30 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/checkpoints.h b/src/checkpoints.h index 65c5165f0..29dc5f83a 100644 --- a/src/checkpoints.h +++ b/src/checkpoints.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/checkqueue.h b/src/checkqueue.h index 2ee46a121..b8e2a17c7 100644 --- a/src/checkqueue.h +++ b/src/checkqueue.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2014 The Bitcoin developers +// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/clientversion.cpp b/src/clientversion.cpp index b3414fdb4..aae0569bb 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2014 The Bitcoin developers +// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/clientversion.h b/src/clientversion.h index 32deaa0f1..40de7837a 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/coincontrol.h b/src/coincontrol.h index 634cc3a29..92fae9847 100644 --- a/src/coincontrol.h +++ b/src/coincontrol.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/coins.cpp b/src/coins.cpp index c2e802c95..bc430c9c7 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2014 The Bitcoin developers +// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/coins.h b/src/coins.h index dbe3f8bd3..9b73ae3a8 100644 --- a/src/coins.h +++ b/src/coins.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/compat.h b/src/compat.h index 44bf0d1ff..7a5438a11 100644 --- a/src/compat.h +++ b/src/compat.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/compat/glibc_compat.cpp b/src/compat/glibc_compat.cpp index f149a08cd..3b9c70df7 100644 --- a/src/compat/glibc_compat.cpp +++ b/src/compat/glibc_compat.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/compat/glibc_sanity.cpp b/src/compat/glibc_sanity.cpp index 607e23b56..d62d74d46 100644 --- a/src/compat/glibc_sanity.cpp +++ b/src/compat/glibc_sanity.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/compat/glibcxx_compat.cpp b/src/compat/glibcxx_compat.cpp index e0b4ac51f..4f2771e57 100644 --- a/src/compat/glibcxx_compat.cpp +++ b/src/compat/glibcxx_compat.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/compat/glibcxx_sanity.cpp b/src/compat/glibcxx_sanity.cpp index aafa4a6ae..cee8a98c7 100644 --- a/src/compat/glibcxx_sanity.cpp +++ b/src/compat/glibcxx_sanity.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/compat/sanity.h b/src/compat/sanity.h index 7f5bc1a4f..909c4f6da 100644 --- a/src/compat/sanity.h +++ b/src/compat/sanity.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/compat/strnlen.cpp b/src/compat/strnlen.cpp index 7f3e15988..1ac266c2d 100644 --- a/src/compat/strnlen.cpp +++ b/src/compat/strnlen.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/compressor.cpp b/src/compressor.cpp index c47a0f6f8..20c154fc1 100644 --- a/src/compressor.cpp +++ b/src/compressor.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/compressor.h b/src/compressor.h index efb8119d0..4a7209083 100644 --- a/src/compressor.h +++ b/src/compressor.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/core_io.h b/src/core_io.h index c805dbc6d..e0620e86b 100644 --- a/src/core_io.h +++ b/src/core_io.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/core_read.cpp b/src/core_read.cpp index 750f83ee5..a49705e04 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/core_write.cpp b/src/core_write.cpp index 400b4c623..b6fd7fe87 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypter.cpp b/src/crypter.cpp index de32dc412..00f7f7f1b 100644 --- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypter.h b/src/crypter.h index f7018cfdb..7b4c2f261 100644 --- a/src/crypter.h +++ b/src/crypter.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/common.h b/src/crypto/common.h index 67c30023c..8b04b1f72 100644 --- a/src/crypto/common.h +++ b/src/crypto/common.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/hmac_sha256.cpp b/src/crypto/hmac_sha256.cpp index 435896538..3c791625d 100644 --- a/src/crypto/hmac_sha256.cpp +++ b/src/crypto/hmac_sha256.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/hmac_sha256.h b/src/crypto/hmac_sha256.h index 1fdee5a7c..1519c1457 100644 --- a/src/crypto/hmac_sha256.h +++ b/src/crypto/hmac_sha256.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/hmac_sha512.cpp b/src/crypto/hmac_sha512.cpp index 940a93277..5939c6ec4 100644 --- a/src/crypto/hmac_sha512.cpp +++ b/src/crypto/hmac_sha512.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/hmac_sha512.h b/src/crypto/hmac_sha512.h index 17d75021a..17dee61ea 100644 --- a/src/crypto/hmac_sha512.h +++ b/src/crypto/hmac_sha512.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/rfc6979_hmac_sha256.cpp b/src/crypto/rfc6979_hmac_sha256.cpp index 3f935abfe..a8c971c3b 100644 --- a/src/crypto/rfc6979_hmac_sha256.cpp +++ b/src/crypto/rfc6979_hmac_sha256.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/rfc6979_hmac_sha256.h b/src/crypto/rfc6979_hmac_sha256.h index e67ddcf8f..f3a54a5d1 100644 --- a/src/crypto/rfc6979_hmac_sha256.h +++ b/src/crypto/rfc6979_hmac_sha256.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/ripemd160.cpp b/src/crypto/ripemd160.cpp index cb4a94a44..77c9acfc2 100644 --- a/src/crypto/ripemd160.cpp +++ b/src/crypto/ripemd160.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/ripemd160.h b/src/crypto/ripemd160.h index f468ec672..687204fda 100644 --- a/src/crypto/ripemd160.h +++ b/src/crypto/ripemd160.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/sha1.cpp b/src/crypto/sha1.cpp index 7f78fdfc6..0b895b33a 100644 --- a/src/crypto/sha1.cpp +++ b/src/crypto/sha1.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/sha1.h b/src/crypto/sha1.h index e28f98dec..7b2a21bc6 100644 --- a/src/crypto/sha1.h +++ b/src/crypto/sha1.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp index 8410e5930..5b9f00a0a 100644 --- a/src/crypto/sha256.cpp +++ b/src/crypto/sha256.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/sha256.h b/src/crypto/sha256.h index bde1a59be..85cf33739 100644 --- a/src/crypto/sha256.h +++ b/src/crypto/sha256.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/sha512.cpp b/src/crypto/sha512.cpp index 22c3103be..564127cc3 100644 --- a/src/crypto/sha512.cpp +++ b/src/crypto/sha512.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/crypto/sha512.h b/src/crypto/sha512.h index 5566d5db3..f1f17caf9 100644 --- a/src/crypto/sha512.h +++ b/src/crypto/sha512.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/db.cpp b/src/db.cpp index cb24912fe..94629968d 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/db.h b/src/db.h index 1c572d897..717462ff4 100644 --- a/src/db.h +++ b/src/db.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/eccryptoverify.cpp b/src/eccryptoverify.cpp index 435154d60..e894e1122 100644 --- a/src/eccryptoverify.cpp +++ b/src/eccryptoverify.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/eccryptoverify.h b/src/eccryptoverify.h index da7e80c7c..c67c1e44f 100644 --- a/src/eccryptoverify.h +++ b/src/eccryptoverify.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/ecwrapper.cpp b/src/ecwrapper.cpp index 5ce7e6129..c29390eb9 100644 --- a/src/ecwrapper.cpp +++ b/src/ecwrapper.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/ecwrapper.h b/src/ecwrapper.h index 4efde5165..efb6cd18a 100644 --- a/src/ecwrapper.h +++ b/src/ecwrapper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/hash.cpp b/src/hash.cpp index aaca00ea2..a7eb5a2a0 100644 --- a/src/hash.cpp +++ b/src/hash.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2013-2014 The Bitcoin developers +// Copyright (c) 2013-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/hash.h b/src/hash.h index 5a34cdc5c..e56b784a6 100644 --- a/src/hash.h +++ b/src/hash.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/init.cpp b/src/init.cpp index 63199b320..220d3b93a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/init.h b/src/init.h index f2f7ac674..d451f65be 100644 --- a/src/init.h +++ b/src/init.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/key.cpp b/src/key.cpp index 36613342b..7f1cef170 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/key.h b/src/key.h index d85abe095..85cc1e55d 100644 --- a/src/key.h +++ b/src/key.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/keystore.cpp b/src/keystore.cpp index 879f09972..482125a39 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/keystore.h b/src/keystore.h index 60502e9a2..6655264d7 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/leveldbwrapper.cpp b/src/leveldbwrapper.cpp index 70980fede..c353dfa6d 100644 --- a/src/leveldbwrapper.cpp +++ b/src/leveldbwrapper.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2014 The Bitcoin developers +// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/leveldbwrapper.h b/src/leveldbwrapper.h index 42479206c..c65e84270 100644 --- a/src/leveldbwrapper.h +++ b/src/leveldbwrapper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2014 The Bitcoin developers +// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/limitedmap.h b/src/limitedmap.h index 03727d7c4..e8ea54965 100644 --- a/src/limitedmap.h +++ b/src/limitedmap.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2014 The Bitcoin developers +// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/main.cpp b/src/main.cpp index 3e0741ae7..dd71c53d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/main.h b/src/main.h index 8f0378647..717cec769 100644 --- a/src/main.h +++ b/src/main.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/merkleblock.cpp b/src/merkleblock.cpp index 8618e355d..1b7ee27e0 100644 --- a/src/merkleblock.cpp +++ b/src/merkleblock.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/merkleblock.h b/src/merkleblock.h index c549e3cdb..52c914967 100644 --- a/src/merkleblock.h +++ b/src/merkleblock.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/miner.cpp b/src/miner.cpp index 82f992e85..2133b13e6 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/miner.h b/src/miner.h index 998ea57a7..02dedb171 100644 --- a/src/miner.h +++ b/src/miner.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/mruset.h b/src/mruset.h index bf7c7fdee..1969f419c 100644 --- a/src/mruset.h +++ b/src/mruset.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Bitcoin developers +// Copyright (c) 2012 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/net.cpp b/src/net.cpp index 3f4017d13..474a3e428 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/net.h b/src/net.h index c705a85c8..fed5a5959 100644 --- a/src/net.h +++ b/src/net.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/netbase.cpp b/src/netbase.cpp index 1fc3334b7..a2ac6575b 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/netbase.h b/src/netbase.h index fe5d64320..5bf13a673 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/noui.cpp b/src/noui.cpp index 630b095d0..3a7736191 100644 --- a/src/noui.cpp +++ b/src/noui.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/noui.h b/src/noui.h index c7e4aaa1e..15cd30a63 100644 --- a/src/noui.h +++ b/src/noui.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Bitcoin developers +// Copyright (c) 2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/pow.cpp b/src/pow.cpp index 3b41083f9..e91e3d893 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/pow.h b/src/pow.h index 293634be6..89b219f80 100644 --- a/src/pow.h +++ b/src/pow.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index cf7a392a3..2b6a302ee 100644 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/primitives/block.h b/src/primitives/block.h index 9c0a6decc..1449882bd 100644 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index 336151905..230aedd89 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index a7a1e013e..da3501230 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/protocol.cpp b/src/protocol.cpp index f8f43a05f..71c6bd152 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/protocol.h b/src/protocol.h index e578c1ec9..f8394ce52 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/pubkey.cpp b/src/pubkey.cpp index 80bbac920..3ae67ca5f 100644 --- a/src/pubkey.cpp +++ b/src/pubkey.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/pubkey.h b/src/pubkey.h index 37351cff0..69b73a4e1 100644 --- a/src/pubkey.h +++ b/src/pubkey.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 303c7c233..fd3c1f2c0 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h index b3c308dc0..5105f09ce 100644 --- a/src/qt/addressbookpage.h +++ b/src/qt/addressbookpage.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index c42a55ec2..bfb5bf3fe 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h index 33504e0c6..6b34b2eac 100644 --- a/src/qt/addresstablemodel.h +++ b/src/qt/addresstablemodel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index 181ef0812..9b7b59c0d 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/askpassphrasedialog.h b/src/qt/askpassphrasedialog.h index bedbea213..74d54d18f 100644 --- a/src/qt/askpassphrasedialog.h +++ b/src/qt/askpassphrasedialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 08f72e171..1adf4e00c 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoinaddressvalidator.cpp b/src/qt/bitcoinaddressvalidator.cpp index d7c4d2706..d712705c4 100644 --- a/src/qt/bitcoinaddressvalidator.cpp +++ b/src/qt/bitcoinaddressvalidator.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoinaddressvalidator.h b/src/qt/bitcoinaddressvalidator.h index 568926608..30d4a26d0 100644 --- a/src/qt/bitcoinaddressvalidator.h +++ b/src/qt/bitcoinaddressvalidator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 408634dec..fdb9bcd6d 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h index 4bab91eaf..b047e6c51 100644 --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 89a4f9838..4eef18585 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 7cda8c15c..7509a0073 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index 863d4a01a..758fba705 100644 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoinunits.h b/src/qt/bitcoinunits.h index c40fd8b16..a01fcc8cf 100644 --- a/src/qt/bitcoinunits.h +++ b/src/qt/bitcoinunits.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index a121ec587..493cdd6dd 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 5a8b43660..4856a72d7 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 5647661ba..e650e0ffa 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/coincontroldialog.h b/src/qt/coincontroldialog.h index 8945bf180..097444306 100644 --- a/src/qt/coincontroldialog.h +++ b/src/qt/coincontroldialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/coincontroltreewidget.cpp b/src/qt/coincontroltreewidget.cpp index bb8f385bb..6cbcf7128 100644 --- a/src/qt/coincontroltreewidget.cpp +++ b/src/qt/coincontroltreewidget.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/coincontroltreewidget.h b/src/qt/coincontroltreewidget.h index e9bfe2352..98a7d32f0 100644 --- a/src/qt/coincontroltreewidget.h +++ b/src/qt/coincontroltreewidget.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/csvmodelwriter.cpp b/src/qt/csvmodelwriter.cpp index a99885019..55c595708 100644 --- a/src/qt/csvmodelwriter.cpp +++ b/src/qt/csvmodelwriter.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/csvmodelwriter.h b/src/qt/csvmodelwriter.h index d3cf5d732..a2bf379f4 100644 --- a/src/qt/csvmodelwriter.h +++ b/src/qt/csvmodelwriter.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp index 2be7598e7..1c22594cd 100644 --- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/editaddressdialog.h b/src/qt/editaddressdialog.h index e25db7a11..13c6da8ed 100644 --- a/src/qt/editaddressdialog.h +++ b/src/qt/editaddressdialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h index 819e5c9e2..a0a2993ea 100644 --- a/src/qt/guiconstants.h +++ b/src/qt/guiconstants.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 5adf17361..a3ede9fd6 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 73b63789b..4f8c68314 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 88dbfd24d..fb7ed1559 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/intro.h b/src/qt/intro.h index 03974841b..c9735615b 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/macdockiconhandler.h b/src/qt/macdockiconhandler.h index 989136984..1217bd8e8 100644 --- a/src/qt/macdockiconhandler.h +++ b/src/qt/macdockiconhandler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/macnotificationhandler.h b/src/qt/macnotificationhandler.h index c08c32799..bd66b96b2 100644 --- a/src/qt/macnotificationhandler.h +++ b/src/qt/macnotificationhandler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index 2da54876c..4541c7588 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/networkstyle.h b/src/qt/networkstyle.h index 953004c12..b78a9f594 100644 --- a/src/qt/networkstyle.h +++ b/src/qt/networkstyle.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/notificator.cpp b/src/qt/notificator.cpp index 86b205ed8..5a564248e 100644 --- a/src/qt/notificator.cpp +++ b/src/qt/notificator.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/notificator.h b/src/qt/notificator.h index a7605f83b..182e948c7 100644 --- a/src/qt/notificator.h +++ b/src/qt/notificator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/openuridialog.cpp b/src/qt/openuridialog.cpp index a1de7acea..1c843aecb 100644 --- a/src/qt/openuridialog.cpp +++ b/src/qt/openuridialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/openuridialog.h b/src/qt/openuridialog.h index 4f4fdccaf..d5c434ba9 100644 --- a/src/qt/openuridialog.h +++ b/src/qt/openuridialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 8ce9fd7a6..a0f3993e6 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h index 019749150..f4e515759 100644 --- a/src/qt/optionsdialog.h +++ b/src/qt/optionsdialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 1e11de3c1..7d2dbd96d 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index 061ae1ad9..bf892768e 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 18c900d02..01b4036f8 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index 803816fa4..64cb1dc4e 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/paymentrequestplus.cpp b/src/qt/paymentrequestplus.cpp index ca3f06962..35846bc15 100644 --- a/src/qt/paymentrequestplus.cpp +++ b/src/qt/paymentrequestplus.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index bd3dab41a..3f8e89535 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h index e1305b943..2fc24395f 100644 --- a/src/qt/paymentserver.h +++ b/src/qt/paymentserver.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp index 7840b9283..dfb7a623a 100644 --- a/src/qt/peertablemodel.cpp +++ b/src/qt/peertablemodel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/peertablemodel.h b/src/qt/peertablemodel.h index ac3a18c05..bff7bb824 100644 --- a/src/qt/peertablemodel.h +++ b/src/qt/peertablemodel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/qvalidatedlineedit.cpp b/src/qt/qvalidatedlineedit.cpp index d960e4b19..346369392 100644 --- a/src/qt/qvalidatedlineedit.cpp +++ b/src/qt/qvalidatedlineedit.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/qvalidatedlineedit.h b/src/qt/qvalidatedlineedit.h index 810d5f276..f63568d27 100644 --- a/src/qt/qvalidatedlineedit.h +++ b/src/qt/qvalidatedlineedit.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/qvaluecombobox.cpp b/src/qt/qvaluecombobox.cpp index 8c578dfa5..f73268c95 100644 --- a/src/qt/qvaluecombobox.cpp +++ b/src/qt/qvaluecombobox.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/qvaluecombobox.h b/src/qt/qvaluecombobox.h index 62b1d90dd..dc85d64cb 100644 --- a/src/qt/qvaluecombobox.h +++ b/src/qt/qvaluecombobox.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index ee3a046aa..aa1440e2c 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h index ae93b5aa8..70a1842fa 100644 --- a/src/qt/receivecoinsdialog.h +++ b/src/qt/receivecoinsdialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index 9d932cfc9..0c4a20cf9 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/receiverequestdialog.h b/src/qt/receiverequestdialog.h index b69ef4257..3e5f897be 100644 --- a/src/qt/receiverequestdialog.h +++ b/src/qt/receiverequestdialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index adc4e115e..5221ec3e2 100644 --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/recentrequeststablemodel.h b/src/qt/recentrequeststablemodel.h index 741a8148f..85bad126d 100644 --- a/src/qt/recentrequeststablemodel.h +++ b/src/qt/recentrequeststablemodel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 9528e72d2..271315b8c 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 947d2b4a9..fff5cfbf5 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 46cbbb161..cde77a5d4 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h index 9db9252f7..14adb0257 100644 --- a/src/qt/sendcoinsdialog.h +++ b/src/qt/sendcoinsdialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 6a7108199..ad9189d20 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index b3d846c94..4cb00cd36 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp index c793262ad..e16e245b6 100644 --- a/src/qt/signverifymessagedialog.cpp +++ b/src/qt/signverifymessagedialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/signverifymessagedialog.h b/src/qt/signverifymessagedialog.h index d8e240b55..27807adc8 100644 --- a/src/qt/signverifymessagedialog.h +++ b/src/qt/signverifymessagedialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 049b775d5..366ed3df3 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/splashscreen.h b/src/qt/splashscreen.h index 63eb0714c..84e4556dd 100644 --- a/src/qt/splashscreen.h +++ b/src/qt/splashscreen.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/test/paymentrequestdata.h b/src/qt/test/paymentrequestdata.h index aeaa7d89a..37544cdeb 100644 --- a/src/qt/test/paymentrequestdata.h +++ b/src/qt/test/paymentrequestdata.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/test/paymentservertests.cpp b/src/qt/test/paymentservertests.cpp index 8f49cb946..70254cd75 100644 --- a/src/qt/test/paymentservertests.cpp +++ b/src/qt/test/paymentservertests.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/test/paymentservertests.h b/src/qt/test/paymentservertests.h index 0717111f6..c98bbf083 100644 --- a/src/qt/test/paymentservertests.h +++ b/src/qt/test/paymentservertests.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index f2161c2f7..da5f07439 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/test/uritests.cpp b/src/qt/test/uritests.cpp index 78a7b1b9b..8b53c0d5c 100644 --- a/src/qt/test/uritests.cpp +++ b/src/qt/test/uritests.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/test/uritests.h b/src/qt/test/uritests.h index ed30a9f4a..a0b7dc6c7 100644 --- a/src/qt/test/uritests.h +++ b/src/qt/test/uritests.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index a1a03b297..0b2eb9eaf 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/trafficgraphwidget.h b/src/qt/trafficgraphwidget.h index 18336de94..4c6b17fe7 100644 --- a/src/qt/trafficgraphwidget.h +++ b/src/qt/trafficgraphwidget.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index ed8be628a..68c275d49 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactiondesc.h b/src/qt/transactiondesc.h index 04f54ba08..5467348ee 100644 --- a/src/qt/transactiondesc.h +++ b/src/qt/transactiondesc.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactiondescdialog.cpp b/src/qt/transactiondescdialog.cpp index 56e1fc050..fadaa98f4 100644 --- a/src/qt/transactiondescdialog.cpp +++ b/src/qt/transactiondescdialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactiondescdialog.h b/src/qt/transactiondescdialog.h index f10a13621..54374e359 100644 --- a/src/qt/transactiondescdialog.h +++ b/src/qt/transactiondescdialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactionfilterproxy.cpp b/src/qt/transactionfilterproxy.cpp index 67733d311..7981eb7c9 100644 --- a/src/qt/transactionfilterproxy.cpp +++ b/src/qt/transactionfilterproxy.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactionfilterproxy.h b/src/qt/transactionfilterproxy.h index 42f4df4d6..acea9a1e3 100644 --- a/src/qt/transactionfilterproxy.h +++ b/src/qt/transactionfilterproxy.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 9905ca76f..fea436806 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index 3accbb26e..a5bc37571 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 73e3d9de7..1dea5cdad 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index 525b23bfe..5eaccad06 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 58f33f95a..00fd209c9 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h index baad0fcbf..2858982f0 100644 --- a/src/qt/transactionview.h +++ b/src/qt/transactionview.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 929f8156d..e6cec8173 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/utilitydialog.h b/src/qt/utilitydialog.h index 1cbded025..288b985f1 100644 --- a/src/qt/utilitydialog.h +++ b/src/qt/utilitydialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 4084adc96..892947bf3 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h index 68bd1ce21..eea97defc 100644 --- a/src/qt/walletframe.h +++ b/src/qt/walletframe.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 8355125c4..6006a7bd7 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 17f1b9f2e..d8df25f66 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2014 The Bitcoin developers +// Copyright (c) 2011-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp index a9183d11a..8f32e4614 100644 --- a/src/qt/walletmodeltransaction.cpp +++ b/src/qt/walletmodeltransaction.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h index 48bcbc884..b6bb6d67f 100644 --- a/src/qt/walletmodeltransaction.h +++ b/src/qt/walletmodeltransaction.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 77db9757f..28b9c3b56 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/walletview.h b/src/qt/walletview.h index 6c2c3ca61..f3d14c065 100644 --- a/src/qt/walletview.h +++ b/src/qt/walletview.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2013 The Bitcoin developers +// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/winshutdownmonitor.cpp b/src/qt/winshutdownmonitor.cpp index 51391a933..1bc4f7795 100644 --- a/src/qt/winshutdownmonitor.cpp +++ b/src/qt/winshutdownmonitor.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/winshutdownmonitor.h b/src/qt/winshutdownmonitor.h index a8176f951..0bed55a2c 100644 --- a/src/qt/winshutdownmonitor.h +++ b/src/qt/winshutdownmonitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/random.cpp b/src/random.cpp index 3a1311cb5..663456e96 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/random.h b/src/random.h index 214ee0a79..1a2d3e8ee 100644 --- a/src/random.h +++ b/src/random.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rest.cpp b/src/rest.cpp index 69e6c0888..4702f0d70 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 66e86ebac..71fb7c823 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcclient.cpp b/src/rpcclient.cpp index 03ce9acbb..4e45bc32a 100644 --- a/src/rpcclient.cpp +++ b/src/rpcclient.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcclient.h b/src/rpcclient.h index a91c2eb03..42fa2d06f 100644 --- a/src/rpcclient.h +++ b/src/rpcclient.h @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index 8b95373cf..8666779cc 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 45899d3db..44ebff9d3 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 90b9c99ca..b8805b9d5 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 6ddbd62fc..2886f7ada 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp index 2f7c491f3..c4d6f06b1 100644 --- a/src/rpcprotocol.cpp +++ b/src/rpcprotocol.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcprotocol.h b/src/rpcprotocol.h index f4a4877d3..4f3f70fb3 100644 --- a/src/rpcprotocol.h +++ b/src/rpcprotocol.h @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index f596c358a..b87a8baac 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index c0f0d253f..c5d74afba 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcserver.h b/src/rpcserver.h index 8fea38126..fb561ab93 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index e43eee155..63da8a20b 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/bitcoinconsensus.cpp b/src/script/bitcoinconsensus.cpp index e80e55df7..c8dd54a74 100644 --- a/src/script/bitcoinconsensus.cpp +++ b/src/script/bitcoinconsensus.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/bitcoinconsensus.h b/src/script/bitcoinconsensus.h index 15e3337a8..9d9c26643 100644 --- a/src/script/bitcoinconsensus.h +++ b/src/script/bitcoinconsensus.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 3231f2e74..80a32e78f 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/interpreter.h b/src/script/interpreter.h index 35b2f6c65..3c4e7d466 100644 --- a/src/script/interpreter.h +++ b/src/script/interpreter.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/script.cpp b/src/script/script.cpp index b879d72d6..fd3392473 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/script.h b/src/script/script.h index 9c22cb908..78fd12cd2 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/script_error.cpp b/src/script/script_error.cpp index 5d24ed98b..d8ecfde1d 100644 --- a/src/script/script_error.cpp +++ b/src/script/script_error.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/script_error.h b/src/script/script_error.h index 091524f35..5c260327b 100644 --- a/src/script/script_error.h +++ b/src/script/script_error.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/sigcache.cpp b/src/script/sigcache.cpp index 5580a5933..75ecdb563 100644 --- a/src/script/sigcache.cpp +++ b/src/script/sigcache.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/sigcache.h b/src/script/sigcache.h index df2a2ea13..3bd11caff 100644 --- a/src/script/sigcache.h +++ b/src/script/sigcache.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/sign.cpp b/src/script/sign.cpp index 03c33ad9b..adddd4ec7 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/sign.h b/src/script/sign.h index 45a5e0dea..e197d5fab 100644 --- a/src/script/sign.h +++ b/src/script/sign.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/standard.cpp b/src/script/standard.cpp index ab6e6cde0..d0e225004 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/script/standard.h b/src/script/standard.h index c4b82b4c4..1d29ef57a 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/serialize.h b/src/serialize.h index ad38a3fa2..e4a4039c7 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/streams.h b/src/streams.h index ba074a4c2..6bd6d2b92 100644 --- a/src/streams.h +++ b/src/streams.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/sync.cpp b/src/sync.cpp index e2f05e62a..e28caee8e 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2012 The Bitcoin developers +// Copyright (c) 2011-2012 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/sync.h b/src/sync.h index 29006b3ed..7891e4156 100644 --- a/src/sync.h +++ b/src/sync.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/test/bignum.h b/src/test/bignum.h index 7ed62606f..365b17a1c 100644 --- a/src/test/bignum.h +++ b/src/test/bignum.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/threadsafety.h b/src/threadsafety.h index 5409c0301..d01c50abb 100644 --- a/src/threadsafety.h +++ b/src/threadsafety.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2012 The Bitcoin developers +// Copyright (c) 2009-2012 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/timedata.cpp b/src/timedata.cpp index 59f7778db..d04f3d2f7 100644 --- a/src/timedata.cpp +++ b/src/timedata.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/timedata.h b/src/timedata.h index 64595ffc3..2296baf11 100644 --- a/src/timedata.h +++ b/src/timedata.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin developers +// Copyright (c) 2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/txdb.cpp b/src/txdb.cpp index f735476a1..5096ab19a 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/txdb.h b/src/txdb.h index f81fc6268..f6b6b84fc 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 1df9c5c79..40d24d3b7 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/txmempool.h b/src/txmempool.h index f671352b5..0732af67e 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/ui_interface.h b/src/ui_interface.h index 8d63e0464..3f11a1dda 100644 --- a/src/ui_interface.h +++ b/src/ui_interface.h @@ -1,5 +1,5 @@ // Copyright (c) 2010 Satoshi Nakamoto -// Copyright (c) 2012 The Bitcoin developers +// Copyright (c) 2012 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/uint256.cpp b/src/uint256.cpp index 9d87327d8..918c1a7cd 100644 --- a/src/uint256.cpp +++ b/src/uint256.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/uint256.h b/src/uint256.h index 56f7f44a1..139270ac4 100644 --- a/src/uint256.h +++ b/src/uint256.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/undo.h b/src/undo.h index 2301bd8b4..e6d8fd586 100644 --- a/src/undo.h +++ b/src/undo.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/util.cpp b/src/util.cpp index 282e54e48..0d0f7e5f9 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/util.h b/src/util.h index 623c24f5c..bbb0e8103 100644 --- a/src/util.h +++ b/src/util.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/utilmoneystr.cpp b/src/utilmoneystr.cpp index 3e076a026..2fbc04887 100644 --- a/src/utilmoneystr.cpp +++ b/src/utilmoneystr.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/utilmoneystr.h b/src/utilmoneystr.h index 6a153db5f..cd9b04810 100644 --- a/src/utilmoneystr.h +++ b/src/utilmoneystr.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/utilstrencodings.cpp b/src/utilstrencodings.cpp index 419a63c43..c15bddc6f 100644 --- a/src/utilstrencodings.cpp +++ b/src/utilstrencodings.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/utilstrencodings.h b/src/utilstrencodings.h index 0c0171b89..b0edd8b54 100644 --- a/src/utilstrencodings.h +++ b/src/utilstrencodings.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/utiltime.cpp b/src/utiltime.cpp index 9c137e8aa..8f0dcae29 100644 --- a/src/utiltime.cpp +++ b/src/utiltime.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/utiltime.h b/src/utiltime.h index 9d7d42fe4..900992f87 100644 --- a/src/utiltime.h +++ b/src/utiltime.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/version.h b/src/version.h index a5a72c546..38b3d2e73 100644 --- a/src/version.h +++ b/src/version.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2014 The Bitcoin developers +// Copyright (c) 2012-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/wallet.cpp b/src/wallet.cpp index 94e6ccf99..9b9a1d173 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/wallet.h b/src/wallet.h index 2dd2146e8..8ad01265d 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/wallet_ismine.cpp b/src/wallet_ismine.cpp index 839f69485..5482348e3 100644 --- a/src/wallet_ismine.cpp +++ b/src/wallet_ismine.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/wallet_ismine.h b/src/wallet_ismine.h index 5f0c0c1a0..6293df8b1 100644 --- a/src/wallet_ismine.h +++ b/src/wallet_ismine.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 416403b09..4fd7eb512 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/walletdb.h b/src/walletdb.h index 38699043b..45c00328a 100644 --- a/src/walletdb.h +++ b/src/walletdb.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers +// Copyright (c) 2009-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. From dd14a0e799b6552ae85aaab2b0b48f788c578aea Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Fri, 19 Dec 2014 14:39:10 -0500 Subject: [PATCH 28/88] docs: update gitian building docs --- doc/gitian-building.md | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/doc/gitian-building.md b/doc/gitian-building.md index b356a5d88..defddedc6 100644 --- a/doc/gitian-building.md +++ b/doc/gitian-building.md @@ -291,7 +291,7 @@ Setting up gitian images ------------------------- Gitian needs virtual images of the operating system to build in. -Currently this is Ubuntu Precise for both x86 architectures. +Currently this is Ubuntu Precise for x86_64. These images will be copied and used every time that a build is started to make sure that the build is deterministic. Creating the images will take a while, but only has to be done once. @@ -300,7 +300,6 @@ Execute the following as user `debian`: ```bash cd gitian-builder -bin/make-base-vm --lxc --arch i386 --suite precise bin/make-base-vm --lxc --arch amd64 --suite precise ``` @@ -311,27 +310,10 @@ There will be a lot of warnings printed during build of the images. These can be Getting and building the inputs -------------------------------- -In [doc/release-process.md](release-process.md) in the bitcoin repository under 'Fetch and build inputs'. -you will find a list of `wget` commands that can be executed to get the dependencies. - -I needed to add `--no-check-certificate` to the OpenSSL wget line to make it work. -Likely this is because the ca-certificates in Debian 7.4 is fairly old. This does not create a -security issue as the gitian descriptors check the integrity of the input archives and refuse to work -if any one is corrupted. - -After downloading the archives, execute the `gbuild` commands to build the dependencies. -This can take a long time, but only has to be done when the dependencies change, for example -to upgrade the used version. - -**Note**: Do not forget to copy the result from `build/out` to `inputs` after every gbuild command! This will save -you a lot of time. - -At any time you can check the package installation and build progress with - -```bash -tail -f var/install.log -tail -f var/build.log -``` +Follow the instructions in [doc/release-process.md](release-process.md) in the bitcoin repository +under 'Fetch and build inputs' to install sources which require manual intervention. Also follow +the next step: 'Seed the Gitian sources cache', which will fetch all necessary source files allowing +for gitian to work offline. Building Bitcoin ---------------- @@ -339,6 +321,15 @@ Building Bitcoin To build Bitcoin (for Linux, OSX and Windows) just follow the steps under 'perform gitian builds' in [doc/release-process.md](release-process.md) in the bitcoin repository. +This may take a long time as it also builds the dependencies needed for each descriptor. +These dependencies will be cached after a successful build to avoid rebuilding them when possible. + +At any time you can check the package installation and build progress with + +```bash +tail -f var/install.log +tail -f var/build.log + Output from `gbuild` will look something like Initialized empty Git repository in /home/debian/gitian-builder/inputs/bitcoin/.git/ @@ -348,7 +339,7 @@ Output from `gbuild` will look something like Resolving deltas: 100% (25724/25724), done. From https://github.com/bitcoin/bitcoin ... (new tags, new branch etc) - --- Building for precise i386 --- + --- Building for precise x86_64 --- Stopping target if it is up Making a new image copy stdin: is not a tty @@ -363,9 +354,6 @@ Output from `gbuild` will look something like lxc-start: Connection refused - inotify event with no name (mask 32768) Running build script (log in var/build.log) -As when building the dependencies, the progress of package installation and building -can be inspected in `var/install.log` and `var/build.log`. - Building an alternative repository ----------------------------------- From aa279d613152e87ea25edfdf76c86779c0632f18 Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Tue, 16 Dec 2014 01:43:40 -0800 Subject: [PATCH 29/88] Enforce minRelayTxFee on wallet created tx and add a maxtxfee option. Previously the minRelayTxFee was only enforced on user specified values. It was possible for smartfee to produce a fee below minRelayTxFee which would just result in the transaction getting stuck because it can't be relayed. This also introduces a maxtxfee option which sets an absolute maximum for any fee created by the wallet, with an intention of increasing user confidence that the automatic fees won't burn them. This was frequently a concern even before smartfees. If the configured fee policy won't even allow the wallet to meet the relay fee the transaction creation may be aborted. --- src/init.cpp | 15 +++++++++++++++ src/wallet.cpp | 49 +++++++++++++++++++++++++++++-------------------- src/wallet.h | 5 +++++ 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 11329c16a..c5ced8654 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -288,6 +288,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -sendfreetransactions " + strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), 0) + "\n"; strUsage += " -spendzeroconfchange " + strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), 1) + "\n"; strUsage += " -txconfirmtarget= " + strprintf(_("If paytxfee is not set, include enough fee so transactions are confirmed on average within n blocks (default: %u)"), 1) + "\n"; + strUsage += " -maxtxfee= " + strprintf(_("Maximum total fees to use in a single wallet transaction, setting too low may abort large transactions (default: %s)"), FormatMoney(maxTxFee)) + "\n"; strUsage += " -upgradewallet " + _("Upgrade wallet to latest format") + " " + _("on startup") + "\n"; strUsage += " -wallet= " + _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat") + "\n"; strUsage += " -walletnotify= " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n"; @@ -697,6 +698,20 @@ bool AppInit2(boost::thread_group& threadGroup) mapArgs["-paytxfee"], ::minRelayTxFee.ToString())); } } + if (mapArgs.count("-maxtxfee")) + { + CAmount nMaxFee = 0; + if (!ParseMoney(mapArgs["-maxtxfee"], nMaxFee)) + return InitError(strprintf(_("Invalid amount for -maxtxfee=: '%s'"), mapArgs["-maptxfee"])); + if (nMaxFee > nHighTransactionMaxFeeWarning) + InitWarning(_("Warning: -maxtxfee is set very high! Fees this large could be paid on a single transaction.")); + maxTxFee = nMaxFee; + if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee) + { + return InitError(strprintf(_("Invalid amount for -maxtxfee=: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"), + mapArgs["-maxtxfee"], ::minRelayTxFee.ToString())); + } + } nTxConfirmTarget = GetArg("-txconfirmtarget", 1); bSpendZeroConfChange = GetArg("-spendzeroconfchange", true); fSendFreeTransactions = GetArg("-sendfreetransactions", false); diff --git a/src/wallet.cpp b/src/wallet.cpp index 32a64daac..dd87fab44 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -26,6 +26,7 @@ using namespace std; * Settings */ CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE); +CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE; unsigned int nTxConfirmTarget = 1; bool bSpendZeroConfChange = true; bool fSendFreeTransactions = false; @@ -1499,28 +1500,33 @@ bool CWallet::CreateTransaction(const vector >& vecSend, } dPriority = wtxNew.ComputePriority(dPriority, nBytes); + // Can we complete this as a free transaction? + if (fSendFreeTransactions && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE) + { + // Not enough fee: enough priority? + double dPriorityNeeded = mempool.estimatePriority(nTxConfirmTarget); + // Not enough mempool history to estimate: use hard-coded AllowFree. + if (dPriorityNeeded <= 0 && AllowFree(dPriority)) + break; + + // Small enough, and priority high enough, to send for free + if (dPriorityNeeded > 0 && dPriority >= dPriorityNeeded) + break; + } + CAmount nFeeNeeded = GetMinimumFee(nBytes, nTxConfirmTarget, mempool); + // If we made it here and we aren't even able to meet the relay fee on the next pass, give up + // because we must be at the maximum allowed fee. + if (nFeeNeeded < ::minRelayTxFee.GetFee(nBytes)) + { + strFailReason = _("Transaction too large for fee policy"); + return false; + } + if (nFeeRet >= nFeeNeeded) break; // Done, enough fee included. - // Too big to send for free? Include more fee and try again: - if (!fSendFreeTransactions || nBytes > MAX_FREE_TRANSACTION_CREATE_SIZE) - { - nFeeRet = nFeeNeeded; - continue; - } - - // Not enough fee: enough priority? - double dPriorityNeeded = mempool.estimatePriority(nTxConfirmTarget); - // Not enough mempool history to estimate: use hard-coded AllowFree. - if (dPriorityNeeded <= 0 && AllowFree(dPriority)) - break; - - // Small enough, and priority high enough, to send for free - if (dPriorityNeeded > 0 && dPriority >= dPriorityNeeded) - break; - // Include more fee and try again. nFeeRet = nFeeNeeded; continue; @@ -1591,9 +1597,6 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge { // payTxFee is user-set "I want to pay this much" CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes); - // prevent user from paying a non-sense fee (like 1 satoshi): 0 < fee < minRelayFee - if (nFeeNeeded > 0 && nFeeNeeded < ::minRelayTxFee.GetFee(nTxBytes)) - nFeeNeeded = ::minRelayTxFee.GetFee(nTxBytes); // user selected total at least (default=true) if (fPayAtLeastCustomFee && nFeeNeeded > 0 && nFeeNeeded < payTxFee.GetFeePerK()) nFeeNeeded = payTxFee.GetFeePerK(); @@ -1604,6 +1607,12 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge // back to a hard-coded fee if (nFeeNeeded == 0) nFeeNeeded = minTxFee.GetFee(nTxBytes); + // prevent user from paying a non-sense fee (like 1 satoshi): 0 < fee < minRelayFee + if (nFeeNeeded < ::minRelayTxFee.GetFee(nTxBytes)) + nFeeNeeded = ::minRelayTxFee.GetFee(nTxBytes); + // But always obey the maximum + if (nFeeNeeded > maxTxFee) + nFeeNeeded = maxTxFee; return nFeeNeeded; } diff --git a/src/wallet.h b/src/wallet.h index 2dd2146e8..058107edf 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -30,6 +30,7 @@ * Settings */ extern CFeeRate payTxFee; +extern CAmount maxTxFee; extern unsigned int nTxConfirmTarget; extern bool bSpendZeroConfChange; extern bool fSendFreeTransactions; @@ -39,6 +40,10 @@ extern bool fPayAtLeastCustomFee; static const CAmount DEFAULT_TRANSACTION_FEE = 0; //! -paytxfee will warn if called with a higher fee than this amount (in satoshis) per KB static const CAmount nHighTransactionFeeWarning = 0.01 * COIN; +//! -maxtxfee default +static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.1 * COIN; +//! -maxtxfee will warn if called with a higher fee than this amount (in satoshis) +static const CAmount nHighTransactionMaxFeeWarning = 100 * nHighTransactionFeeWarning; //! Largest (in bytes) free transaction we're willing to create static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000; From be43492945f740514ad5f949d9bb4f47ef2b1926 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Fri, 19 Dec 2014 18:02:44 -0500 Subject: [PATCH 30/88] build: fix 'make distcheck' Rather than treating the .py as a regular built test, run it from check-local so that we can better control the paths used. --- src/Makefile.test.include | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 9e9f478d8..c6bd0cf9c 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -1,4 +1,4 @@ -TESTS += test/test_bitcoin test/bitcoin-util-test.py +TESTS += test/test_bitcoin bin_PROGRAMS += test/test_bitcoin TEST_SRCDIR = test TEST_BINARY=test/test_bitcoin$(EXEEXT) @@ -105,6 +105,8 @@ bitcoin_test_clean : FORCE rm -f $(CLEAN_BITCOIN_TEST) $(test_test_bitcoin_OBJECTS) $(TEST_BINARY) check-local: + @echo "Running test/bitcoin-util-test.py..." + $(AM_V_at)srcdir=$(srcdir) PYTHONPATH=$(builddir)/test $(srcdir)/test/bitcoin-util-test.py $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check %.json.h: %.json From 39c809942d7e526a25dde470cd5e95e43fd7a774 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 20 Dec 2014 13:58:51 +0100 Subject: [PATCH 31/88] contrib: make github-merge require signing - Exit when there is no signing key configured - Exit when user does not want to sign off --- contrib/devtools/github-merge.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/contrib/devtools/github-merge.sh b/contrib/devtools/github-merge.sh index 6f68496ed..ec7a1f4c4 100755 --- a/contrib/devtools/github-merge.sh +++ b/contrib/devtools/github-merge.sh @@ -156,12 +156,17 @@ read -p "Press 's' to sign off on the merge. " -n 1 -r >&2 echo if [[ "d$REPLY" =~ ^d[Ss]$ ]]; then if [[ "$(git config --get user.signingkey)" == "" ]]; then - echo "WARNING: No GPG signing key set, not signing. Set one using:" >&2 + echo "ERROR: No GPG signing key set, not signing. Set one using:" >&2 echo "git config --global user.signingkey " >&2 - git commit -q --signoff --amend --no-edit + cleanup + exit 1 else git commit -q --gpg-sign --amend --no-edit fi +else + echo "Not signing off on merge, exiting." + cleanup + exit 1 fi # Clean up temporary branches, and put the result in $BRANCH. From 1e22d4594f14cb5cd39dde86df76999861493e08 Mon Sep 17 00:00:00 2001 From: Michael Ford Date: Sat, 20 Dec 2014 21:26:31 +0800 Subject: [PATCH 32/88] Add libbitcoinconsensus.pc to .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 7343e722d..9f1e52280 100644 --- a/.gitignore +++ b/.gitignore @@ -111,3 +111,5 @@ qa/pull-tester/test.*/* !src/leveldb*/Makefile /doc/doxygen/ + +libbitcoinconsensus.pc From 4bc95c43871645c1d69a0d719c13b38151a3a13f Mon Sep 17 00:00:00 2001 From: Jameson Lopp Date: Sun, 21 Dec 2014 09:10:43 -0500 Subject: [PATCH 33/88] remove max orphan blocks config parameter since it is no longer functional --- src/init.cpp | 1 - src/main.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 220d3b93a..22026c446 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -231,7 +231,6 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -datadir= " + _("Specify data directory") + "\n"; strUsage += " -dbcache= " + strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache) + "\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 += " -maxorphantx= " + strprintf(_("Keep at most unconnectable transactions in memory (default: %u)"), DEFAULT_MAX_ORPHAN_TRANSACTIONS) + "\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"; #ifndef WIN32 diff --git a/src/main.h b/src/main.h index 717cec769..662d5756f 100644 --- a/src/main.h +++ b/src/main.h @@ -64,8 +64,6 @@ static const unsigned int MAX_P2SH_SIGOPS = 15; static const unsigned int MAX_TX_SIGOPS = MAX_BLOCK_SIGOPS/5; /** Default for -maxorphantx, maximum number of orphan transactions kept in memory */ static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100; -/** Default for -maxorphanblocks, maximum number of orphan blocks kept in memory */ -static const unsigned int DEFAULT_MAX_ORPHAN_BLOCKS = 750; /** The maximum size of a blk?????.dat file (since 0.8) */ static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB /** The pre-allocation chunk size for blk?????.dat files (since 0.8) */ From 34970223472c9e83689a1c710eebc7c16f152b02 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 11 Dec 2014 13:35:14 +0100 Subject: [PATCH 34/88] Reject headers that build on an invalid parent --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index ad3f70eed..762a40403 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -449,6 +449,10 @@ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vectorIsValid(BLOCK_VALID_TREE)) { + // We consider the chain that this peer is on invalid. + return; + } if (pindex->nStatus & BLOCK_HAVE_DATA) { if (pindex->nChainTx) state->pindexLastCommonBlock = pindex; @@ -2563,6 +2567,8 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc if (mi == mapBlockIndex.end()) return state.DoS(10, error("%s : prev block not found", __func__), 0, "bad-prevblk"); pindexPrev = (*mi).second; + if (pindexPrev->nStatus & BLOCK_FAILED_MASK) + return state.DoS(100, error("%s : prev block invalid", __func__), REJECT_INVALID, "bad-prevblk"); } if (!ContextualCheckBlockHeader(block, state, pindexPrev)) From 2a3d988b802dcea4453241e37168d8511078940a Mon Sep 17 00:00:00 2001 From: "Eric R. Schulz" Date: Mon, 22 Dec 2014 21:04:53 -0500 Subject: [PATCH 35/88] bitcoin-tx: Fix JSON validation of prevtxs --- src/bitcoin-tx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 337cd44cd..56ca600ed 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -368,7 +368,7 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr) // Add previous txouts given in the RPC call: if (!registers.count("prevtxs")) throw runtime_error("prevtxs register variable must be set."); - UniValue prevtxsObj = registers["privatekeys"]; + UniValue prevtxsObj = registers["prevtxs"]; { for (unsigned int previdx = 0; previdx < prevtxsObj.count(); previdx++) { UniValue prevOut = prevtxsObj[previdx]; From a089c50981e822014ffc18e8a37b3518feb52206 Mon Sep 17 00:00:00 2001 From: "Eric R. Schulz" Date: Tue, 23 Dec 2014 02:59:00 +0000 Subject: [PATCH 36/88] bitcoin-tx: Refer to the JSON fields rather than the whole object --- src/bitcoin-tx.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 56ca600ed..05a85810e 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -379,13 +379,13 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr) if (!prevOut.checkObject(types)) throw runtime_error("prevtxs internal object typecheck fail"); - uint256 txid = ParseHashUV(prevOut, "txid"); + uint256 txid = ParseHashUV(prevOut["txid"], "txid"); int nOut = atoi(prevOut["vout"].getValStr()); if (nOut < 0) throw runtime_error("vout must be positive"); - vector pkData(ParseHexUV(prevOut, "scriptPubKey")); + vector pkData(ParseHexUV(prevOut["scriptPubKey"], "scriptPubKey")); CScript scriptPubKey(pkData.begin(), pkData.end()); { From c90770430d7c1eb7ece2d4ddb987b0f2210fd86f Mon Sep 17 00:00:00 2001 From: Adam Weiss Date: Thu, 18 Dec 2014 18:28:29 -0500 Subject: [PATCH 37/88] DOS: Respect max per-peer blocks in flight limit Don't allow immediate inv driven block downloads if a peer already has MAX_BLOCKS_IN_TRANSIT_PER_PEER active downloads. Prevents bogus inv spam from blowing up block transfer tracking data structures. --- src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 9c038f90f..accdfd10b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3574,7 +3574,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, // doing this will result in the received block being rejected as an orphan in case it is // not a direct successor. pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexBestHeader), inv.hash); - if (chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - Params().TargetSpacing() * 20) { + CNodeState *nodestate = State(pfrom->GetId()); + if (chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - Params().TargetSpacing() * 20 && + nodestate->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) { vToFetch.push_back(inv); // Mark block as in flight already, even though the actual "getdata" message only goes out // later (within the same cs_main lock, though). From 7c5dd603065ec8a568bedde4d7cf311a6dc9ff2e Mon Sep 17 00:00:00 2001 From: Everett Forth Date: Mon, 22 Dec 2014 23:41:14 -0800 Subject: [PATCH 38/88] Adding RPC tests for the following wallet related calls: getbalance, listsinceblock, listtransactions, listlockunspent, listaccounts listaddressgroupings --- src/test/rpc_wallet_tests.cpp | 37 ++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/test/rpc_wallet_tests.cpp b/src/test/rpc_wallet_tests.cpp index a83bd120c..57c49c2df 100644 --- a/src/test/rpc_wallet_tests.cpp +++ b/src/test/rpc_wallet_tests.cpp @@ -93,6 +93,13 @@ BOOST_AUTO_TEST_CASE(rpc_wallet) /* 1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4X (33 chars) is an illegal address (should be 34 chars) */ BOOST_CHECK_THROW(CallRPC("setaccount 1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4X nullaccount"), runtime_error); + + /********************************* + * getbalance + *********************************/ + BOOST_CHECK_NO_THROW(CallRPC("getbalance")); + BOOST_CHECK_NO_THROW(CallRPC("getbalance " + demoAddress.ToString())); + /********************************* * listunspent *********************************/ @@ -124,6 +131,35 @@ BOOST_AUTO_TEST_CASE(rpc_wallet) BOOST_CHECK_NO_THROW(CallRPC("listreceivedbyaccount 0 true")); BOOST_CHECK_THROW(CallRPC("listreceivedbyaccount 0 true extra"), runtime_error); + /********************************* + * listsinceblock + *********************************/ + BOOST_CHECK_NO_THROW(CallRPC("listsinceblock")); + + /********************************* + * listtransactions + *********************************/ + BOOST_CHECK_NO_THROW(CallRPC("listtransactions")); + BOOST_CHECK_NO_THROW(CallRPC("listtransactions " + demoAddress.ToString())); + BOOST_CHECK_NO_THROW(CallRPC("listtransactions " + demoAddress.ToString() + " 20")); + BOOST_CHECK_NO_THROW(CallRPC("listtransactions " + demoAddress.ToString() + " 20 0")); + BOOST_CHECK_THROW(CallRPC("listtransactions " + demoAddress.ToString() + " not_int"), runtime_error); + + /********************************* + * listlockunspent + *********************************/ + BOOST_CHECK_NO_THROW(CallRPC("listlockunspent")); + + /********************************* + * listaccounts + *********************************/ + BOOST_CHECK_NO_THROW(CallRPC("listaccounts")); + + /********************************* + * listaddressgroupings + *********************************/ + BOOST_CHECK_NO_THROW(CallRPC("listaddressgroupings")); + /********************************* * getrawchangeaddress *********************************/ @@ -179,5 +215,4 @@ BOOST_AUTO_TEST_CASE(rpc_wallet) BOOST_CHECK(CBitcoinAddress(arr[0].get_str()).Get() == demoAddress.Get()); } - BOOST_AUTO_TEST_SUITE_END() From a15dba5dff1229b67ff44bf16ff14063e885f376 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 23 Dec 2014 22:02:16 +0000 Subject: [PATCH 39/88] en: Avoid ambiguous language regarding when transactions confirm --- src/init.cpp | 2 +- src/rpcmining.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 13a7192a7..430f02930 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -286,7 +286,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup") + "\n"; strUsage += " -sendfreetransactions " + strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), 0) + "\n"; strUsage += " -spendzeroconfchange " + strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), 1) + "\n"; - strUsage += " -txconfirmtarget= " + strprintf(_("If paytxfee is not set, include enough fee so transactions are confirmed on average within n blocks (default: %u)"), 1) + "\n"; + strUsage += " -txconfirmtarget= " + strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), 1) + "\n"; strUsage += " -maxtxfee= " + strprintf(_("Maximum total fees to use in a single wallet transaction, setting too low may abort large transactions (default: %s)"), FormatMoney(maxTxFee)) + "\n"; strUsage += " -upgradewallet " + _("Upgrade wallet to latest format") + " " + _("on startup") + "\n"; strUsage += " -wallet= " + _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat") + "\n"; diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 44ebff9d3..17552bc38 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -674,7 +674,7 @@ Value estimatefee(const Array& params, bool fHelp) throw runtime_error( "estimatefee nblocks\n" "\nEstimates the approximate fee per kilobyte\n" - "needed for a transaction to get confirmed\n" + "needed for a transaction to begin confirmation\n" "within nblocks blocks.\n" "\nArguments:\n" "1. nblocks (numeric)\n" @@ -706,7 +706,7 @@ Value estimatepriority(const Array& params, bool fHelp) throw runtime_error( "estimatepriority nblocks\n" "\nEstimates the approximate priority\n" - "a zero-fee transaction needs to get confirmed\n" + "a zero-fee transaction needs to begin confirmation\n" "within nblocks blocks.\n" "\nArguments:\n" "1. nblocks (numeric)\n" From 566c6cb8a2a277d9c5e4897ad02c5bb15786523c Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 23 Dec 2014 19:42:40 -0500 Subject: [PATCH 40/88] gitian: attempt to fix tarball determinisim --- contrib/gitian-descriptors/gitian-linux.yml | 4 ++-- contrib/gitian-descriptors/gitian-osx.yml | 6 +++--- contrib/gitian-descriptors/gitian-win.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index bba2104ed..28bd9211a 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -79,7 +79,7 @@ script: | mkdir -p temp pushd temp tar xf ../$SOURCEDIST - find bitcoin-* | sort | tar --no-recursion -c -T - | gzip -9n > ../$SOURCEDIST + find bitcoin-* | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ../$SOURCEDIST popd ORIGPATH="$PATH" @@ -99,7 +99,7 @@ script: | find . -name "lib*.la" -delete find . -name "lib*.a" -delete rm -rf ${DISTNAME}/lib/pkgconfig - find . | sort | tar --no-recursion -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz + find . | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz cd ../../ done mkdir -p $OUTDIR/src diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index eb6df2096..4f05aad23 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -90,7 +90,7 @@ script: | mkdir -p temp pushd temp tar xf ../$SOURCEDIST - find bitcoin-* | sort | tar --no-recursion -c -T - | gzip -9n > ../$SOURCEDIST + find bitcoin-* | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ../$SOURCEDIST popd ORIGPATH="$PATH" @@ -116,7 +116,7 @@ script: | cp ${BASEPREFIX}/${i}/native/bin/${i}-pagestuff unsigned-app-${i}/pagestuff mv dist unsigned-app-${i} pushd unsigned-app-${i} - find . | sort | tar --no-recursion -czf ${OUTDIR}/${DISTNAME}-osx-unsigned.tar.gz -T - + find . | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-osx-unsigned.tar.gz popd make deploy @@ -126,7 +126,7 @@ script: | find . -name "lib*.la" -delete find . -name "lib*.a" -delete rm -rf ${DISTNAME}/lib/pkgconfig - find . | sort | tar --no-recursion -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz + find . | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz cd ../../ done mkdir -p $OUTDIR/src diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 97c823cde..4baa08c88 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -83,7 +83,7 @@ script: | mkdir -p temp pushd temp tar xf ../$SOURCEDIST - find bitcoin-* | sort | tar --no-recursion -c -T - | gzip -9n > ../$SOURCEDIST + find bitcoin-* | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ../$SOURCEDIST popd ORIGPATH="$PATH" From 2c14d1532fe66a243cdbfb7de48b298213305765 Mon Sep 17 00:00:00 2001 From: "Eric R. Schulz" Date: Wed, 24 Dec 2014 01:35:40 +0000 Subject: [PATCH 41/88] bitcoin-tx: Add test case for signing a tx --- src/Makefile.test.include | 3 ++- src/test/data/bitcoin-util-test.json | 10 ++++++++++ src/test/data/txcreatesign.hex | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/test/data/txcreatesign.hex diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 9e9f478d8..b9d15f4df 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -14,7 +14,8 @@ EXTRA_DIST += \ test/data/tt-locktime317000-out.hex \ test/data/tx394b54bb.hex \ test/data/txcreate1.hex \ - test/data/txcreate2.hex + test/data/txcreate2.hex \ + test/data/txcreatesign.hex JSON_TEST_FILES = \ test/data/script_valid.json \ diff --git a/src/test/data/bitcoin-util-test.json b/src/test/data/bitcoin-util-test.json index f8424b72a..6090421cb 100644 --- a/src/test/data/bitcoin-util-test.json +++ b/src/test/data/bitcoin-util-test.json @@ -46,5 +46,15 @@ { "exec": "./bitcoin-tx", "args": ["-create", "outscript=0:"], "output_cmp": "txcreate2.hex" + }, + { "exec": "./bitcoin-tx", + "args": + ["-create", + "in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0", + "set=privatekeys:[\"5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf\"]", + "set=prevtxs:[{\"txid\":\"4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485\",\"vout\":0,\"scriptPubKey\":\"4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485\"}]", + "sign=ALL", + "outaddr=0.001:193P6LtvS4nCnkDvM9uXn1gsSRqh4aDAz7"], + "output_cmp": "txcreatesign.hex" } ] diff --git a/src/test/data/txcreatesign.hex b/src/test/data/txcreatesign.hex new file mode 100644 index 000000000..56ce28a86 --- /dev/null +++ b/src/test/data/txcreatesign.hex @@ -0,0 +1 @@ +01000000018594c5bdcaec8f06b78b596f31cd292a294fd031e24eec716f43dac91ea7494d0000000000ffffffff01a0860100000000001976a9145834479edbbe0539b31ffd3a8f8ebadc2165ed0188ac00000000 From d78f0dafd520f481f909cca7e361a4e482cbea72 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Thu, 25 Dec 2014 03:12:17 -0500 Subject: [PATCH 42/88] Fix CScriptID(const CScript& in) in empty script case Previously an empty script wouldn't be hashed, and CScriptID would be assigned the incorrect value of 0 instead. This bug can be seen in the RPC decodescript command: $ btc decodescript "" { "asm" : "", "type" : "nonstandard", "p2sh" : "31h1vYVSYuKP6AhS86fbRdMw9XHieotbST" } Correct output: $ btc decodescript "" { "asm" : "", "type" : "nonstandard", "p2sh" : "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy" } --- src/script/standard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/standard.cpp b/src/script/standard.cpp index d0e225004..ce50e3aad 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -18,7 +18,7 @@ typedef vector valtype; unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY; -CScriptID::CScriptID(const CScript& in) : uint160(in.size() ? Hash160(in.begin(), in.end()) : 0) {} +CScriptID::CScriptID(const CScript& in) : uint160(Hash160(in.begin(), in.end())) {} const char* GetTxnOutputType(txnouttype t) { From d44c545673c0d75d1a2febe69685904787f8b21c Mon Sep 17 00:00:00 2001 From: azeteki Date: Sun, 21 Dec 2014 05:28:14 +0000 Subject: [PATCH 43/88] Add unconfirmedbalance field to getwalletinfo --- src/rpcwallet.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 63da8a20b..7c371ae2e 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1990,7 +1990,8 @@ Value getwalletinfo(const Array& params, bool fHelp) "\nResult:\n" "{\n" " \"walletversion\": xxxxx, (numeric) the wallet version\n" - " \"balance\": xxxxxxx, (numeric) the total bitcoin balance of the wallet\n" + " \"balance\": xxxxxxx, (numeric) the total confirmed bitcoin balance of the wallet\n" + " \"unconfirmedbalance\": xxxx, (numeric) the total unconfirmed bitcoin balance of the wallet\n" " \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n" " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n" " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n" @@ -2004,6 +2005,7 @@ Value getwalletinfo(const Array& params, bool fHelp) Object obj; obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); + obj.push_back(Pair("unconfirmedbalance", ValueFromAmount(pwalletMain->GetUnconfirmedBalance()))); obj.push_back(Pair("txcount", (int)pwalletMain->mapWallet.size())); obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime())); obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); From 8024d67dae9da4a5259cddc0fa713146272f7aad Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Wed, 24 Dec 2014 21:10:59 -0800 Subject: [PATCH 44/88] Add immature balances to getwalletinfo. --- src/rpcwallet.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 7c371ae2e..8366430f1 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1991,7 +1991,8 @@ Value getwalletinfo(const Array& params, bool fHelp) "{\n" " \"walletversion\": xxxxx, (numeric) the wallet version\n" " \"balance\": xxxxxxx, (numeric) the total confirmed bitcoin balance of the wallet\n" - " \"unconfirmedbalance\": xxxx, (numeric) the total unconfirmed bitcoin balance of the wallet\n" + " \"unconfirmed_balance\": xxx, (numeric) the total unconfirmed bitcoin balance of the wallet\n" + " \"immature_balance\": xxxxxx, (numeric) the total immature balance of the wallet\n" " \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n" " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n" " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n" @@ -2005,7 +2006,8 @@ Value getwalletinfo(const Array& params, bool fHelp) Object obj; obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance()))); - obj.push_back(Pair("unconfirmedbalance", ValueFromAmount(pwalletMain->GetUnconfirmedBalance()))); + obj.push_back(Pair("unconfirmed_balance", ValueFromAmount(pwalletMain->GetUnconfirmedBalance()))); + obj.push_back(Pair("immature_balance", ValueFromAmount(pwalletMain->GetImmatureBalance()))); obj.push_back(Pair("txcount", (int)pwalletMain->mapWallet.size())); obj.push_back(Pair("keypoololdest", pwalletMain->GetOldestKeyPoolTime())); obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); From 12d927a391b83041479f06e72051d37cc4e66655 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Thu, 25 Dec 2014 08:57:16 +0100 Subject: [PATCH 45/88] RPC test for immature balance --- qa/rpc-tests/wallet.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qa/rpc-tests/wallet.py b/qa/rpc-tests/wallet.py index d99540b58..f280ac380 100755 --- a/qa/rpc-tests/wallet.py +++ b/qa/rpc-tests/wallet.py @@ -41,6 +41,10 @@ class WalletTest (BitcoinTestFramework): self.nodes[0].setgenerate(True, 1) + walletinfo = self.nodes[0].getwalletinfo() + assert_equal(walletinfo['immature_balance'], 50) + assert_equal(walletinfo['balance'], 0) + self.sync_all() self.nodes[1].setgenerate(True, 101) self.sync_all() @@ -54,6 +58,9 @@ class WalletTest (BitcoinTestFramework): self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11) self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 10) + walletinfo = self.nodes[0].getwalletinfo() + assert_equal(walletinfo['immature_balance'], 0) + # Have node0 mine a block, thus he will collect his own fee. self.nodes[0].setgenerate(True, 1) self.sync_all() From a094b3d9732aaca362e883655319852e4ce9a174 Mon Sep 17 00:00:00 2001 From: Gregory Maxwell Date: Sat, 27 Dec 2014 01:38:47 -0800 Subject: [PATCH 46/88] Remove bitnodes.io from dnsseeds. I'm not comfortable with retaining this entry. --- src/chainparams.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 7562509bd..f4bc6e1d7 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -156,7 +156,6 @@ public: vSeeds.push_back(CDNSSeedData("bluematt.me", "dnsseed.bluematt.me")); vSeeds.push_back(CDNSSeedData("dashjr.org", "dnsseed.bitcoin.dashjr.org")); vSeeds.push_back(CDNSSeedData("bitcoinstats.com", "seed.bitcoinstats.com")); - vSeeds.push_back(CDNSSeedData("bitnodes.io", "seed.bitnodes.io")); vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org")); base58Prefixes[PUBKEY_ADDRESS] = list_of(0); From 1f670846f709a486ee224bb2582474da47c9c6b2 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Sat, 27 Dec 2014 12:28:34 +0100 Subject: [PATCH 47/88] [Docs] clean up assets-attributen.md - Make sure it represents the current state --- doc/assets-attribution.md | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/doc/assets-attribution.md b/doc/assets-attribution.md index 6c5f91a83..31fe4e5b7 100644 --- a/doc/assets-attribution.md +++ b/doc/assets-attribution.md @@ -1,14 +1,5 @@ The following is a list of assets used in the bitcoin source and their proper attribution. -[Wladimir van der Laan](https://github.com/laanwj) ------------------------ -#### Info -* License: MIT - -### Assets Used - src/qt/res/icons/watch*.png, src/qt/res/icons/tx_in.png, - src/qt/res/icons/tx_inout.png, - [Typicons/Stephen Hutchings](http://typicons.com) ----------------------- @@ -30,7 +21,7 @@ The following is a list of assets used in the bitcoin source and their proper at src/qt/res/icons/overview.png, src/qt/res/icons/quit.png, src/qt/res/icons/receive.png, src/qt/res/icons/remove.png, src/qt/res/icons/send.png, src/qt/res/icons/synced.png, - src/qt/res/icons/transaction*.png, src/qt/res/icons/tx_input.png, + src/qt/res/icons/transaction*.png, src/qt/res/icons/tx_output.png, Jonas Schnelli ----------------------- @@ -38,18 +29,19 @@ Jonas Schnelli ### Info * Designer: Jonas Schnelli * Bitcoin Icon: (based on the original bitcoin logo from Bitboy) -* Some icons are based on Stephan Hutchings Typicons +* Some icons are based on Stephan Hutchings Typicons (these are under CC BY-SA license) * License: MIT ### Assets Used src/qt/res/icons/about.png, src/qt/res/icons/about_qt.png, - src/qt/res/icons/clock*.png, src/qt/res/icons/connect[0-3].png, - src/qt/res/icons/eye_minus.png, src/qt/res/icons/verify.png, - src/qt/res/icons/eye_plus.png, src/qt/res/icons/tx_inout.png, - src/qt/res/icons/tx_output.png, src/qt/res/icons/bitcoin.icns, - src/qt/res/src/bitcoin.svg, src/qt/res/src/bitcoin.ico, - src/qt/res/src/bitcoin.png, src/qt/res/src/bitcoin_testnet.png, - docs/bitcoin_logo_doxygen.png, src/qt/res/src/tx*.svg, - src/qt/res/src/connect*.svg, src/qt/res/src/clock*.svg, - src/qt/res/src/mine.svg, src/qt/res/src/qt.svg, + src/qt/res/icons/bitcoin.icns, src/qt/res/icons/bitcoin.ico, + src/qt/res/icons/bitcoin.png, src/qt/res/icons/clock*.png, + src/qt/res/icons/connect[0-3].png, src/qt/res/icons/eye_minus.png, + src/qt/res/icons/eye_plus.png, src/qt/res/icons/verify.png, + src/qt/res/icons/tx_inout.png, src/qt/res/icons/tx_input.png, + src/qt/res/icons/unit_btc.png, src/qt/res/icons/unit_mbtc.png, + src/qt/res/icons/unit_ubtc.png, src/qt/res/src/verify.svg + src/qt/res/src/bitcoin.svg, src/qt/res/src/clock*.svg, + src/qt/res/src/connect*.svg, src/qt/res/src/mine.svg, + src/qt/res/src/qt.svg, src/qt/res/src/tx*.svg, src/qt/res/src/verify.svg, From de779b307b5b65ae6a632ee7a7110cc1da3fc410 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Sat, 27 Dec 2014 12:31:09 +0100 Subject: [PATCH 48/88] [Qt] new icon for the debug window --- src/qt/res/icons/debugwindow.png | Bin 1330 -> 15930 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/qt/res/icons/debugwindow.png b/src/qt/res/icons/debugwindow.png index 0a2ee5f1fb0ab4139c1635a45f69c240a4857690..576e57ab03521439359c8f539e4c274d42828f39 100644 GIT binary patch literal 15930 zcmeI3d0Z3M7RM(nvRFauilW9KEl`umLV&~&REQ6>0a-+NZVZzNjASDT5)n0sJ`oiw z0%B2XYu#$){ zTN2U}q*LgjYAr_Rv-nJu&E?Po1uPEVU%=svp>x?B9?W6GTmh5A5&8!TIRW&xiy?L; zERj|w7siB5Y)eP{7tBc2>or0c&dkhYW%5{RZ3@g02m~;j3v;F8= z1$h@I4AY@nT%*U;D!L^ulB~|q2QwI!MD17GeJM5ViB!5ab_7M(fM{S2iw$?@BtzSM zG#Ofjb!jpb#uS(mQ|WbtAE#SCO{!Y2)}^X@NZCH!V`8EvQfYhcZr7_+cAHwKm&_#) zv?1-*Qx`W+gTXPFPMx7eG09xwR=m2qdp$1iC{CwHmYE*cjv4SC+$=LTH)|`{DkLKA zRT!$p5WQL(r&cS(wl16U4k0}>lMMe~>N|?v5ef@K^q81vMt>%U%j5>e zakxUBzmVhq8Jin;Xg$m4=B0A<%0#O9G9dgKp90kuFJ87h>k zwMs-U#+67425VF)BDiA^P`0;}FjTEjYl&rHVx9=@ZW!>gwwW+OrPCuS6pIKG69X(9 zmkHT?G%$dV@R(cyhB5v57?+7)fdNcDCg92iJhnfdEw@6HNCs_LdW%03YTOop4jxsT7*$tRX1a}(kSXR4dn;ZWB7SI+SaPK)sW-6xo z(1x;wvZ{IxqEpNDnTQq}pF;Em=|;DO?CjGuwg|SI`wF~s6>OuOi}S8s-!G=fa-0c? zMj#f2SPQ@r!S9WAWVY!OECp3$SoQuvY|BOb@DW#=FF4=TH<82_obT$};W|}?>&4u* zbX|r4FUzTGI~8Jy2LwzUz~}S$BDm{tSC1*U0aGM|;l%dUS(=i=4Qg}hI@7IZVvnA{ zOq-{zT)>aHwVJk3;!%NkN`c!SQ#u#AeJA|IM#nAv#eu7Qk%j>iU<@?xIh}DHie56 z5h$Q=fiy^M3KuCNP(a}VX^`3!E>c9GfWigRAhju6q=-NPg$txXYE!sK5rF~<7f6HD zrf`uW0tFNT|p65c2%wtjT_+dkp(e)LQ$rTcjhs#eA_m}}coydJK zHQ4Zc&e9iSZf-GO-Bgrt%tzw7n{g(DdA0A=07*c^iG(jz*(2nG)~>s=fcJaLv5j|r zePi-$iMso^b>UYF)bhKsZ386zzNso2Xy-y7ZTte7VCUSO@mo=TP1)qFG1sO)?)BKI zz;3>AxG8?K!-MMmBVU#>Y152}=IQ1r^WS%cyf}1b_QNadjyV}<29MG!>%DpZb*y#} z(;{gXcdi~HS);>GI%w+ZzAKz9P@-S4w);97`tR`bnEBb%vfOg#rvaMShzD7RaNU|+ zP>uZx*M)5C>b=v`jfGJwuC~}cwy(Bp*(n_~AcR%}^%e_WDtE8Txlz6D)W6_|V{G~Ov zGP;M^z?L)mOVU$Im); zONp-YE%x-|j+lQGYRx}%a5wMd+wE_-Py5Pu97}A@iZLEZUVR+8tF0;-xQb?Wcsggr z&6nRo(YX^ZarbQ7piY{cJ5q8lc&qC3JASt=v!yq zJJsy+s*il+=Hi8Yp-Y=+Fj68~3wp!GN5wf`RMvPrWzya^2FoRM@V(=Z1)+{8uutCnUtkvDNpQI z3-6tOV=u~d8}7(5i%X7w)cOxqYejt>Z12AB^(WE1c%yyvfXjy#5! zc3_*=#x?|){O8x`mZALZfsm8g*ZL20H7TD$U{0yHnwXFs-0w zsrEK~heOMPUO7%i`_lF7@?7`8=7!Tp=G54Yjji3^t66>JKV=o?hU-O-?1)dNE8s?5Om!&+p@$lCQQyUsurX(k8mrwhY~y5%1Nv zir*BQyxFrN13n6Q=L^uFysTw(Q-(Q)=2#_bDxU>u@{*;W?5q>+8oZ~##XN&nxagnP z`FSHVwx>93#fBKFR^@D-Rdx4<(_&V#d;sQWd_K4-XTA8FnqfIToO17XzwqQDd+7Yi XeR+0EW_(JV4nJ zcwPcw#uctzKY)UgC9V-A!TD(=<%vb94CUqJdYO6I#mR{Use1WE>9gP2NC6F6@9E+g zQZeW4-2L6Mp(4la(-#XmT{$#kdTO$kqmIu;A%i6X*BTBz%1T#0)b=C)#tm1GnO<8q zZs@*f#u=gF7N#4rVPmJ~iC?Qv?CR>O&`JBl`0lc`b^5ctGe7@5P*VPG=bX=#<`aa+4<^ zt)DTU(cPMJLc4#X_}#yo^{n1MQM+*FTEprUKLll1*Il#ZRgYmXu9mdmf7AcY+VFSd z=h8f9&b=%%ZcaYnn)c|>TI|Gr+ys(TO1 zp0=+0?CdLwWSvd`?ek}l-y+|aaiFk#|FvzCS4cj%x}eU*QqeNsmU+fa#|LI-Q+6@$ zVXq0AKYONYf@Fo*j{OHK_cM3D`{z6RfnfRTY!mH&t_gSV=Cd7<<4r4*s1UY@tT@FK z`Yt|S*!+>u2cPC`^O;v`{oB8?c$3%E#X+;4)VV9MSX^50c4eGg0nZdG^W{==E~$LC z7E(Nrl(^fs{60sAdDbhLTro5KvwuUBSZ0W9`>ml6CgxQfI_vjJ7mkAR#NG1DNvR7> z!k6xx-xbH{-N)iVALQ4U;Ceo z6&LQ-XNuZpv|lJblh=NBe!4{UwBtK>-n6`OM(x1#jP(ch-C&a|`@a5mnaC!A5dJ4V zF7b;xj0KOj->7B&&NRJISW&hsGlns2k=ebDdzK|mrRu)}B9=dze}|#Zwf2|dk4OjG z4WX+VyCU)e-fkBOt9kJtF<|f6pN6YedL1cfeKlErUu%uJKXbNsctbcxMZ&}xxvON> zxzvC9uk>j5lmBZ3eO6rK+&1HH`SXP`(WU3qVy~-zQTwoeML17*!}A9Bm1TRPT(a43 zhwzu?1+RS@&!D$G?xFS)bH-T-Y5C0hZ$5qDZ(M%&uit|SZl`bD;|TgFZKTE+@+a0n z3`82S0ZB2QSO(Gks?K5#NBI+0Fs=CE$P>sQYCmBi=YmJ<#wtJ+d=gy@T6OL`jzD$J z&p@h^pG5*m_Gh6D*(-kRHJJXMx#QoA>yi#%T8K_W=j5MGUTYJfxJn;bzA<>Z`njxg HN@xNAxD_Nz From c444c620c62c51d65f7de0b2a3c351e61ab1e388 Mon Sep 17 00:00:00 2001 From: jtimon Date: Sun, 19 Oct 2014 02:57:02 +0200 Subject: [PATCH 49/88] Decouple CCoins from CTxInUndo --- src/coins.cpp | 22 ++++------------------ src/coins.h | 6 +----- src/main.cpp | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/coins.cpp b/src/coins.cpp index bc430c9c7..f4599ff39 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -31,29 +31,15 @@ void CCoins::CalcMaskSize(unsigned int &nBytes, unsigned int &nNonzeroBytes) con nBytes += nLastUsedByte; } -bool CCoins::Spend(const COutPoint &out, CTxInUndo &undo) { - if (out.n >= vout.size()) +bool CCoins::Spend(uint32_t nPos) +{ + if (nPos >= vout.size() || vout[nPos].IsNull()) return false; - if (vout[out.n].IsNull()) - return false; - undo = CTxInUndo(vout[out.n]); - vout[out.n].SetNull(); + vout[nPos].SetNull(); Cleanup(); - if (vout.size() == 0) { - undo.nHeight = nHeight; - undo.fCoinBase = fCoinBase; - undo.nVersion = this->nVersion; - } return true; } -bool CCoins::Spend(int nPos) { - CTxInUndo undo; - COutPoint out(0, nPos); - return Spend(out, undo); -} - - bool CCoinsView::GetCoins(const uint256 &txid, CCoins &coins) const { return false; } bool CCoinsView::HaveCoins(const uint256 &txid) const { return false; } uint256 CCoinsView::GetBestBlock() const { return uint256(0); } diff --git a/src/coins.h b/src/coins.h index 9b73ae3a8..2be52ad17 100644 --- a/src/coins.h +++ b/src/coins.h @@ -9,7 +9,6 @@ #include "compressor.h" #include "serialize.h" #include "uint256.h" -#include "undo.h" #include #include @@ -237,11 +236,8 @@ public: Cleanup(); } - //! mark an outpoint spent, and construct undo information - bool Spend(const COutPoint &out, CTxInUndo &undo); - //! mark a vout spent - bool Spend(int nPos); + bool Spend(uint32_t nPos); //! check whether a particular output is still available bool IsAvailable(unsigned int nPos) const { diff --git a/src/main.cpp b/src/main.cpp index 2410230ef..3f775e3d3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1383,9 +1383,20 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach if (!tx.IsCoinBase()) { txundo.vprevout.reserve(tx.vin.size()); BOOST_FOREACH(const CTxIn &txin, tx.vin) { - txundo.vprevout.push_back(CTxInUndo()); - bool ret = inputs.ModifyCoins(txin.prevout.hash)->Spend(txin.prevout, txundo.vprevout.back()); - assert(ret); + CCoinsModifier coins = inputs.ModifyCoins(txin.prevout.hash); + unsigned nPos = txin.prevout.n; + + if (nPos >= coins->vout.size() || coins->vout[nPos].IsNull()) + assert(false); + // mark an outpoint spent, and construct undo information + txundo.vprevout.push_back(CTxInUndo(coins->vout[nPos])); + coins->Spend(nPos); + if (coins->vout.size() == 0) { + CTxInUndo& undo = txundo.vprevout.back(); + undo.nHeight = coins->nHeight; + undo.fCoinBase = coins->fCoinBase; + undo.nVersion = coins->nVersion; + } } } From d7621ccf9d064db19de742ed1a0ac59fffa06c0d Mon Sep 17 00:00:00 2001 From: jtimon Date: Mon, 27 Oct 2014 16:07:50 +0100 Subject: [PATCH 50/88] Decouple miner.o and txmempool.o from CTxUndo --- src/main.cpp | 6 ++++++ src/main.h | 2 +- src/miner.cpp | 3 +-- src/txmempool.cpp | 7 +++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3f775e3d3..bcd3a5ff0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1404,6 +1404,12 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach inputs.ModifyCoins(tx.GetHash())->FromTx(tx, nHeight); } +void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight) +{ + CTxUndo txundo; + UpdateCoins(tx, state, inputs, txundo, nHeight); +} + bool CScriptCheck::operator()() { const CScript &scriptSig = ptxTo->vin[nIn].scriptSig; if (!VerifyScript(scriptSig, scriptPubKey, nFlags, CachingSignatureChecker(*ptxTo, nIn, cacheStore), &error)) { diff --git a/src/main.h b/src/main.h index 662d5756f..e38b413be 100644 --- a/src/main.h +++ b/src/main.h @@ -290,7 +290,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi unsigned int flags, bool cacheStore, std::vector *pvChecks = NULL); /** Apply the effects of this transaction on the UTXO set represented by view */ -void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight); +void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight); /** Context-independent validity checks */ bool CheckTransaction(const CTransaction& tx, CValidationState& state); diff --git a/src/miner.cpp b/src/miner.cpp index 2133b13e6..0ac974d6e 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -279,8 +279,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) if (!CheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true)) continue; - CTxUndo txundo; - UpdateCoins(tx, state, view, txundo, nHeight); + UpdateCoins(tx, state, view, nHeight); // Added pblock->vtx.push_back(tx); diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 3071ab025..01bf1ec08 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -585,9 +585,9 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const if (fDependsWait) waitingOnDependants.push_back(&it->second); else { - CValidationState state; CTxUndo undo; + CValidationState state; assert(CheckInputs(tx, state, mempoolDuplicate, false, 0, false, NULL)); - UpdateCoins(tx, state, mempoolDuplicate, undo, 1000000); + UpdateCoins(tx, state, mempoolDuplicate, 1000000); } } unsigned int stepsSinceLastRemove = 0; @@ -601,8 +601,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const assert(stepsSinceLastRemove < waitingOnDependants.size()); } else { assert(CheckInputs(entry->GetTx(), state, mempoolDuplicate, false, 0, false, NULL)); - CTxUndo undo; - UpdateCoins(entry->GetTx(), state, mempoolDuplicate, undo, 1000000); + UpdateCoins(entry->GetTx(), state, mempoolDuplicate, 1000000); stepsSinceLastRemove = 0; } } From e035c6a7371027fe33c460ee2d0946a7f1e4e592 Mon Sep 17 00:00:00 2001 From: jtimon Date: Mon, 27 Oct 2014 14:35:52 +0100 Subject: [PATCH 51/88] Decouple CBlockUndo from CDiskBlockPos --- src/main.cpp | 31 ++++++++++++++++--------------- src/main.h | 3 --- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index bcd3a5ff0..ec24e55ce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1520,7 +1520,8 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi return true; } - +bool UndoWriteToDisk(const CBlockUndo& blockundo, CDiskBlockPos& pos, const uint256& hashBlock); +bool UndoReadFromDisk(CBlockUndo& blockundo, const CDiskBlockPos& pos, const uint256& hashBlock); bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean) { @@ -1535,7 +1536,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex CDiskBlockPos pos = pindex->GetUndoPos(); if (pos.IsNull()) return error("DisconnectBlock() : no undo data available"); - if (!blockUndo.ReadFromDisk(pos, pindex->pprev->GetBlockHash())) + if (!UndoReadFromDisk(blockUndo, pos, pindex->pprev->GetBlockHash())) return error("DisconnectBlock() : failure reading undo data"); if (blockUndo.vtxundo.size() + 1 != block.vtx.size()) @@ -1777,7 +1778,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin CDiskBlockPos pos; if (!FindUndoPos(state, pindex->nFile, pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40)) return error("ConnectBlock() : FindUndoPos failed"); - if (!blockundo.WriteToDisk(pos, pindex->pprev->GetBlockHash())) + if (!UndoWriteToDisk(blockundo, pos, pindex->pprev->GetBlockHash())) return state.Abort("Failed to write undo data"); // update nUndoPos in block index @@ -2943,7 +2944,7 @@ bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth CBlockUndo undo; CDiskBlockPos pos = pindex->GetUndoPos(); if (!pos.IsNull()) { - if (!undo.ReadFromDisk(pos, pindex->pprev->GetBlockHash())) + if (!UndoReadFromDisk(undo, pos, pindex->pprev->GetBlockHash())) return error("VerifyDB() : *** found bad undo data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString()); } } @@ -4509,44 +4510,44 @@ bool SendMessages(CNode* pto, bool fSendTrickle) } -bool CBlockUndo::WriteToDisk(CDiskBlockPos &pos, const uint256 &hashBlock) +bool UndoWriteToDisk(const CBlockUndo& blockundo, CDiskBlockPos& pos, const uint256& hashBlock) { // Open history file to append CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); if (fileout.IsNull()) - return error("CBlockUndo::WriteToDisk : OpenUndoFile failed"); + return error("%s : OpenUndoFile failed", __func__); // Write index header - unsigned int nSize = fileout.GetSerializeSize(*this); + unsigned int nSize = fileout.GetSerializeSize(blockundo); fileout << FLATDATA(Params().MessageStart()) << nSize; // Write undo data long fileOutPos = ftell(fileout.Get()); if (fileOutPos < 0) - return error("CBlockUndo::WriteToDisk : ftell failed"); + return error("%s : ftell failed", __func__); pos.nPos = (unsigned int)fileOutPos; - fileout << *this; + fileout << blockundo; // calculate & write checksum CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); hasher << hashBlock; - hasher << *this; + hasher << blockundo; fileout << hasher.GetHash(); return true; } -bool CBlockUndo::ReadFromDisk(const CDiskBlockPos &pos, const uint256 &hashBlock) +bool UndoReadFromDisk(CBlockUndo& blockundo, const CDiskBlockPos& pos, const uint256& hashBlock) { // Open history file to read CAutoFile filein(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); if (filein.IsNull()) - return error("CBlockUndo::ReadFromDisk : OpenBlockFile failed"); + return error("%s : OpenBlockFile failed", __func__); // Read block uint256 hashChecksum; try { - filein >> *this; + filein >> blockundo; filein >> hashChecksum; } catch (const std::exception& e) { @@ -4556,9 +4557,9 @@ bool CBlockUndo::ReadFromDisk(const CDiskBlockPos &pos, const uint256 &hashBlock // Verify checksum CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); hasher << hashBlock; - hasher << *this; + hasher << blockundo; if (hashChecksum != hasher.GetHash()) - return error("CBlockUndo::ReadFromDisk : Checksum mismatch"); + return error("%s : Checksum mismatch", __func__); return true; } diff --git a/src/main.h b/src/main.h index e38b413be..7d6c293a3 100644 --- a/src/main.h +++ b/src/main.h @@ -314,9 +314,6 @@ public: inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { READWRITE(vtxundo); } - - bool WriteToDisk(CDiskBlockPos &pos, const uint256 &hashBlock); - bool ReadFromDisk(const CDiskBlockPos &pos, const uint256 &hashBlock); }; From 937ba572d0758891f43c658d7d98d7bd747c3ce4 Mon Sep 17 00:00:00 2001 From: jtimon Date: Mon, 27 Oct 2014 14:42:49 +0100 Subject: [PATCH 52/88] MOVEONLY: CBlockUndo from main.h to undo.h --- src/main.cpp | 1 + src/main.h | 16 ---------------- src/undo.h | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ec24e55ce..24ed487af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,6 +17,7 @@ #include "txdb.h" #include "txmempool.h" #include "ui_interface.h" +#include "undo.h" #include "util.h" #include "utilmoneystr.h" diff --git a/src/main.h b/src/main.h index 7d6c293a3..9049f5bb7 100644 --- a/src/main.h +++ b/src/main.h @@ -25,7 +25,6 @@ #include "tinyformat.h" #include "txmempool.h" #include "uint256.h" -#include "undo.h" #include #include @@ -302,21 +301,6 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason); bool IsFinalTx(const CTransaction &tx, int nBlockHeight = 0, int64_t nBlockTime = 0); -/** Undo information for a CBlock */ -class CBlockUndo -{ -public: - std::vector vtxundo; // for all but the coinbase - - ADD_SERIALIZE_METHODS; - - template - inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { - READWRITE(vtxundo); - } -}; - - /** * Closure representing one script verification * Note that this stores references to the spending transaction diff --git a/src/undo.h b/src/undo.h index e6d8fd586..1c4ed95bf 100644 --- a/src/undo.h +++ b/src/undo.h @@ -68,4 +68,18 @@ public: } }; +/** Undo information for a CBlock */ +class CBlockUndo +{ +public: + std::vector vtxundo; // for all but the coinbase + + ADD_SERIALIZE_METHODS; + + template + inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { + READWRITE(vtxundo); + } +}; + #endif // BITCOIN_UNDO_H From 87fb31086d70e4902170976ce261a01c8c380c00 Mon Sep 17 00:00:00 2001 From: jtimon Date: Wed, 3 Dec 2014 00:39:03 +0100 Subject: [PATCH 53/88] Move UndoWriteToDisk() and UndoReadFromDisk() to anon namespace --- src/main.cpp | 114 +++++++++++++++++++++++++-------------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 24ed487af..f6033566e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1521,8 +1521,63 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi return true; } -bool UndoWriteToDisk(const CBlockUndo& blockundo, CDiskBlockPos& pos, const uint256& hashBlock); -bool UndoReadFromDisk(CBlockUndo& blockundo, const CDiskBlockPos& pos, const uint256& hashBlock); +namespace { + +bool UndoWriteToDisk(const CBlockUndo& blockundo, CDiskBlockPos& pos, const uint256& hashBlock) +{ + // Open history file to append + CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); + if (fileout.IsNull()) + return error("%s : OpenUndoFile failed", __func__); + + // Write index header + unsigned int nSize = fileout.GetSerializeSize(blockundo); + fileout << FLATDATA(Params().MessageStart()) << nSize; + + // Write undo data + long fileOutPos = ftell(fileout.Get()); + if (fileOutPos < 0) + return error("%s : ftell failed", __func__); + pos.nPos = (unsigned int)fileOutPos; + fileout << blockundo; + + // calculate & write checksum + CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); + hasher << hashBlock; + hasher << blockundo; + fileout << hasher.GetHash(); + + return true; +} + +bool UndoReadFromDisk(CBlockUndo& blockundo, const CDiskBlockPos& pos, const uint256& hashBlock) +{ + // Open history file to read + CAutoFile filein(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); + if (filein.IsNull()) + return error("%s : OpenBlockFile failed", __func__); + + // Read block + uint256 hashChecksum; + try { + filein >> blockundo; + filein >> hashChecksum; + } + catch (const std::exception& e) { + return error("%s : Deserialize or I/O error - %s", __func__, e.what()); + } + + // Verify checksum + CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); + hasher << hashBlock; + hasher << blockundo; + if (hashChecksum != hasher.GetHash()) + return error("%s : Checksum mismatch", __func__); + + return true; +} + +} // anon namespace bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool* pfClean) { @@ -4510,61 +4565,6 @@ bool SendMessages(CNode* pto, bool fSendTrickle) return true; } - -bool UndoWriteToDisk(const CBlockUndo& blockundo, CDiskBlockPos& pos, const uint256& hashBlock) -{ - // Open history file to append - CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); - if (fileout.IsNull()) - return error("%s : OpenUndoFile failed", __func__); - - // Write index header - unsigned int nSize = fileout.GetSerializeSize(blockundo); - fileout << FLATDATA(Params().MessageStart()) << nSize; - - // Write undo data - long fileOutPos = ftell(fileout.Get()); - if (fileOutPos < 0) - return error("%s : ftell failed", __func__); - pos.nPos = (unsigned int)fileOutPos; - fileout << blockundo; - - // calculate & write checksum - CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); - hasher << hashBlock; - hasher << blockundo; - fileout << hasher.GetHash(); - - return true; -} - -bool UndoReadFromDisk(CBlockUndo& blockundo, const CDiskBlockPos& pos, const uint256& hashBlock) -{ - // Open history file to read - CAutoFile filein(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); - if (filein.IsNull()) - return error("%s : OpenBlockFile failed", __func__); - - // Read block - uint256 hashChecksum; - try { - filein >> blockundo; - filein >> hashChecksum; - } - catch (const std::exception& e) { - return error("%s : Deserialize or I/O error - %s", __func__, e.what()); - } - - // Verify checksum - CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION); - hasher << hashBlock; - hasher << blockundo; - if (hashChecksum != hasher.GetHash()) - return error("%s : Checksum mismatch", __func__); - - return true; -} - std::string CBlockFileInfo::ToString() const { return strprintf("CBlockFileInfo(blocks=%u, size=%u, heights=%u...%u, time=%s...%s)", nBlocks, nSize, nHeightFirst, nHeightLast, DateTimeStrFormat("%Y-%m-%d", nTimeFirst), DateTimeStrFormat("%Y-%m-%d", nTimeLast)); } From 9b7d3fb16574f1604c0837f9ac0f402672add87f Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 6 Nov 2014 19:55:52 +0000 Subject: [PATCH 54/88] Adopt style colour for button icons --- src/Makefile.qt.include | 2 + src/qt/addressbookpage.cpp | 6 +++ src/qt/bitcoingui.cpp | 52 +++++++++--------- src/qt/coincontroldialog.cpp | 5 +- src/qt/intro.cpp | 3 +- src/qt/networkstyle.cpp | 1 + src/qt/overviewpage.cpp | 4 +- src/qt/receivecoinsdialog.cpp | 6 +++ src/qt/rpcconsole.cpp | 6 ++- src/qt/scicon.cpp | 84 ++++++++++++++++++++++++++++++ src/qt/scicon.h | 24 +++++++++ src/qt/sendcoinsdialog.cpp | 5 ++ src/qt/sendcoinsentry.cpp | 7 +++ src/qt/signverifymessagedialog.cpp | 10 ++++ src/qt/transactiontablemodel.cpp | 8 ++- src/qt/transactiontablemodel.h | 4 +- src/qt/transactionview.cpp | 5 +- src/qt/walletview.cpp | 3 +- 18 files changed, 198 insertions(+), 37 deletions(-) create mode 100644 src/qt/scicon.cpp create mode 100644 src/qt/scicon.h diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 25d76c146..8b782b2ad 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -191,6 +191,7 @@ BITCOIN_QT_H = \ qt/receiverequestdialog.h \ qt/recentrequeststablemodel.h \ qt/rpcconsole.h \ + qt/scicon.h \ qt/sendcoinsdialog.h \ qt/sendcoinsentry.h \ qt/signverifymessagedialog.h \ @@ -277,6 +278,7 @@ BITCOIN_QT_CPP = \ qt/qvalidatedlineedit.cpp \ qt/qvaluecombobox.cpp \ qt/rpcconsole.cpp \ + qt/scicon.cpp \ qt/splashscreen.cpp \ qt/trafficgraphwidget.cpp \ qt/utilitydialog.cpp \ diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index fd3c1f2c0..5485d89f3 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -14,6 +14,7 @@ #include "csvmodelwriter.h" #include "editaddressdialog.h" #include "guiutil.h" +#include "scicon.h" #include #include @@ -34,6 +35,11 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) : ui->copyAddress->setIcon(QIcon()); ui->deleteAddress->setIcon(QIcon()); ui->exportButton->setIcon(QIcon()); +#else + ui->newAddress->setIcon(SingleColorIcon(":/icons/add")); + ui->copyAddress->setIcon(SingleColorIcon(":/icons/editcopy")); + ui->deleteAddress->setIcon(SingleColorIcon(":/icons/remove")); + ui->exportButton->setIcon(SingleColorIcon(":/icons/export")); #endif switch(mode) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 4eef18585..3b8fd985a 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -14,6 +14,7 @@ #include "optionsdialog.h" #include "optionsmodel.h" #include "rpcconsole.h" +#include "scicon.h" #include "utilitydialog.h" #ifdef ENABLE_WALLET @@ -36,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -242,28 +242,28 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle) { QActionGroup *tabGroup = new QActionGroup(this); - overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this); + overviewAction = new QAction(SingleColorIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setStatusTip(tr("Show general overview of wallet")); overviewAction->setToolTip(overviewAction->statusTip()); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); - sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send"), this); + sendCoinsAction = new QAction(SingleColorIcon(":/icons/send"), tr("&Send"), this); sendCoinsAction->setStatusTip(tr("Send coins to a Bitcoin address")); sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); - receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive"), this); + receiveCoinsAction = new QAction(SingleColorIcon(":/icons/receiving_addresses"), tr("&Receive"), this); receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and bitcoin: URIs)")); receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(receiveCoinsAction); - historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this); + historyAction = new QAction(SingleColorIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setStatusTip(tr("Browse transaction history")); historyAction->setToolTip(historyAction->statusTip()); historyAction->setCheckable(true); @@ -283,46 +283,46 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle) connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); #endif // ENABLE_WALLET - quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); + quitAction = new QAction(TextColorIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setStatusTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); - aboutAction = new QAction(QIcon(":/icons/about"), tr("&About Bitcoin Core"), this); + aboutAction = new QAction(TextColorIcon(":/icons/about"), tr("&About Bitcoin Core"), this); aboutAction->setStatusTip(tr("Show information about Bitcoin Core")); aboutAction->setMenuRole(QAction::AboutRole); - aboutQtAction = new QAction(QIcon(":/icons/about_qt"), tr("About &Qt"), this); + aboutQtAction = new QAction(TextColorIcon(":/icons/about_qt"), tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); - optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); + optionsAction = new QAction(TextColorIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setStatusTip(tr("Modify configuration options for Bitcoin Core")); optionsAction->setMenuRole(QAction::PreferencesRole); - toggleHideAction = new QAction(QIcon(":/icons/about"), tr("&Show / Hide"), this); + toggleHideAction = new QAction(TextColorIcon(":/icons/about"), tr("&Show / Hide"), this); toggleHideAction->setStatusTip(tr("Show or hide the main Window")); - encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); + encryptWalletAction = new QAction(TextColorIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet")); encryptWalletAction->setCheckable(true); - backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); + backupWalletAction = new QAction(TextColorIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); backupWalletAction->setStatusTip(tr("Backup wallet to another location")); - changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this); + changePassphraseAction = new QAction(TextColorIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); - signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); + signMessageAction = new QAction(TextColorIcon(":/icons/edit"), tr("Sign &message..."), this); signMessageAction->setStatusTip(tr("Sign messages with your Bitcoin addresses to prove you own them")); - verifyMessageAction = new QAction(QIcon(":/icons/verify"), tr("&Verify message..."), this); + verifyMessageAction = new QAction(TextColorIcon(":/icons/verify"), tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Bitcoin addresses")); - openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this); + openRPCConsoleAction = new QAction(TextColorIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console")); - usedSendingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Sending addresses..."), this); + usedSendingAddressesAction = new QAction(TextColorIcon(":/icons/address-book"), tr("&Sending addresses..."), this); usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels")); - usedReceivingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Receiving addresses..."), this); + usedReceivingAddressesAction = new QAction(TextColorIcon(":/icons/address-book"), tr("&Receiving addresses..."), this); usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); - openAction = new QAction(QIcon(":/icons/open"), tr("Open &URI..."), this); + openAction = new QAction(TextColorIcon(":/icons/open"), tr("Open &URI..."), this); openAction->setStatusTip(tr("Open a bitcoin: URI or payment request")); - showHelpMessageAction = new QAction(QIcon(":/icons/info"), tr("&Command-line options"), this); + showHelpMessageAction = new QAction(TextColorIcon(":/icons/info"), tr("&Command-line options"), this); showHelpMessageAction->setStatusTip(tr("Show the Bitcoin Core help message to get a list with possible Bitcoin command-line options")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); @@ -629,7 +629,7 @@ void BitcoinGUI::setNumConnections(int count) case 7: case 8: case 9: icon = ":/icons/connect_3"; break; default: icon = ":/icons/connect_4"; break; } - labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelConnectionsIcon->setPixmap(SingleColorIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Bitcoin network", "", count)); } @@ -671,7 +671,7 @@ void BitcoinGUI::setNumBlocks(int count) if(secs < 90*60) { tooltip = tr("Up to date") + QString(".
") + tooltip; - labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); + labelBlocksIcon->setPixmap(SingleColorIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); #ifdef ENABLE_WALLET if(walletFrame) @@ -717,7 +717,7 @@ void BitcoinGUI::setNumBlocks(int count) tooltip = tr("Catching up...") + QString("
") + tooltip; if(count != prevBlocks) { - labelBlocksIcon->setPixmap(QIcon(QString( + labelBlocksIcon->setPixmap(SingleColorIcon(QString( ":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0'))) .pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES; @@ -911,7 +911,7 @@ void BitcoinGUI::setEncryptionStatus(int status) break; case WalletModel::Unlocked: labelEncryptionIcon->show(); - labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelEncryptionIcon->setPixmap(SingleColorIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelEncryptionIcon->setToolTip(tr("Wallet is encrypted and currently unlocked")); encryptWalletAction->setChecked(true); changePassphraseAction->setEnabled(true); @@ -919,7 +919,7 @@ void BitcoinGUI::setEncryptionStatus(int status) break; case WalletModel::Locked: labelEncryptionIcon->show(); - labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); + labelEncryptionIcon->setPixmap(SingleColorIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelEncryptionIcon->setToolTip(tr("Wallet is encrypted and currently locked")); encryptWalletAction->setChecked(true); changePassphraseAction->setEnabled(true); @@ -1066,7 +1066,7 @@ void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *optionsModel) /** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */ void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits) { - setPixmap(QIcon(":/icons/unit_" + BitcoinUnits::id(newUnits)).pixmap(31,STATUSBAR_ICONSIZE)); + setPixmap(SingleColorIcon(":/icons/unit_" + BitcoinUnits::id(newUnits)).pixmap(31,STATUSBAR_ICONSIZE)); } /** Shows context menu with Display Unit options by the mouse coordinates */ diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index e650e0ffa..60e7d62a7 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -10,6 +10,7 @@ #include "guiutil.h" #include "init.h" #include "optionsmodel.h" +#include "scicon.h" #include "walletmodel.h" #include "coincontrol.h" @@ -274,7 +275,7 @@ void CoinControlDialog::lockCoin() COutPoint outpt(uint256(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt()); model->lockCoin(outpt); contextMenuItem->setDisabled(true); - contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed")); + contextMenuItem->setIcon(COLUMN_CHECKBOX, SingleColorIcon(":/icons/lock_closed")); updateLabelLocked(); } @@ -776,7 +777,7 @@ void CoinControlDialog::updateView() COutPoint outpt(txhash, out.i); coinControl->UnSelect(outpt); // just to be sure itemOutput->setDisabled(true); - itemOutput->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed")); + itemOutput->setIcon(COLUMN_CHECKBOX, SingleColorIcon(":/icons/lock_closed")); } // set checkbox diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index fb7ed1559..9f72602b4 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -6,6 +6,7 @@ #include "ui_intro.h" #include "guiutil.h" +#include "scicon.h" #include "util.h" @@ -167,7 +168,7 @@ void Intro::pickDataDirectory() /* If current default data directory does not exist, let the user choose one */ Intro intro; intro.setDataDirectory(dataDir); - intro.setWindowIcon(QIcon(":icons/bitcoin")); + intro.setWindowIcon(SingleColorIcon(":icons/bitcoin")); while(true) { diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index 4541c7588..e28f903b2 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -5,6 +5,7 @@ #include "networkstyle.h" #include "guiconstants.h" +#include "scicon.h" #include diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 01b4036f8..4fa15db9c 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -10,6 +10,7 @@ #include "guiconstants.h" #include "guiutil.h" #include "optionsmodel.h" +#include "scicon.h" #include "transactionfilterproxy.h" #include "transactiontablemodel.h" #include "walletmodel.h" @@ -34,7 +35,7 @@ public: { painter->save(); - QIcon icon = qvariant_cast(index.data(Qt::DecorationRole)); + QIcon icon = qvariant_cast(index.data(TransactionTableModel::RawDecorationRole)); QRect mainRect = option.rect; QRect decorationRect(mainRect.topLeft(), QSize(DECORATION_SIZE, DECORATION_SIZE)); int xspace = DECORATION_SIZE + 8; @@ -42,6 +43,7 @@ public: int halfheight = (mainRect.height() - 2*ypad)/2; QRect amountRect(mainRect.left() + xspace, mainRect.top()+ypad, mainRect.width() - xspace, halfheight); QRect addressRect(mainRect.left() + xspace, mainRect.top()+ypad+halfheight, mainRect.width() - xspace, halfheight); + icon = SingleColorIcon(icon, SingleColor()); icon.paint(painter, decorationRect); QDateTime date = index.data(TransactionTableModel::DateRole).toDateTime(); diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index aa1440e2c..28cbd3abe 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -12,6 +12,7 @@ #include "optionsmodel.h" #include "receiverequestdialog.h" #include "recentrequeststablemodel.h" +#include "scicon.h" #include "walletmodel.h" #include @@ -33,6 +34,11 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) : ui->receiveButton->setIcon(QIcon()); ui->showRequestButton->setIcon(QIcon()); ui->removeRequestButton->setIcon(QIcon()); +#else + ui->clearButton->setIcon(SingleColorIcon(":/icons/remove")); + ui->receiveButton->setIcon(SingleColorIcon(":/icons/receiving_addresses")); + ui->showRequestButton->setIcon(SingleColorIcon(":/icons/edit")); + ui->removeRequestButton->setIcon(SingleColorIcon(":/icons/remove")); #endif // context menu actions diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 271315b8c..a5e3ae2b3 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -8,6 +8,7 @@ #include "clientmodel.h" #include "guiutil.h" #include "peertablemodel.h" +#include "scicon.h" #include "main.h" #include "chainparams.h" @@ -210,8 +211,9 @@ RPCConsole::RPCConsole(QWidget *parent) : GUIUtil::restoreWindowGeometry("nRPCConsoleWindow", this->size(), this); #ifndef Q_OS_MAC - ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export")); + ui->openDebugLogfileButton->setIcon(SingleColorIcon(":/icons/export")); #endif + ui->clearButton->setIcon(SingleColorIcon(":/icons/remove")); // Install event filter for up and down arrow ui->lineEdit->installEventFilter(this); @@ -348,7 +350,7 @@ void RPCConsole::clear() ui->messagesWidget->document()->addResource( QTextDocument::ImageResource, QUrl(ICON_MAPPING[i].url), - QImage(ICON_MAPPING[i].source).scaled(ICON_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); + SingleColorImage(ICON_MAPPING[i].source, SingleColor()).scaled(ICON_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); } // Set default style sheet diff --git a/src/qt/scicon.cpp b/src/qt/scicon.cpp new file mode 100644 index 000000000..a0ffcd82a --- /dev/null +++ b/src/qt/scicon.cpp @@ -0,0 +1,84 @@ +// Copyright (c) 2014 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "scicon.h" + +#include +#include +#include +#include +#include +#include + +static void MakeSingleColorImage(QImage& img, const QColor& colorbase) +{ + img = img.convertToFormat(QImage::Format_ARGB32); + for (int x = img.width(); x--; ) + { + for (int y = img.height(); y--; ) + { + const QRgb rgb = img.pixel(x, y); + img.setPixel(x, y, qRgba(colorbase.red(), colorbase.green(), colorbase.blue(), qAlpha(rgb))); + } + } +} + +QImage SingleColorImage(const QString& filename, const QColor& colorbase) +{ + QImage img(filename); + MakeSingleColorImage(img, colorbase); + return img; +} + +QIcon SingleColorIcon(const QIcon& ico, const QColor& colorbase) +{ + QIcon new_ico; + QSize sz; + Q_FOREACH(sz, ico.availableSizes()) + { + QImage img(ico.pixmap(sz).toImage()); + MakeSingleColorImage(img, colorbase); + new_ico.addPixmap(QPixmap::fromImage(img)); + } + return new_ico; +} + +QIcon SingleColorIcon(const QString& filename, const QColor& colorbase) +{ + return QIcon(QPixmap::fromImage(SingleColorImage(filename, colorbase))); +} + +QColor SingleColor() +{ + const QColor colorHighlightBg(QApplication::palette().color(QPalette::Highlight)); + const QColor colorHighlightFg(QApplication::palette().color(QPalette::HighlightedText)); + const QColor colorText(QApplication::palette().color(QPalette::WindowText)); + const int colorTextLightness = colorText.lightness(); + QColor colorbase; + if (abs(colorHighlightBg.lightness() - colorTextLightness) < abs(colorHighlightFg.lightness() - colorTextLightness)) + colorbase = colorHighlightBg; + else + colorbase = colorHighlightFg; + return colorbase; +} + +QIcon SingleColorIcon(const QString& filename) +{ + return SingleColorIcon(filename, SingleColor()); +} + +static QColor TextColor() +{ + return QColor(QApplication::palette().color(QPalette::WindowText)); +} + +QIcon TextColorIcon(const QString& filename) +{ + return SingleColorIcon(filename, TextColor()); +} + +QIcon TextColorIcon(const QIcon& ico) +{ + return SingleColorIcon(ico, TextColor()); +} diff --git a/src/qt/scicon.h b/src/qt/scicon.h new file mode 100644 index 000000000..1388069dd --- /dev/null +++ b/src/qt/scicon.h @@ -0,0 +1,24 @@ +// Copyright (c) 2014 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_QT_SCICON_H +#define BITCOIN_QT_SCICON_H + +#include + +QT_BEGIN_NAMESPACE +class QColor; +class QIcon; +class QString; +QT_END_NAMESPACE + +QImage SingleColorImage(const QString& filename, const QColor&); +QIcon SingleColorIcon(const QIcon&, const QColor&); +QIcon SingleColorIcon(const QString& filename, const QColor&); +QColor SingleColor(); +QIcon SingleColorIcon(const QString& filename); +QIcon TextColorIcon(const QIcon&); +QIcon TextColorIcon(const QString& filename); + +#endif // BITCOIN_QT_SCICON_H diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index cde77a5d4..ffee56131 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -11,6 +11,7 @@ #include "coincontroldialog.h" #include "guiutil.h" #include "optionsmodel.h" +#include "scicon.h" #include "sendcoinsentry.h" #include "walletmodel.h" @@ -38,6 +39,10 @@ SendCoinsDialog::SendCoinsDialog(QWidget *parent) : ui->addButton->setIcon(QIcon()); ui->clearButton->setIcon(QIcon()); ui->sendButton->setIcon(QIcon()); +#else + ui->addButton->setIcon(SingleColorIcon(":/icons/add")); + ui->clearButton->setIcon(SingleColorIcon(":/icons/remove")); + ui->sendButton->setIcon(SingleColorIcon(":/icons/send")); #endif GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this); diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index ad9189d20..6db6eee75 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -9,6 +9,7 @@ #include "addresstablemodel.h" #include "guiutil.h" #include "optionsmodel.h" +#include "scicon.h" #include "walletmodel.h" #include @@ -21,6 +22,12 @@ SendCoinsEntry::SendCoinsEntry(QWidget *parent) : { ui->setupUi(this); + ui->addressBookButton->setIcon(SingleColorIcon(":/icons/address-book")); + ui->pasteButton->setIcon(SingleColorIcon(":/icons/editpaste")); + ui->deleteButton->setIcon(SingleColorIcon(":/icons/remove")); + ui->deleteButton_is->setIcon(SingleColorIcon(":/icons/remove")); + ui->deleteButton_s->setIcon(SingleColorIcon(":/icons/remove")); + setCurrentWidget(ui->SendCoins); #ifdef Q_OS_MAC diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp index e16e245b6..970f6a520 100644 --- a/src/qt/signverifymessagedialog.cpp +++ b/src/qt/signverifymessagedialog.cpp @@ -7,6 +7,7 @@ #include "addressbookpage.h" #include "guiutil.h" +#include "scicon.h" #include "walletmodel.h" #include "base58.h" @@ -25,6 +26,15 @@ SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) : { ui->setupUi(this); + ui->addressBookButton_SM->setIcon(SingleColorIcon(":/icons/address-book")); + ui->pasteButton_SM->setIcon(SingleColorIcon(":/icons/editpaste")); + ui->copySignatureButton_SM->setIcon(SingleColorIcon(":/icons/editcopy")); + ui->signMessageButton_SM->setIcon(SingleColorIcon(":/icons/edit")); + ui->clearButton_SM->setIcon(SingleColorIcon(":/icons/remove")); + ui->addressBookButton_VM->setIcon(SingleColorIcon(":/icons/address-book")); + ui->verifyMessageButton_VM->setIcon(SingleColorIcon(":/icons/transaction_0")); + ui->clearButton_VM->setIcon(SingleColorIcon(":/icons/remove")); + #if QT_VERSION >= 0x040700 ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature")); #endif diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 1dea5cdad..6771e7718 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -8,6 +8,7 @@ #include "guiconstants.h" #include "guiutil.h" #include "optionsmodel.h" +#include "scicon.h" #include "transactiondesc.h" #include "transactionrecord.h" #include "walletmodel.h" @@ -504,7 +505,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const switch(role) { - case Qt::DecorationRole: + case RawDecorationRole: switch(index.column()) { case Status: @@ -515,6 +516,11 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const return txAddressDecoration(rec); } break; + case Qt::DecorationRole: + { + QIcon icon = qvariant_cast(index.data(RawDecorationRole)); + return TextColorIcon(icon); + } case Qt::DisplayRole: switch(index.column()) { diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index 5eaccad06..30a15df9e 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -64,7 +64,9 @@ public: /** Formatted amount, without brackets when unconfirmed */ FormattedAmountRole, /** Transaction status (TransactionRecord::Status) */ - StatusRole + StatusRole, + /** Unprocessed icon */ + RawDecorationRole, }; int rowCount(const QModelIndex &parent) const; diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 00fd209c9..526940632 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -10,6 +10,7 @@ #include "editaddressdialog.h" #include "guiutil.h" #include "optionsmodel.h" +#include "scicon.h" #include "transactiondescdialog.h" #include "transactionfilterproxy.h" #include "transactionrecord.h" @@ -54,8 +55,8 @@ TransactionView::TransactionView(QWidget *parent) : watchOnlyWidget = new QComboBox(this); watchOnlyWidget->setFixedWidth(24); watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All); - watchOnlyWidget->addItem(QIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes); - watchOnlyWidget->addItem(QIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No); + watchOnlyWidget->addItem(SingleColorIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes); + watchOnlyWidget->addItem(SingleColorIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No); hlayout->addWidget(watchOnlyWidget); dateWidget = new QComboBox(this); diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 28b9c3b56..9d6a06019 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -12,6 +12,7 @@ #include "optionsmodel.h" #include "overviewpage.h" #include "receivecoinsdialog.h" +#include "scicon.h" #include "sendcoinsdialog.h" #include "signverifymessagedialog.h" #include "transactiontablemodel.h" @@ -44,7 +45,7 @@ WalletView::WalletView(QWidget *parent): QPushButton *exportButton = new QPushButton(tr("&Export"), this); exportButton->setToolTip(tr("Export the data in the current tab to a file")); #ifndef Q_OS_MAC // Icons on push buttons are very uncommon on Mac - exportButton->setIcon(QIcon(":/icons/export")); + exportButton->setIcon(SingleColorIcon(":/icons/export")); #endif hbox_buttons->addStretch(); hbox_buttons->addWidget(exportButton); From 244fdc7beef2e9091e1a7dc764379005960cf87b Mon Sep 17 00:00:00 2001 From: Julian Yap Date: Sun, 28 Dec 2014 00:22:44 -1000 Subject: [PATCH 55/88] Fix typo --- doc/gitian-building.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/gitian-building.md b/doc/gitian-building.md index defddedc6..1312979ca 100644 --- a/doc/gitian-building.md +++ b/doc/gitian-building.md @@ -83,7 +83,7 @@ Unixy OSes by entering the following in a terminal: After creating the VM, we need to configure it. -- Click the `Settings` button, then go to the `Network` tab. Adapter 1 should be attacked to `NAT`. +- Click the `Settings` button, then go to the `Network` tab. Adapter 1 should be attached to `NAT`. ![](gitian-building/network_settings.png) From 99913f0f70039d82f6cadbe4da4f831062800d1a Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Sun, 28 Dec 2014 22:57:39 +0100 Subject: [PATCH 56/88] Fix reference. The text talked about "Quit" while Bitcoin uses "Exit" in its menu. --- src/qt/forms/optionsdialog.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 19421dc81..55c4f5ac5 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -330,7 +330,7 @@ - Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu. + Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Exit in the menu. M&inimize on close From dd3f69736a6e25044b8802057ba9982592575cdb Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 27 Dec 2014 19:19:51 +0000 Subject: [PATCH 57/88] Use real text rather than image-rendered text for unit selector The width of each unit is measured to set a fixed width for the widget, and the color is set to match the other status widgets. --- src/Makefile.qt.include | 3 --- src/qt/bitcoin.qrc | 3 --- src/qt/bitcoingui.cpp | 12 +++++++++++- src/qt/res/icons/unit_btc.png | Bin 1318 -> 0 bytes src/qt/res/icons/unit_mbtc.png | Bin 1407 -> 0 bytes src/qt/res/icons/unit_ubtc.png | Bin 1369 -> 0 bytes 6 files changed, 11 insertions(+), 7 deletions(-) delete mode 100644 src/qt/res/icons/unit_btc.png delete mode 100644 src/qt/res/icons/unit_mbtc.png delete mode 100644 src/qt/res/icons/unit_ubtc.png diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 8b782b2ad..806b4f955 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -256,9 +256,6 @@ RES_ICONS = \ qt/res/icons/tx_input.png \ qt/res/icons/tx_output.png \ qt/res/icons/tx_mined.png \ - qt/res/icons/unit_btc.png \ - qt/res/icons/unit_mbtc.png \ - qt/res/icons/unit_ubtc.png \ qt/res/icons/verify.png BITCOIN_QT_CPP = \ diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index b54f2e2ed..bcaf95d91 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -35,9 +35,6 @@ res/icons/tx_input.png res/icons/tx_output.png res/icons/tx_inout.png - res/icons/unit_btc.png - res/icons/unit_mbtc.png - res/icons/unit_ubtc.png res/icons/lock_closed.png res/icons/lock_open.png res/icons/key.png diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 3b8fd985a..2810eae05 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1027,6 +1027,16 @@ UnitDisplayStatusBarControl::UnitDisplayStatusBarControl() : { createContextMenu(); setToolTip(tr("Unit to show amounts in. Click to select another unit.")); + QList units = BitcoinUnits::availableUnits(); + int max_width = 0; + const QFontMetrics fm(font()); + foreach (const BitcoinUnits::Unit unit, units) + { + max_width = qMax(max_width, fm.width(BitcoinUnits::name(unit))); + } + setMinimumSize(max_width, 0); + setAlignment(Qt::AlignRight | Qt::AlignVCenter); + setStyleSheet(QString("QLabel { color : %1 }").arg(SingleColor().name())); } /** So that it responds to button clicks */ @@ -1066,7 +1076,7 @@ void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *optionsModel) /** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */ void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits) { - setPixmap(SingleColorIcon(":/icons/unit_" + BitcoinUnits::id(newUnits)).pixmap(31,STATUSBAR_ICONSIZE)); + setText(BitcoinUnits::name(newUnits)); } /** Shows context menu with Display Unit options by the mouse coordinates */ diff --git a/src/qt/res/icons/unit_btc.png b/src/qt/res/icons/unit_btc.png deleted file mode 100644 index f3246fa99948a136c79e1bc14abceb71d1571f83..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1318 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBH!3HE3&8=$zQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?_naLn2Bde0{8v^K*7iAWdWaj57fJ{tG z$}cUkRRX#c;)UD-xUqS~&|m@vn0`fKfxe-h0mw@*g}%P{mFDKcRTq~8r6Sym)!^cg z%7Rq=pw#00(xPNw#HA^NtSYc_E=o--$uA1Y&(DE{Vn9ZINq%ugeu09svx0_iVsd64 zh_4CO;OlGUnO9trn3tUD>0+w{G(s;kGsVi#!p+Ij$=t%!#o55n(AC7!(Z$T!+{N73 zz|`E)+{hKC*Cju>G&eP`1g19yq1O_pUQk-dEdbi=l3J8mmYU*Ll%J~r_On$cZnv1> zG!Lpb1-Dzwaq86vIz}H9vq&)w69Oh55EGtmfgE_sPt5}+_ab1r7EhHGWME*N>FMGa zQgQ1|WOr_}fk5wSodG1EhtA!xQUACW zYw49AS*p-bQsSV+#CR)Ayu&-iuLye!`B4sPcSC(RWr zE8#KuBc;Hw{v=0(?Bs^FbGiNzNIHsnbo%M-(*I$0~^|u6W-0~acDTiCVe6F zn)T`(Z0o((IjvYWPw3DS`H$I zft$ET&NU4myQ@6=@4Gz>acA)U#=*G9HD}F^)fNxu$`~`Qla2Yu^568BeWxL#&w*)A b)ebORtD3;ww(5Q(sO0i=^>bP0l+XkK7K6)N diff --git a/src/qt/res/icons/unit_mbtc.png b/src/qt/res/icons/unit_mbtc.png deleted file mode 100644 index 4e82b652748baca3f2ee28c27e41a074217f46a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1407 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBH!3HE3&8=$zQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?_naLn2Bde0{8v^K*7iAWdWaj57fJ{tG z$}cUkRRX#c;)UD-xUqS~&|m@vn0`fKfxe-h0mw@*g}%P{mFDKcRTq~8r6Sym)!^cg z%7Rq=pw#00(xPNw#HA^NtSYc_E=o--$uA1Y&(DE{Vn9ZINq%ugeu09svx0_iVsd64 zh_4CO;OlGUnO9trn3tUD>0+w{G(s;kGsVi#!p+Ij$=t-$#o55n(AC7!(Z$T!+{N73 zz|`E)+{hKC*Cju>G&eP`1g19yq1P0rUQk-dEdbi=l3J8mmYU*Ll%J~r_On$c7PmMW zI+~c7x&h5|a>MQxh~5+|Zh`7G!>Lyv=oo!a%p%1!ObD2KKumbL1#;jiKQ#}S+>3ze zx=HHKMFs}OPo6H0Ar-gYL^k#|8}PJT*FVtj;GV!*$703Q17d0@AK)-JWb9PWBGGtj zQuCjm6Ks4#v;@7yydJUqeiP#)eeSc2Oys?$=5F=_%nukpFjO$uFvv0RA1Gv9f5>c? zlCs{~i}@E~W?hzew!$RnNASg8pMGmC{cp{vu%(2R!Go#F_{QUkKRyhLrWOjmS+S9m zW5LWf;o1_-N$-#3OrO+mxw`AN{(~|mg#^A-J_dp8QnvWkyPIUigm?~bV43TveL-T& zVzaEnZ?vx2d!_Dit&1s;_%R{qr~iWV=1Sl5tY6Ao1*ZkO`zuN|Hc0wL*1IfeF1q=m z+UfjBA?A&K+>TH=ib!uk*PY$|TzRCG37{6PPPe{#~slIFvLQ%#ueOuprj6&jdR zKV{C0uy5x=U-jRdvv#>d`h$-8LWbv)+%0@U8Jm|)VOwb%nYOO-=RN(oy>a^YJZB_XUMbC0xC+yV^W36aBz4U>1*{drIQLA@z?3{AZ;GXgG z+#hE*IlgAz3pcI!u7WiTv+dt=|BX-nr*6pK f!2aMwk$3`w$re4Ih=sRpK}DjctDnm{r-UW|wJ`QB diff --git a/src/qt/res/icons/unit_ubtc.png b/src/qt/res/icons/unit_ubtc.png deleted file mode 100644 index 96b254770dc0232a39d5e110c6924c9d44b4d284..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1369 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBH!3HE3&8=$zQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?_naLn2Bde0{8v^K*7iAWdWaj57fJ{tG z$}cUkRRX#c;)UD-xUqS~&|m@vn0`fKfxe-h0mw@*g}%P{mFDKcRTq~8r6Sym)!^cg z%7Rq=pw#00(xPNw#HA^NtSYc_E=o--$uA1Y&(DE{Vn9ZINq%ugeu09svx0_iVsd64 zh_4CO;OlGUnO9trn3tUD>0+w{G(s;kGsVi$(9y)q)Xmt`#mUXk(AC7!(Z$T!+{N73 zz|`E)+{hKC*Cju>G&eP`1g19yq1ObbUQk-dEdbi=l3J8mmYU*Ll%J~r_On$cZnqfX zG!Lpb1-Dy_aO%|uIz}H9vq&)w69Oh55EGtmfgE_sPt5}+_ab1rUch{PAp-;B8BZ6- zkcwMxW;Euu81OJWyvlk>@Rr~Ujx`SM3zRo7X&>OYFPPAh-tu4Y5XY5?bHcM)RVDIjS`~QR(W=l?={j|-JlWA7LzZ{lsU(M{U%j-J&mkNn~ zkAG0cG(m$;l##(BdhXG1%lAL6V#<8%`xPQ>e2aPh3x2t5wD;(J^)KCrnPf_s&YC1& z6E^DDVqRr5p={qn7kBSN`Hn}=et*Z4z?{h8vuC^Qs{SW-f?qd%Oxu~brko=(e8FnQ zH#3<(O0xA|`h`c>%Knh{f_XCB z3=0~1Z@v+EGSiiz=& Date: Mon, 29 Dec 2014 15:19:19 -0500 Subject: [PATCH 58/88] rpcserver: attempt to fix uncaught exception. --- src/rpcserver.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index c5d74afba..210c7fe97 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -650,14 +650,16 @@ void StartRPCThreads() bool fListening = false; std::string strerr; + std::string straddress; BOOST_FOREACH(const ip::tcp::endpoint &endpoint, vEndpoints) { - asio::ip::address bindAddress = endpoint.address(); - LogPrintf("Binding RPC on address %s port %i (IPv4+IPv6 bind any: %i)\n", bindAddress.to_string(), endpoint.port(), bBindAny); - boost::system::error_code v6_only_error; - boost::shared_ptr acceptor(new ip::tcp::acceptor(*rpc_io_service)); - try { + asio::ip::address bindAddress = endpoint.address(); + straddress = bindAddress.to_string(); + LogPrintf("Binding RPC on address %s port %i (IPv4+IPv6 bind any: %i)\n", straddress, endpoint.port(), bBindAny); + boost::system::error_code v6_only_error; + boost::shared_ptr acceptor(new ip::tcp::acceptor(*rpc_io_service)); + acceptor->open(endpoint.protocol()); acceptor->set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); @@ -678,8 +680,8 @@ void StartRPCThreads() } catch (const boost::system::system_error& e) { - LogPrintf("ERROR: Binding RPC on address %s port %i failed: %s\n", bindAddress.to_string(), endpoint.port(), e.what()); - strerr = strprintf(_("An error occurred while setting up the RPC address %s port %u for listening: %s"), bindAddress.to_string(), endpoint.port(), e.what()); + LogPrintf("ERROR: Binding RPC on address %s port %i failed: %s\n", straddress, endpoint.port(), e.what()); + strerr = strprintf(_("An error occurred while setting up the RPC address %s port %u for listening: %s"), straddress, endpoint.port(), e.what()); } } From 78a7cd38f46717aafcf0456752788e6d788aa2a9 Mon Sep 17 00:00:00 2001 From: Ben Holden-Crowther Date: Mon, 29 Dec 2014 20:50:57 +0000 Subject: [PATCH 59/88] Updated license date Changed 2014 to 2015 in preparation for new year --- COPYING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COPYING b/COPYING index 6219bd75a..9fd326662 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2009-2014 Bitcoin Developers +Copyright (c) 2009-2015 Bitcoin Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 0d50c2fd81ee7239570954e6eacb3dbbfe3bb5fe Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 30 Dec 2014 02:36:58 -0500 Subject: [PATCH 60/88] dmg: fix deterministic dmg creation and docs --- contrib/gitian-descriptors/gitian-osx-signer.yml | 6 +++--- doc/release-process.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/gitian-descriptors/gitian-osx-signer.yml b/contrib/gitian-descriptors/gitian-osx-signer.yml index db9b4af93..1792f9de3 100644 --- a/contrib/gitian-descriptors/gitian-osx-signer.yml +++ b/contrib/gitian-descriptors/gitian-osx-signer.yml @@ -10,7 +10,7 @@ packages: reference_datetime: "2013-06-01 00:00:00" remotes: [] files: -- "bitcoin-0.9.99-osx-unsigned.tar.gz" +- "bitcoin-osx-unsigned.tar.gz" - "signature.tar.gz" script: | WRAP_DIR=$HOME/wrapped @@ -28,8 +28,8 @@ script: | chmod +x ${WRAP_DIR}/${prog} done - UNSIGNED=`echo bitcoin-*.tar.gz` - SIGNED=`echo ${UNSIGNED} | sed 's/.tar.*//' | sed 's/-unsigned//'`.dmg + UNSIGNED=bitcoin-osx-unsigned.tar.gz + SIGNED=bitcoin-osx-signed.dmg tar -xf ${UNSIGNED} ./detached-sig-apply.sh ${UNSIGNED} signature.tar.gz diff --git a/doc/release-process.md b/doc/release-process.md index 30f979775..eb2eb619b 100644 --- a/doc/release-process.md +++ b/doc/release-process.md @@ -68,7 +68,7 @@ Release Process mv build/out/bitcoin-*.zip build/out/bitcoin-*.exe ../ ./bin/gbuild --commit bitcoin=v${VERSION} ../bitcoin/contrib/gitian-descriptors/gitian-osx.yml ./bin/gsign --signer $SIGNER --release ${VERSION}-osx-unsigned --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-osx.yml - mv build/out/bitcoin-*-unsigned.tar.gz inputs + mv build/out/bitcoin-*-unsigned.tar.gz inputs/bitcoin-osx-unsigned.tar.gz mv build/out/bitcoin-*.tar.gz build/out/bitcoin-*.dmg ../ popd Build output expected: @@ -102,7 +102,7 @@ Commit your signature to gitian.sigs: cp signature.tar.gz inputs/ ./bin/gbuild -i ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml ./bin/gsign --signer $SIGNER --release ${VERSION}-osx-signed --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml - mv build/out/bitcoin-${VERSION}-osx.dmg ../ + mv build/out/bitcoin-osx-signed.dmg ../bitcoin-${VERSION}-osx.dmg popd Commit your signature for the signed OSX binary: From 06206bb3b78067f1f433dde8062c8ab01aaf43eb Mon Sep 17 00:00:00 2001 From: Michael Ford Date: Tue, 30 Dec 2014 17:46:57 +0800 Subject: [PATCH 61/88] Correct tooltip on address book page --- src/qt/forms/addressbookpage.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/forms/addressbookpage.ui b/src/qt/forms/addressbookpage.ui index 52fdc6ef0..264edeb72 100644 --- a/src/qt/forms/addressbookpage.ui +++ b/src/qt/forms/addressbookpage.ui @@ -27,7 +27,7 @@ Qt::CustomContextMenu - Double-click to edit address or label + Right-click to edit address or label false From 8f6860a083837e1f991ed75993f7c4fbcb10462c Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 30 Dec 2014 15:15:40 +0000 Subject: [PATCH 62/88] Bugfix: RPCWallet: Docs: Booleans aren't quoted --- src/rpcwallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index e43eee155..82fae2dff 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1103,7 +1103,7 @@ Value listreceivedbyaddress(const Array& params, bool fHelp) "\nResult:\n" "[\n" " {\n" - " \"involvesWatchonly\" : \"true\", (bool) Only returned if imported addresses were involved in transaction\n" + " \"involvesWatchonly\" : true, (bool) Only returned if imported addresses were involved in transaction\n" " \"address\" : \"receivingaddress\", (string) The receiving address\n" " \"account\" : \"accountname\", (string) The account of the receiving address. The default account is \"\".\n" " \"amount\" : x.xxx, (numeric) The total amount in btc received by the address\n" @@ -1135,7 +1135,7 @@ Value listreceivedbyaccount(const Array& params, bool fHelp) "\nResult:\n" "[\n" " {\n" - " \"involvesWatchonly\" : \"true\", (bool) Only returned if imported addresses were involved in transaction\n" + " \"involvesWatchonly\" : true, (bool) Only returned if imported addresses were involved in transaction\n" " \"account\" : \"accountname\", (string) The account name of the receiving account\n" " \"amount\" : x.xxx, (numeric) The total amount received by addresses with this account\n" " \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n" From 4f1ee565b5669fece4178d590f37a577c4062420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jan=C3=ADk?= Date: Tue, 30 Dec 2014 23:02:46 +0100 Subject: [PATCH 63/88] Clean AcceptToMemoryPool error messages --- src/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2410230ef..0e199fe60 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -926,11 +926,11 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa *pfMissingInputs = false; if (!CheckTransaction(tx, state)) - return error("AcceptToMemoryPool: : CheckTransaction failed"); + return error("AcceptToMemoryPool: CheckTransaction failed"); // Coinbase is only valid in a block, not as a loose transaction if (tx.IsCoinBase()) - return state.DoS(100, error("AcceptToMemoryPool: : coinbase as individual tx"), + return state.DoS(100, error("AcceptToMemoryPool: coinbase as individual tx"), REJECT_INVALID, "coinbase"); // Rather not work on nonstandard transactions (unless -testnet/-regtest) @@ -1000,7 +1000,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa // Check for non-standard pay-to-script-hash in inputs if (Params().RequireStandard() && !AreInputsStandard(tx, view)) - return error("AcceptToMemoryPool: : nonstandard transaction input"); + return error("AcceptToMemoryPool: nonstandard transaction input"); // Check that the transaction doesn't have an excessive number of // sigops, making it impossible to mine. Since the coinbase transaction @@ -1076,7 +1076,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa // can be exploited as a DoS attack. if (!CheckInputs(tx, state, view, true, MANDATORY_SCRIPT_VERIFY_FLAGS, true)) { - return error("AcceptToMemoryPool: : BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags %s", hash.ToString()); + return error("AcceptToMemoryPool: BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags %s", hash.ToString()); } // Store transaction in memory From 228d2385254ee136ef64d229a414fdd7cefea9a0 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 31 Dec 2014 03:19:24 +0000 Subject: [PATCH 64/88] Make CCoinsViewCache's copy constructor private It is easily confused with CCoinsViewCache(CCoinsView*), which creates a sub-cache, but instead of creating a sub-cache, the copy constructor would copy the original and use that original's base, defeating the intended isolation. --- src/coins.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/coins.h b/src/coins.h index dbe3f8bd3..e6ba16894 100644 --- a/src/coins.h +++ b/src/coins.h @@ -441,6 +441,11 @@ public: private: CCoinsMap::iterator FetchCoins(const uint256 &txid); CCoinsMap::const_iterator FetchCoins(const uint256 &txid) const; + + /** + * By making the copy constructor private, we prevent accidentally using it when one intends to create a cache on top of a base cache. + */ + CCoinsViewCache(const CCoinsViewCache &); }; #endif // BITCOIN_COINS_H From 1b178a7f966cd3649b7f0a52ffc4b8ef4c227900 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 31 Dec 2014 03:28:05 +0000 Subject: [PATCH 65/88] Bugfix: ConnectBlock: In case the genesis block gets in with fJustCheck, behave correctly --- src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 70e3973e6..7c5b7401e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1616,7 +1616,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin // Special case for the genesis block, skipping connection of its transactions // (its coinbase is unspendable) if (block.GetHash() == Params().HashGenesisBlock()) { - view.SetBestBlock(pindex->GetBlockHash()); + if (!fJustCheck) + view.SetBestBlock(pindex->GetBlockHash()); return true; } From 643415aade0dae528098df2d822288ba0c5f6ce2 Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Wed, 31 Dec 2014 12:03:00 +0100 Subject: [PATCH 66/88] [Qt] update a translation string and argument counts --- src/qt/paymentserver.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 3f8e89535..b3dbb693d 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -667,8 +667,7 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply) // BIP70 DoS protection if (reply->size() > BIP70_MAX_PAYMENTREQUEST_SIZE) { - QString msg = tr("Payment request %2 is too large (%3 bytes, allowed %4 bytes).") - .arg(__func__) + QString msg = tr("Payment request %1 is too large (%2 bytes, allowed %3 bytes).") .arg(reply->request().url().toString()) .arg(reply->size()) .arg(BIP70_MAX_PAYMENTREQUEST_SIZE); From d57b303e1e5b3fc31da0769b14b01fdcc19b1f7a Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 30 Dec 2014 18:45:29 -0500 Subject: [PATCH 67/88] depends: fix major regression after d546191dc. Broken hash logic caused all depends on some platforms (osx at least) to end up with the same build-id. Without this fix, nothing will be rebuilt when recipes or dependencies change. --- depends/funcs.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/depends/funcs.mk b/depends/funcs.mk index 79015c047..337634253 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -31,8 +31,8 @@ define fetch_file endef define int_get_build_recipe_hash -$(eval $(1)_all_file_checksums:=$(shell $(build_SHA256SUM) $(meta_depends) packages/$(1).mk $(addprefix $(PATCHES_PATH)/$(1)/,$($(1)_patches)))) -$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | cut -d" " -f1 | $(build_SHA256SUM))) +$(eval $(1)_all_file_checksums:=$(shell $(build_SHA256SUM) $(meta_depends) packages/$(1).mk $(addprefix $(PATCHES_PATH)/$(1)/,$($(1)_patches)) | cut -d" " -f1)) +$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | $(build_SHA256SUM) | cut -d" " -f1)) endef define int_get_build_id From e6df2bb48f4bff7a2dec4aa226102b0cf2cd828b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 2 Jan 2015 10:42:33 +0100 Subject: [PATCH 68/88] Remove redundant copyright notices from README files The normative place for these for the entire project is COPYING, and the main README already has a MIT license section. --- README.md | 2 -- doc/README.md | 5 +---- doc/README_windows.txt | 12 ++---------- src/test/data/README.md | 8 +++----- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 03a698996..67c5ed5b4 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,6 @@ Bitcoin Core integration/staging tree https://www.bitcoin.org -Copyright (c) 2009-2014 Bitcoin Core Developers - What is Bitcoin? ---------------- diff --git a/doc/README.md b/doc/README.md index 1696518f8..b2a0c2dcb 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,9 +1,6 @@ -Bitcoin 0.10.99 +Bitcoin Core 0.10.99 ===================== -Copyright (c) 2009-2014 Bitcoin Developers - - Setup --------------------- [Bitcoin Core](http://bitcoin.org/en/download) is the original Bitcoin client and it builds the backbone of the network. However, it downloads and stores the entire history of Bitcoin transactions (which is currently several GBs); depending on the speed of your computer and network connection, the synchronization process can take anywhere from a few hours to a day or more. Thankfully you only have to do this once. If you would like the process to go faster you can [download the blockchain directly](bootstrap.md). diff --git a/doc/README_windows.txt b/doc/README_windows.txt index 5ac115205..c58294169 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -1,13 +1,5 @@ -Bitcoin 0.10.99 - -Copyright (c) 2009-2014 Bitcoin Core Developers - -Distributed under the MIT software license, see the accompanying -file COPYING or http://www.opensource.org/licenses/mit-license.php. -This product includes software developed by the OpenSSL Project for use in -the OpenSSL Toolkit (https://www.openssl.org/). This product includes -cryptographic software written by Eric Young (eay@cryptsoft.com). - +Bitcoin Core 0.10.99 +===================== Intro ----- diff --git a/src/test/data/README.md b/src/test/data/README.md index 55ac95739..2463daa42 100644 --- a/src/test/data/README.md +++ b/src/test/data/README.md @@ -6,9 +6,7 @@ This directory contains data-driven tests for various aspects of Bitcoin. License -------- -The data files in this directory are - - Copyright (c) 2012-2014 The Bitcoin Core developers - Distributed under the MIT software license, see the accompanying - file COPYING or http://www.opensource.org/licenses/mit-license.php. +The data files in this directory are distributed under the MIT software +license, see the accompanying file COPYING or +http://www.opensource.org/licenses/mit-license.php. From edbc9045cb21020d0cc19d226f55ee169e2ffb92 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 2 Jan 2015 10:49:20 +0100 Subject: [PATCH 69/88] Bump project-wide COPYRIGHT_YEAR to 2015 There is still a redundancy here between configure.ac and clientversion.h. --- configure.ac | 2 +- src/clientversion.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b28898a4f..adcd1c0dd 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ define(_CLIENT_VERSION_MINOR, 10) define(_CLIENT_VERSION_REVISION, 99) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, false) -define(_COPYRIGHT_YEAR, 2014) +define(_COPYRIGHT_YEAR, 2015) AC_INIT([Bitcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitcoin.org],[bitcoin]) AC_CONFIG_SRCDIR([src/main.cpp]) AC_CONFIG_HEADERS([src/config/bitcoin-config.h]) diff --git a/src/clientversion.h b/src/clientversion.h index 40de7837a..3c8c969f9 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -26,7 +26,7 @@ * Copyright year (2009-this) * Todo: update this when changing our copyright comments in the source */ -#define COPYRIGHT_YEAR 2014 +#define COPYRIGHT_YEAR 2015 #endif //HAVE_CONFIG_H From 269d8ba0d24eb9a35c8c9e4995eccedfb723717b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 2 Jan 2015 17:27:18 +0100 Subject: [PATCH 70/88] Remove declaration of no longer existent CheckWork Also make ProcessBlockFound static as it is not used outside miner.cpp. Alternative implementation of #5549. --- src/miner.cpp | 2 +- src/miner.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 0ac974d6e..3bd2a9a41 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -411,7 +411,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) return CreateNewBlock(scriptPubKey); } -bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey) +static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey) { LogPrintf("%s\n", pblock->ToString()); LogPrintf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue)); diff --git a/src/miner.h b/src/miner.h index 02dedb171..3c08b030f 100644 --- a/src/miner.h +++ b/src/miner.h @@ -24,8 +24,6 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn); CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey); /** Modify the extranonce in a block */ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce); -/** Check mined block */ -bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey); void UpdateTime(CBlockHeader* block, const CBlockIndex* pindexPrev); extern double dHashesPerSec; From ec90c97d13a4770c0c794f46eccc675e3c1a5103 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 30 Dec 2014 21:37:30 -0500 Subject: [PATCH 71/88] depends: osx: fix qt5 build against 10.10 sdk --- depends/packages/qt.mk | 3 +- depends/patches/qt/qt5-yosemite.patch | 52 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 depends/patches/qt/qt5-yosemite.patch diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 6a8e714a4..57f973d59 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -7,7 +7,7 @@ $(package)_dependencies=openssl $(package)_linux_dependencies=freetype fontconfig dbus libxcb libX11 xproto libXext $(package)_build_subdir=qtbase $(package)_qt_libs=corelib network widgets gui plugins testlib -$(package)_patches=mac-qmake.conf fix-xcb-include-order.patch qt5-tablet-osx.patch +$(package)_patches=mac-qmake.conf fix-xcb-include-order.patch qt5-tablet-osx.patch qt5-yosemite.patch define $(package)_set_vars $(package)_config_opts_release = -release @@ -56,6 +56,7 @@ define $(package)_preprocess_cmds cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \ patch -p1 < $($(package)_patch_dir)/fix-xcb-include-order.patch && \ patch -p1 < $($(package)_patch_dir)/qt5-tablet-osx.patch && \ + patch -d qtbase -p1 < $($(package)_patch_dir)/qt5-yosemite.patch && \ echo "QMAKE_CFLAGS += $($(package)_cflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ echo "QMAKE_CXXFLAGS += $($(package)_cxxflags) $($(package)_cppflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ echo "QMAKE_LFLAGS += $($(package)_ldflags)" >> qtbase/mkspecs/common/gcc-base.conf && \ diff --git a/depends/patches/qt/qt5-yosemite.patch b/depends/patches/qt/qt5-yosemite.patch new file mode 100644 index 000000000..d569d34d4 --- /dev/null +++ b/depends/patches/qt/qt5-yosemite.patch @@ -0,0 +1,52 @@ +The following patch was taken from upstream: +https://qt.gitorious.org/qt/qtbase/commit/70e4428b6f1c6a4bad112203f67ee7d22107616c.patch + +The first hunk was removed because it conflicts with 5.2.1, and is not currently needed. + +From 70e4428b6f1c6a4bad112203f67ee7d22107616c Mon Sep 17 00:00:00 2001 +From: Gabriel de Dietrich +Date: Tue, 3 Jun 2014 14:20:20 +0200 +Subject: [PATCH] Cocoa: Adapt to Xcode 6 clang version sudden pickiness +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Yes, that means OS X Yosemite fix. + +Change-Id: I236f7af7b803de24ff0895e04c9a9253b5cfdb3b +Reviewed-by: Morten Johan Sørvig +--- + .../platforms/cocoa/qcocoaaccessibilityelement.mm | 2 +- + .../platforms/cocoa/qcocoaapplicationdelegate.mm | 2 +- + src/plugins/platforms/cocoa/qcocoamenuloader.mm | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +index f841184..548c6a2 100644 +--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm ++++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm +@@ -124,7 +124,7 @@ static void cleanupCocoaApplicationDelegate() + [dockMenu release]; + [qtMenuLoader release]; + if (reflectionDelegate) { +- [NSApp setDelegate:reflectionDelegate]; ++ [[NSApplication sharedApplication] setDelegate:reflectionDelegate]; + [reflectionDelegate release]; + } + [[NSNotificationCenter defaultCenter] removeObserver:self]; +diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm +index 60bc3b5..9340e94 100644 +--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm ++++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm +@@ -174,7 +174,7 @@ QT_END_NAMESPACE + - (void)removeActionsFromAppMenu + { + for (NSMenuItem *item in [appMenu itemArray]) +- [item setTag:nil]; ++ [item setTag:0]; + } + + - (void)dealloc +-- +1.7.1 + From 4fe6c3c24fbd84fec7d7952a521e0cb443a3d72b Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 30 Dec 2014 19:10:15 -0500 Subject: [PATCH 72/88] depends: major upgrade to darwin toolchain tl;dr: Update to the newer stable toolchain and SDK for OSX without giving up any backwards compatibility. We can move to clang 3.5 as a next step which allows use to use libc++ and the 10.10 sdk, but we'll need to find a build that works in gitian/travis first. Switch to a new, better maintained fork of cctools: https://github.com/tpoechtrager/cctools-port I've forked this and will be working on it some as well: https://github.com/theuni/cctools-port This brings in: cctools v862 ld64: v241.9 It also fixes 64bit builds, so there's no longer any need to use a 32bit clang. Since clang is no longer tied to an old/crusty 32bit build, clang has been upgraded to 3.3. Unfortunately, there's a bug in 3.4 that breaks builds. 3.5 works fine, but there are no binary builds compatible with precise, which is currently used for gitian and travis. We could always build our own if necessary. After updating to stable clang/linker/cctools, it's possible to use a more recent SDK. The current SDK (10.7) through the most recent 10.10 have all been built/tested successfully, both with and without 10.6 compatibility. However, 10.10 requires clang 3.5. SDKs >= 10.9 use libc++ rather than libstdc++. This is verified working as well. --- depends/hosts/darwin.mk | 5 +- depends/packages/native_cctools.mk | 87 +++++++++++------------------- depends/packages/native_libuuid.mk | 3 -- depends/packages/native_openssl.mk | 2 +- depends/packages/qt.mk | 2 +- depends/patches/qt/mac-qmake.conf | 2 +- 6 files changed, 38 insertions(+), 63 deletions(-) diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index 8d718eba1..c1070d877 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -1,8 +1,9 @@ OSX_MIN_VERSION=10.6 OSX_SDK_VERSION=10.7 OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk -darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) +LD64_VERSION=241.9 +darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) +darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) darwin_CFLAGS=-pipe darwin_CXXFLAGS=$(darwin_CFLAGS) diff --git a/depends/packages/native_cctools.mk b/depends/packages/native_cctools.mk index 1675afe78..bf50880e1 100644 --- a/depends/packages/native_cctools.mk +++ b/depends/packages/native_cctools.mk @@ -1,80 +1,57 @@ package=native_cctools -$(package)_version=809 -$(package)_download_path=http://www.opensource.apple.com/tarballs/cctools -$(package)_file_name=cctools-$($(package)_version).tar.gz -$(package)_sha256_hash=03ba62749b843b131c7304a044a98c6ffacd65b1399b921d69add0375f79d8ad -$(package)_build_subdir=cctools2odcctools/odcctools-$($(package)_version) +$(package)_version=59d21d2c793c51d205c8b4ab14b9b28e63c72445 +$(package)_download_path=https://github.com/theuni/cctools-port/archive +$(package)_file_name=$($(package)_version).tar.gz +$(package)_sha256_hash=e13c7129b9d496adf4d674156b4a1d72d8b936f29f377aae8f8b5e7b650cc305 +$(package)_build_subdir=cctools $(package)_dependencies=native_libuuid native_openssl -$(package)_ld64_download_file=ld64-127.2.tar.gz -$(package)_ld64_download_path=http://www.opensource.apple.com/tarballs/ld64 -$(package)_ld64_file_name=$($(package)_ld64_download_file) -$(package)_ld64_sha256_hash=97b75547b2bd761306ab3e15ae297f01e7ab9760b922bc657f4ef72e4e052142 -$(package)_dyld_download_file=dyld-195.5.tar.gz -$(package)_dyld_download_path=http://www.opensource.apple.com/tarballs/dyld -$(package)_dyld_file_name=$($(package)_dyld_download_file) -$(package)_dyld_sha256_hash=2cf0484c87cf79b606b351a7055a247dae84093ae92c747a74e0cde2c8c8f83c -$(package)_toolchain4_download_file=10cc648683617cca8bcbeae507888099b41b530c.tar.gz -$(package)_toolchain4_download_path=https://github.com/mingwandroid/toolchain4/archive -$(package)_toolchain4_file_name=toolchain4-1.tar.gz -$(package)_toolchain4_sha256_hash=18406961fd4a1ec5c7ea35c91d6a80a2f8bb797a2bd243a610bd75e13eff9aca -$(package)_clang_download_file=clang+llvm-3.2-x86-linux-ubuntu-12.04.tar.gz -$(package)_clang_download_path=http://llvm.org/releases/3.2 -$(package)_clang_file_name=clang-llvm-3.2-x86-linux-ubuntu-12.04.tar.gz -$(package)_clang_sha256_hash=b9d57a88f9514fa1f327a1a703756d0c1c960f4c58494a5bd80313245d13ffff - +$(package)_clang_version=3.3 +$(package)_clang_download_path=http://llvm.org/releases/$($(package)_clang_version) +$(package)_clang_download_file=clang+llvm-$($(package)_clang_version)-amd64-Ubuntu-12.04.2.tar.gz +$(package)_clang_file_name=clang-llvm-$($(package)_clang_version)-amd64-Ubuntu-12.04.2.tar.gz +$(package)_clang_sha256_hash=60d8f69f032d62ef61bf527857ebb933741ec3352d4d328c5516aa520662dab7 define $(package)_fetch_cmds $(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \ -$(call fetch_file,$(package),$($(package)_ld64_download_path),$($(package)_ld64_download_file),$($(package)_ld64_file_name),$($(package)_ld64_sha256_hash)) && \ -$(call fetch_file,$(package),$($(package)_dyld_download_path),$($(package)_dyld_download_file),$($(package)_dyld_file_name),$($(package)_dyld_sha256_hash)) && \ -$(call fetch_file,$(package),$($(package)_clang_download_path),$($(package)_clang_download_file),$($(package)_clang_file_name),$($(package)_clang_sha256_hash)) && \ -$(call fetch_file,$(package),$($(package)_toolchain4_download_path),$($(package)_toolchain4_download_file),$($(package)_toolchain4_file_name),$($(package)_toolchain4_sha256_hash)) +$(call fetch_file,$(package),$($(package)_clang_download_path),$($(package)_clang_download_file),$($(package)_clang_file_name),$($(package)_clang_sha256_hash)) +endef + +define $(package)_extract_cmds + mkdir -p toolchain/bin toolchain/lib/clang/3.5/include && \ + tar --strip-components=1 -C toolchain -xf $($(package)_source_dir)/$($(package)_clang_file_name) && \ + echo "#!/bin/sh" > toolchain/bin/$(host)-dsymutil && \ + echo "exit 0" >> toolchain/bin/$(host)-dsymutil && \ + chmod +x toolchain/bin/$(host)-dsymutil && \ + tar --strip-components=1 -xf $($(package)_source) endef define $(package)_set_vars -$(package)_config_opts=--target=$(host) --with-sysroot=$(OSX_SDK) -$(package)_cflags+=-m32 -$(package)_cxxflags+=-m32 -$(package)_cppflags+=-D__DARWIN_UNIX03 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -$(package)_ldflags+=-m32 -Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib -$(package)_ldflags+=-L$$(native_cctools_extract_dir)/clang+llvm-3.2-x86-linux-ubuntu-12.04/lib -endef -define $(package)_extract_cmds - tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_toolchain4_file_name) && \ - ln -sf $($(package)_source) cctools2odcctools/$($(package)_file_name) && \ - ln -sf $($(package)_source_dir)/$($(package)_ld64_file_name) cctools2odcctools/$($(package)_ld64_file_name) && \ - ln -sf $($(package)_source_dir)/$($(package)_dyld_file_name) cctools2odcctools/$($(package)_dyld_file_name) && \ - tar xf $($(package)_source_dir)/$($(package)_clang_file_name) && \ - mkdir -p $(SDK_PATH) sdks &&\ - cd sdks; ln -sf $(OSX_SDK) MacOSX$(OSX_SDK_VERSION).sdk +$(package)_config_opts=--target=$(host) CC=toolchain/clang CXX=toolchain/clang++ +$(package)_ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib endef define $(package)_preprocess_cmds - sed -i "s|GCC_DIR|LLVM_CLANG_DIR|g" cctools2odcctools/extract.sh && \ - sed -i "s|llvmgcc42-2336.1|clang+llvm-3.2-x86-linux-ubuntu-12.04|g" cctools2odcctools/extract.sh && \ - sed -i "s|/llvmCore/include/llvm-c|/include/llvm-c \$$$${LLVM_CLANG_DIR}/include/llvm |" cctools2odcctools/extract.sh && \ - sed -i "s|fAC_INIT|AC_INIT|" cctools2odcctools/files/configure.ac && \ - sed -i 's/\# Dynamically linked LTO/\t ;\&\n\t linux*)\n# Dynamically linked LTO/' cctools2odcctools/files/configure.ac && \ - cd cctools2odcctools; ./extract.sh --osxver $(OSX_SDK_VERSION) && \ - sed -i "s|define\tPC|define\tPC_|" odcctools-809/include/architecture/sparc/reg.h + cd $($(package)_build_subdir); ./autogen.sh endef define $(package)_config_cmds + export "PATH=$($(package)_extract_dir)/toolchain/bin:$(PATH)" && \ $($(package)_autoconf) endef define $(package)_build_cmds + export "PATH=$($(package)_extract_dir)/toolchain/bin:$(PATH)" && \ $(MAKE) endef define $(package)_stage_cmds $(MAKE) DESTDIR=$($(package)_staging_dir) install && \ - cd ../../clang+llvm-3.2-x86-linux-ubuntu-12.04 && \ - mkdir -p $($(package)_staging_prefix_dir)/lib/clang/3.2/include && \ - mkdir -p $($(package)_staging_prefix_dir)/bin && \ + cd $($(package)_extract_dir)/toolchain && \ + mkdir -p $($(package)_staging_prefix_dir)/lib/clang/$($(package)_clang_version)/include && \ + mkdir -p $($(package)_staging_prefix_dir)/bin $($(package)_staging_prefix_dir)/include && \ cp -P bin/clang bin/clang++ $($(package)_staging_prefix_dir)/bin/ &&\ cp lib/libLTO.so $($(package)_staging_prefix_dir)/lib/ && \ - cp lib/clang/3.2/include/* $($(package)_staging_prefix_dir)/lib/clang/3.2/include/ && \ - echo "#!/bin/sh" > $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil && \ - echo "exit 0" >> $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil && \ - chmod +x $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil + cp -rf lib/clang/$($(package)_clang_version)/include/* $($(package)_staging_prefix_dir)/lib/clang/$($(package)_clang_version)/include/ && \ + cp bin/$(host)-dsymutil $($(package)_staging_prefix_dir)/bin && \ + if `test -d include/c++/`; then cp -rf include/c++/ $($(package)_staging_prefix_dir)/include/; fi && \ + if `test -d lib/c++/`; then cp -rf lib/c++/ $($(package)_staging_prefix_dir)/lib/; fi endef diff --git a/depends/packages/native_libuuid.mk b/depends/packages/native_libuuid.mk index b25540f80..741eabfe8 100644 --- a/depends/packages/native_libuuid.mk +++ b/depends/packages/native_libuuid.mk @@ -6,9 +6,6 @@ $(package)_sha256_hash=dbc7a138a3218d9b80a0626b5b692d76934d6746d8cbb762751be3378 define $(package)_set_vars $(package)_config_opts=--disable-elf-shlibs --disable-uuidd -$(package)_cflags+=-m32 -$(package)_ldflags+=-m32 -$(package)_cxxflags+=-m32 endef define $(package)_config_cmds diff --git a/depends/packages/native_openssl.mk b/depends/packages/native_openssl.mk index 1f25d6afc..108c6e944 100644 --- a/depends/packages/native_openssl.mk +++ b/depends/packages/native_openssl.mk @@ -4,7 +4,7 @@ $(package)_download_path=https://www.openssl.org/source $(package)_file_name=openssl-$($(package)_version).tar.gz $(package)_sha256_hash=9d1c8a9836aa63e2c6adb684186cbd4371c9e9dcc01d6e3bb447abf2d4d3d093 define $(package)_set_vars -$(package)_build_config_opts= --prefix=$(build_prefix) no-zlib no-shared no-krb5C linux-generic32 -m32 +$(package)_build_config_opts= --prefix=$(build_prefix) no-zlib no-shared no-krb5C linux-generic64 endef define $(package)_config_cmds diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 57f973d59..59c12d22f 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -34,7 +34,7 @@ $(package)_config_opts += -qt-libpng -qt-libjpeg -qt-zlib -qt-pcre ifneq ($(build_os),darwin) $(package)_config_opts_darwin = -xplatform macx-clang-linux -device-option MAC_SDK_PATH=$(OSX_SDK) -device-option CROSS_COMPILE="$(host)-" -$(package)_config_opts_darwin += -device-option MAC_MIN_VERSION=$(OSX_MIN_VERSION) -device-option MAC_TARGET=$(host) +$(package)_config_opts_darwin += -device-option MAC_MIN_VERSION=$(OSX_MIN_VERSION) -device-option MAC_TARGET=$(host) -device-option MAC_LD64_VERSION=$(LD64_VERSION) endif $(package)_config_opts_linux = -qt-xkbcommon -qt-xcb -no-eglfs -no-linuxfb -system-freetype -no-sm -fontconfig -no-xinput2 -no-libudev -no-egl -no-opengl diff --git a/depends/patches/qt/mac-qmake.conf b/depends/patches/qt/mac-qmake.conf index f7302265b..a97945bc8 100644 --- a/depends/patches/qt/mac-qmake.conf +++ b/depends/patches/qt/mac-qmake.conf @@ -15,7 +15,7 @@ QMAKE_MAC_SDK.macosx.platform_name = macosx QMAKE_CFLAGS += -target $${MAC_TARGET} QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_LFLAGS += -target $${MAC_TARGET} +QMAKE_LFLAGS += -target $${MAC_TARGET} -mlinker-version=$${MAC_LD64_VERSION} QMAKE_AR = $${CROSS_COMPILE}ar cq QMAKE_RANLIB=$${CROSS_COMPILE}ranlib QMAKE_LIBTOOL=$${CROSS_COMPILE}libtool From 46f54bf7968c0640e67756bcf6819d74e2e52554 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Wed, 31 Dec 2014 02:55:17 -0500 Subject: [PATCH 73/88] build: osx builders no longer need 32bit compiler support --- .travis.yml | 2 +- contrib/gitian-descriptors/gitian-osx.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1630c1d02..8b9ede3e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ matrix: - compiler: ": 32-bit + dash" env: HOST=i686-pc-linux-gnu PACKAGES="g++-multilib bc" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat" USE_SHELL="/bin/dash" - compiler: ": Cross-Mac" - env: HOST=x86_64-apple-darwin11 PACKAGES="gcc-multilib g++-multilib cmake libcap-dev libz-dev libbz2-dev" OSX_SDK=10.7 GOAL="deploy" + env: HOST=x86_64-apple-darwin11 PACKAGES="cmake libcap-dev libz-dev libbz2-dev" OSX_SDK=10.7 GOAL="deploy" - compiler: ": Win64" env: HOST=x86_64-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-gui" MAKEJOBS="-j2" - compiler: ": Win32" diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index 4f05aad23..0732d3530 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -6,7 +6,7 @@ suites: architectures: - "amd64" packages: -- "g++-multilib" +- "g++" - "git-core" - "pkg-config" - "autoconf2.13" From 4caad26ba1230a26f45f3c0279a24617ec809bab Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Fri, 2 Jan 2015 19:31:04 -0500 Subject: [PATCH 74/88] depends: bump cctools to a custom version with less deps This one no longer requires native libuuid or libcrypto --- depends/packages/native_cctools.mk | 11 +++++------ depends/packages/native_libuuid.mk | 21 --------------------- depends/packages/native_openssl.mk | 21 --------------------- depends/packages/packages.mk | 2 +- 4 files changed, 6 insertions(+), 49 deletions(-) delete mode 100644 depends/packages/native_libuuid.mk delete mode 100644 depends/packages/native_openssl.mk diff --git a/depends/packages/native_cctools.mk b/depends/packages/native_cctools.mk index bf50880e1..951ad4fb2 100644 --- a/depends/packages/native_cctools.mk +++ b/depends/packages/native_cctools.mk @@ -1,10 +1,9 @@ package=native_cctools -$(package)_version=59d21d2c793c51d205c8b4ab14b9b28e63c72445 +$(package)_version=ee31ae567931c426136c94aad457c7b51d844beb $(package)_download_path=https://github.com/theuni/cctools-port/archive $(package)_file_name=$($(package)_version).tar.gz -$(package)_sha256_hash=e13c7129b9d496adf4d674156b4a1d72d8b936f29f377aae8f8b5e7b650cc305 +$(package)_sha256_hash=ef107e6ab1b3994cb22e14f4f5c59ea0c0b5a988e6b21d42ed9616b018bbcbf9 $(package)_build_subdir=cctools -$(package)_dependencies=native_libuuid native_openssl $(package)_clang_version=3.3 $(package)_clang_download_path=http://llvm.org/releases/$($(package)_clang_version) $(package)_clang_download_file=clang+llvm-$($(package)_clang_version)-amd64-Ubuntu-12.04.2.tar.gz @@ -25,8 +24,10 @@ define $(package)_extract_cmds endef define $(package)_set_vars -$(package)_config_opts=--target=$(host) CC=toolchain/clang CXX=toolchain/clang++ +$(package)_config_opts=--target=$(host) --disable-libuuid $(package)_ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib +$(package)_cc=$($(package)_extract_dir)/toolchain/bin/clang +$(package)_cxx=$($(package)_extract_dir)/toolchain/bin/clang++ endef define $(package)_preprocess_cmds @@ -34,12 +35,10 @@ define $(package)_preprocess_cmds endef define $(package)_config_cmds - export "PATH=$($(package)_extract_dir)/toolchain/bin:$(PATH)" && \ $($(package)_autoconf) endef define $(package)_build_cmds - export "PATH=$($(package)_extract_dir)/toolchain/bin:$(PATH)" && \ $(MAKE) endef diff --git a/depends/packages/native_libuuid.mk b/depends/packages/native_libuuid.mk deleted file mode 100644 index 741eabfe8..000000000 --- a/depends/packages/native_libuuid.mk +++ /dev/null @@ -1,21 +0,0 @@ -package:=native_libuuid -$(package)_version=1.41.14 -$(package)_download_path=http://downloads.sourceforge.net/e2fsprogs -$(package)_file_name=e2fsprogs-libs-$($(package)_version).tar.gz -$(package)_sha256_hash=dbc7a138a3218d9b80a0626b5b692d76934d6746d8cbb762751be33785d8d9f5 - -define $(package)_set_vars -$(package)_config_opts=--disable-elf-shlibs --disable-uuidd -endef - -define $(package)_config_cmds - $($(package)_autoconf) -endef - -define $(package)_build_cmds - $(MAKE) -C lib/uuid -endef - -define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) -C lib/uuid install -endef diff --git a/depends/packages/native_openssl.mk b/depends/packages/native_openssl.mk deleted file mode 100644 index 108c6e944..000000000 --- a/depends/packages/native_openssl.mk +++ /dev/null @@ -1,21 +0,0 @@ -package=native_openssl -$(package)_version=1.0.1h -$(package)_download_path=https://www.openssl.org/source -$(package)_file_name=openssl-$($(package)_version).tar.gz -$(package)_sha256_hash=9d1c8a9836aa63e2c6adb684186cbd4371c9e9dcc01d6e3bb447abf2d4d3d093 -define $(package)_set_vars -$(package)_build_config_opts= --prefix=$(build_prefix) no-zlib no-shared no-krb5C linux-generic64 -endef - -define $(package)_config_cmds - ./Configure $($(package)_build_config_opts) &&\ - sed -i "s|engines apps test|engines|" Makefile -endef - -define $(package)_build_cmds - $(MAKE) -j1 -endef - -define $(package)_stage_cmds - $(MAKE) INSTALL_PREFIX=$($(package)_staging_dir) -j1 install_sw -endef diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index bbf53cc2d..08fd8a524 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -19,5 +19,5 @@ wallet_packages=bdb upnp_packages=miniupnpc ifneq ($(build_os),darwin) -darwin_native_packages=native_libuuid native_openssl native_cctools native_cdrkit native_libdmg-hfsplus +darwin_native_packages=native_cctools native_cdrkit native_libdmg-hfsplus endif From 70477a0bdf6eb6d123ce256f064bbd3bc356c82a Mon Sep 17 00:00:00 2001 From: Thomas Zander Date: Sun, 28 Dec 2014 22:39:53 +0100 Subject: [PATCH 75/88] On close of splashscreen interrupt verifyDB With the splashscreen being able to be closed it is possible to shutdown during the lengthy verifyDB method. (Takes about a minute on my machine). This change allows us to shutdown much sooner. Github-Pull: #5557 --- src/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index f02a6a12e..4fcb4f093 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3017,6 +3017,8 @@ bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth } else nGoodTransactions += block.vtx.size(); } + if (ShutdownRequested()) + return true; } if (pindexFailure) return error("VerifyDB() : *** coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", chainActive.Height() - pindexFailure->nHeight + 1, nGoodTransactions); From 7eeeac0ff59d4b822bc1f4fcd914572c957834ed Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 3 Jan 2015 15:43:01 +0000 Subject: [PATCH 76/88] Remove dead BitcoinUnits::id code and update assets-attribution for non-image unit selector --- doc/assets-attribution.md | 8 +++----- src/qt/bitcoinunits.cpp | 11 ----------- src/qt/bitcoinunits.h | 2 -- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/doc/assets-attribution.md b/doc/assets-attribution.md index 31fe4e5b7..c860cdc53 100644 --- a/doc/assets-attribution.md +++ b/doc/assets-attribution.md @@ -39,9 +39,7 @@ Jonas Schnelli src/qt/res/icons/connect[0-3].png, src/qt/res/icons/eye_minus.png, src/qt/res/icons/eye_plus.png, src/qt/res/icons/verify.png, src/qt/res/icons/tx_inout.png, src/qt/res/icons/tx_input.png, - src/qt/res/icons/unit_btc.png, src/qt/res/icons/unit_mbtc.png, - src/qt/res/icons/unit_ubtc.png, src/qt/res/src/verify.svg - src/qt/res/src/bitcoin.svg, src/qt/res/src/clock*.svg, - src/qt/res/src/connect*.svg, src/qt/res/src/mine.svg, - src/qt/res/src/qt.svg, src/qt/res/src/tx*.svg, + src/qt/res/src/verify.svg, src/qt/res/src/bitcoin.svg, + src/qt/res/src/clock*.svg, src/qt/res/src/connect*.svg, + src/qt/res/src/mine.svg, src/qt/res/src/qt.svg, src/qt/res/src/tx*.svg, src/qt/res/src/verify.svg, diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index 758fba705..425b45d91 100644 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -36,17 +36,6 @@ bool BitcoinUnits::valid(int unit) } } -QString BitcoinUnits::id(int unit) -{ - switch(unit) - { - case BTC: return QString("btc"); - case mBTC: return QString("mbtc"); - case uBTC: return QString("ubtc"); - default: return QString("???"); - } -} - QString BitcoinUnits::name(int unit) { switch(unit) diff --git a/src/qt/bitcoinunits.h b/src/qt/bitcoinunits.h index a01fcc8cf..1871c33a7 100644 --- a/src/qt/bitcoinunits.h +++ b/src/qt/bitcoinunits.h @@ -76,8 +76,6 @@ public: static QList availableUnits(); //! Is unit ID valid? static bool valid(int unit); - //! Identifier, e.g. for image names - static QString id(int unit); //! Short name static QString name(int unit); //! Longer description From 5d3064bc44e0b608a428e230f384bd3f846dedca Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 15 Dec 2014 10:05:51 +0100 Subject: [PATCH 77/88] Temporarily add SetNull/IsNull/GetCheapHash to base_uint Also add a stub for arith_uint256 and its conversion functions, for now completely based on uint256. Eases step-by-step migration to blob. --- src/arith_uint256.h | 19 +++++++++++++++++++ src/uint256.h | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/arith_uint256.h diff --git a/src/arith_uint256.h b/src/arith_uint256.h new file mode 100644 index 000000000..3bb384ca8 --- /dev/null +++ b/src/arith_uint256.h @@ -0,0 +1,19 @@ +#ifndef BITCOIN_ARITH_UINT256_H +#define BITCOIN_ARITH_UINT256_H + +// Temporary for migration to opaque uint160/256 +#include "uint256.h" + +class arith_uint256 : public uint256 { +public: + arith_uint256() {} + arith_uint256(const base_uint<256>& b) : uint256(b) {} + arith_uint256(uint64_t b) : uint256(b) {} + explicit arith_uint256(const std::string& str) : uint256(str) {} + explicit arith_uint256(const std::vector& vch) : uint256(vch) {} +}; + +#define ArithToUint256(x) (x) +#define UintToArith256(x) (x) + +#endif // BITCOIN_UINT256_H diff --git a/src/uint256.h b/src/uint256.h index 139270ac4..8189b27cb 100644 --- a/src/uint256.h +++ b/src/uint256.h @@ -283,6 +283,23 @@ public: { s.read((char*)pn, sizeof(pn)); } + + // Temporary for migration to opaque uint160/256 + uint64_t GetCheapHash() const + { + return GetLow64(); + } + void SetNull() + { + memset(pn, 0, sizeof(pn)); + } + bool IsNull() const + { + for (int i = 0; i < WIDTH; i++) + if (pn[i] != 0) + return false; + return true; + } }; /** 160-bit unsigned big integer. */ @@ -330,4 +347,7 @@ public: uint64_t GetHash(const uint256& salt) const; }; +// Temporary for migration to opaque uint160/256 +inline uint256 uint256S(const std::string &x) { return uint256(x); } + #endif // BITCOIN_UINT256_H From 4f1524966a99c83db8c0c9f1ff74789253a1171e Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 15 Dec 2014 09:11:16 +0100 Subject: [PATCH 78/88] Replace direct use of 0 with SetNull and IsNull Replace x=0 with .SetNull(), x==0 with IsNull(), x!=0 with !IsNull(). Replace uses of uint256(0) with uint256(). --- src/bitcoin-tx.cpp | 4 ++-- src/chain.h | 8 ++++---- src/chainparams.cpp | 2 +- src/coins.cpp | 6 +++--- src/coins.h | 2 +- src/core_write.cpp | 2 +- src/key.cpp | 4 ++-- src/main.cpp | 22 +++++++++++----------- src/merkleblock.cpp | 18 +++++++++--------- src/net.cpp | 2 +- src/primitives/block.cpp | 4 ++-- src/primitives/block.h | 4 ++-- src/primitives/transaction.cpp | 2 +- src/primitives/transaction.h | 4 ++-- src/protocol.cpp | 2 +- src/pubkey.h | 2 +- src/rest.cpp | 2 +- src/rpcblockchain.cpp | 2 +- src/rpcrawtransaction.cpp | 6 +++--- src/rpcwallet.cpp | 4 ++-- src/script/standard.h | 2 +- src/test/pmt_tests.cpp | 6 +++--- src/test/script_P2SH_tests.cpp | 2 +- src/test/sigopcount_tests.cpp | 2 +- src/txdb.cpp | 6 +++--- src/wallet.cpp | 10 +++++----- src/wallet.h | 2 +- src/walletdb.cpp | 4 ++-- 28 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 05a85810e..f095551c4 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -315,7 +315,7 @@ static bool findSighashFlags(int& flags, const string& flagStr) uint256 ParseHashUO(map& o, string strKey) { if (!o.count(strKey)) - return 0; + return uint256(); return ParseHashUV(o[strKey], strKey); } @@ -485,7 +485,7 @@ static void MutateTx(CMutableTransaction& tx, const string& command, static void OutputTxJSON(const CTransaction& tx) { UniValue entry(UniValue::VOBJ); - TxToUniv(tx, 0, entry); + TxToUniv(tx, uint256(), entry); string jsonOutput = entry.write(4); fprintf(stdout, "%s\n", jsonOutput.c_str()); diff --git a/src/chain.h b/src/chain.h index b459c975f..d7741762c 100644 --- a/src/chain.h +++ b/src/chain.h @@ -150,14 +150,14 @@ public: nFile = 0; nDataPos = 0; nUndoPos = 0; - nChainWork = 0; + nChainWork = uint256(); nTx = 0; nChainTx = 0; nStatus = 0; nSequenceId = 0; nVersion = 0; - hashMerkleRoot = 0; + hashMerkleRoot = uint256(); nTime = 0; nBits = 0; nNonce = 0; @@ -282,11 +282,11 @@ public: uint256 hashPrev; CDiskBlockIndex() { - hashPrev = 0; + hashPrev = uint256(); } explicit CDiskBlockIndex(const CBlockIndex* pindex) : CBlockIndex(*pindex) { - hashPrev = (pprev ? pprev->GetBlockHash() : 0); + hashPrev = (pprev ? pprev->GetBlockHash() : uint256()); } ADD_SERIALIZE_METHODS; diff --git a/src/chainparams.cpp b/src/chainparams.cpp index f4bc6e1d7..7e76a0bfa 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -141,7 +141,7 @@ public: txNew.vout[0].nValue = 50 * COIN; txNew.vout[0].scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG; genesis.vtx.push_back(txNew); - genesis.hashPrevBlock = 0; + genesis.hashPrevBlock.SetNull(); genesis.hashMerkleRoot = genesis.BuildMerkleTree(); genesis.nVersion = 1; genesis.nTime = 1231006505; diff --git a/src/coins.cpp b/src/coins.cpp index f4599ff39..ef4f96fde 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -42,7 +42,7 @@ bool CCoins::Spend(uint32_t nPos) bool CCoinsView::GetCoins(const uint256 &txid, CCoins &coins) const { return false; } bool CCoinsView::HaveCoins(const uint256 &txid) const { return false; } -uint256 CCoinsView::GetBestBlock() const { return uint256(0); } +uint256 CCoinsView::GetBestBlock() const { return uint256(); } bool CCoinsView::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) { return false; } bool CCoinsView::GetStats(CCoinsStats &stats) const { return false; } @@ -57,7 +57,7 @@ bool CCoinsViewBacked::GetStats(CCoinsStats &stats) const { return base->GetStat CCoinsKeyHasher::CCoinsKeyHasher() : salt(GetRandHash()) {} -CCoinsViewCache::CCoinsViewCache(CCoinsView *baseIn) : CCoinsViewBacked(baseIn), hasModifier(false), hashBlock(0) { } +CCoinsViewCache::CCoinsViewCache(CCoinsView *baseIn) : CCoinsViewBacked(baseIn), hasModifier(false) { } CCoinsViewCache::~CCoinsViewCache() { @@ -128,7 +128,7 @@ bool CCoinsViewCache::HaveCoins(const uint256 &txid) const { } uint256 CCoinsViewCache::GetBestBlock() const { - if (hashBlock == uint256(0)) + if (hashBlock.IsNull()) hashBlock = base->GetBestBlock(); return hashBlock; } diff --git a/src/coins.h b/src/coins.h index 4f1afb00d..fe2eaa08e 100644 --- a/src/coins.h +++ b/src/coins.h @@ -297,7 +297,7 @@ struct CCoinsStats uint256 hashSerialized; CAmount nTotalAmount; - CCoinsStats() : nHeight(0), hashBlock(0), nTransactions(0), nTransactionOutputs(0), nSerializedSize(0), hashSerialized(0), nTotalAmount(0) {} + CCoinsStats() : nHeight(0), nTransactions(0), nTransactionOutputs(0), nSerializedSize(0), nTotalAmount(0) {} }; diff --git a/src/core_write.cpp b/src/core_write.cpp index b6fd7fe87..c3babec2f 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -127,7 +127,7 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry) } entry.pushKV("vout", vout); - if (hashBlock != 0) + if (!hashBlock.IsNull()) entry.pushKV("blockhash", hashBlock.GetHex()); entry.pushKV("hex", EncodeHexTx(tx)); // the hex-encoded transaction. used the name "hex" to be consistent with the verbose output of "getrawtransaction". diff --git a/src/key.cpp b/src/key.cpp index f09536fbb..50ccb0921 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -84,7 +84,7 @@ bool CKey::Sign(const uint256 &hash, std::vector& vchSig, uint32_ nonce += test_case; int nSigLen = 72; int ret = secp256k1_ecdsa_sign((const unsigned char*)&hash, (unsigned char*)&vchSig[0], &nSigLen, begin(), (unsigned char*)&nonce); - nonce = 0; + nonce = uint256(); if (ret) { vchSig.resize(nSigLen); return true; @@ -116,7 +116,7 @@ bool CKey::SignCompact(const uint256 &hash, std::vector& vchSig) uint256 nonce; prng.Generate((unsigned char*)&nonce, 32); int ret = secp256k1_ecdsa_sign_compact((const unsigned char*)&hash, &vchSig[1], begin(), (unsigned char*)&nonce, &rec); - nonce = 0; + nonce = uint256(); if (ret) break; } while(true); diff --git a/src/main.cpp b/src/main.cpp index 4fcb4f093..c392138ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -261,7 +261,7 @@ struct CNodeState { nMisbehavior = 0; fShouldBan = false; pindexBestKnownBlock = NULL; - hashLastUnknownBlock = uint256(0); + hashLastUnknownBlock.SetNull(); pindexLastCommonBlock = NULL; fSyncStarted = false; nStallingSince = 0; @@ -349,12 +349,12 @@ void ProcessBlockAvailability(NodeId nodeid) { CNodeState *state = State(nodeid); assert(state != NULL); - if (state->hashLastUnknownBlock != 0) { + if (!state->hashLastUnknownBlock.IsNull()) { BlockMap::iterator itOld = mapBlockIndex.find(state->hashLastUnknownBlock); if (itOld != mapBlockIndex.end() && itOld->second->nChainWork > 0) { if (state->pindexBestKnownBlock == NULL || itOld->second->nChainWork >= state->pindexBestKnownBlock->nChainWork) state->pindexBestKnownBlock = itOld->second; - state->hashLastUnknownBlock = uint256(0); + state->hashLastUnknownBlock.SetNull(); } } } @@ -1712,7 +1712,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin return false; // verify that the view's current state corresponds to the previous block - uint256 hashPrevBlock = pindex->pprev == NULL ? uint256(0) : pindex->pprev->GetBlockHash(); + uint256 hashPrevBlock = pindex->pprev == NULL ? uint256() : pindex->pprev->GetBlockHash(); assert(hashPrevBlock == view.GetBestBlock()); // Special case for the genesis block, skipping connection of its transactions @@ -2835,7 +2835,7 @@ boost::filesystem::path GetBlockPosFilename(const CDiskBlockPos &pos, const char CBlockIndex * InsertBlockIndex(uint256 hash) { - if (hash == 0) + if (hash.IsNull()) return NULL; // Return existing @@ -3369,7 +3369,7 @@ void static ProcessGetData(CNode* pfrom) vector vInv; vInv.push_back(CInv(MSG_BLOCK, chainActive.Tip()->GetBlockHash())); pfrom->PushMessage("inv", vInv); - pfrom->hashContinue = 0; + pfrom->hashContinue.SetNull(); } } } @@ -3604,7 +3604,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, // Use deterministic randomness to send to the same nodes for 24 hours // at a time so the setAddrKnowns of the chosen nodes prevent repeats static uint256 hashSalt; - if (hashSalt == 0) + if (hashSalt.IsNull()) hashSalt = GetRandHash(); uint64_t hashAddr = addr.GetHash(); uint256 hashRand = hashSalt ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60)); @@ -3738,7 +3738,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, if (pindex) pindex = chainActive.Next(pindex); int nLimit = 500; - LogPrint("net", "getblocks %d to %s limit %d from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop==uint256(0) ? "end" : hashStop.ToString(), nLimit, pfrom->id); + LogPrint("net", "getblocks %d to %s limit %d from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.IsNull() ? "end" : hashStop.ToString(), nLimit, pfrom->id); for (; pindex; pindex = chainActive.Next(pindex)) { if (pindex->GetBlockHash() == hashStop) @@ -3954,7 +3954,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, // TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue // from there instead. LogPrint("net", "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); - pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256(0)); + pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256()); } } @@ -4452,7 +4452,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) nSyncStarted++; CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader; LogPrint("net", "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->id, pto->nStartingHeight); - pto->PushMessage("getheaders", chainActive.GetLocator(pindexStart), uint256(0)); + pto->PushMessage("getheaders", chainActive.GetLocator(pindexStart), uint256()); } } @@ -4483,7 +4483,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) { // 1/4 of tx invs blast to all immediately static uint256 hashSalt; - if (hashSalt == 0) + if (hashSalt.IsNull()) hashSalt = GetRandHash(); uint256 hashRand = inv.hash ^ hashSalt; hashRand = Hash(BEGIN(hashRand), END(hashRand)); diff --git a/src/merkleblock.cpp b/src/merkleblock.cpp index f9006d46d..b51b002b9 100644 --- a/src/merkleblock.cpp +++ b/src/merkleblock.cpp @@ -76,7 +76,7 @@ uint256 CPartialMerkleTree::TraverseAndExtract(int height, unsigned int pos, uns if (nBitsUsed >= vBits.size()) { // overflowed the bits array - failure fBad = true; - return 0; + return uint256(); } bool fParentOfMatch = vBits[nBitsUsed++]; if (height==0 || !fParentOfMatch) { @@ -84,7 +84,7 @@ uint256 CPartialMerkleTree::TraverseAndExtract(int height, unsigned int pos, uns if (nHashUsed >= vHash.size()) { // overflowed the hash array - failure fBad = true; - return 0; + return uint256(); } const uint256 &hash = vHash[nHashUsed++]; if (height==0 && fParentOfMatch) // in case of height 0, we have a matched txid @@ -128,16 +128,16 @@ uint256 CPartialMerkleTree::ExtractMatches(std::vector &vMatch) { vMatch.clear(); // An empty set will not work if (nTransactions == 0) - return 0; + return uint256(); // check for excessively high numbers of transactions if (nTransactions > MAX_BLOCK_SIZE / 60) // 60 is the lower bound for the size of a serialized CTransaction - return 0; + return uint256(); // there can never be more hashes provided than one for every txid if (vHash.size() > nTransactions) - return 0; + return uint256(); // there must be at least one bit per node in the partial tree, and at least one node per hash if (vBits.size() < vHash.size()) - return 0; + return uint256(); // calculate height of tree int nHeight = 0; while (CalcTreeWidth(nHeight) > 1) @@ -147,12 +147,12 @@ uint256 CPartialMerkleTree::ExtractMatches(std::vector &vMatch) { uint256 hashMerkleRoot = TraverseAndExtract(nHeight, 0, nBitsUsed, nHashUsed, vMatch); // verify that no problems occured during the tree traversal if (fBad) - return 0; + return uint256(); // verify that all bits were consumed (except for the padding caused by serializing it as a byte sequence) if ((nBitsUsed+7)/8 != (vBits.size()+7)/8) - return 0; + return uint256(); // verify that all hashes were consumed if (nHashUsed != vHash.size()) - return 0; + return uint256(); return hashMerkleRoot; } diff --git a/src/net.cpp b/src/net.cpp index 6401ecbf8..054846871 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1949,7 +1949,7 @@ CNode::CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn, bool fIn nRefCount = 0; nSendSize = 0; nSendOffset = 0; - hashContinue = 0; + hashContinue = uint256(); nStartingHeight = -1; fGetAddr = false; fRelayTxes = false; diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index 2b6a302ee..3b4a36039 100644 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -74,7 +74,7 @@ uint256 CBlock::BuildMerkleTree(bool* fMutated) const if (fMutated) { *fMutated = mutated; } - return (vMerkleTree.empty() ? 0 : vMerkleTree.back()); + return (vMerkleTree.empty() ? uint256() : vMerkleTree.back()); } std::vector CBlock::GetMerkleBranch(int nIndex) const @@ -96,7 +96,7 @@ std::vector CBlock::GetMerkleBranch(int nIndex) const uint256 CBlock::CheckMerkleBranch(uint256 hash, const std::vector& vMerkleBranch, int nIndex) { if (nIndex == -1) - return 0; + return uint256(); for (std::vector::const_iterator it(vMerkleBranch.begin()); it != vMerkleBranch.end(); ++it) { if (nIndex & 1) diff --git a/src/primitives/block.h b/src/primitives/block.h index 1449882bd..53fcd104a 100644 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -53,8 +53,8 @@ public: void SetNull() { nVersion = CBlockHeader::CURRENT_VERSION; - hashPrevBlock = 0; - hashMerkleRoot = 0; + hashPrevBlock.SetNull(); + hashMerkleRoot.SetNull(); nTime = 0; nBits = 0; nNonce = 0; diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index 230aedd89..848d4d3e6 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -72,7 +72,7 @@ void CTransaction::UpdateHash() const *const_cast(&hash) = SerializeHash(*this); } -CTransaction::CTransaction() : hash(0), nVersion(CTransaction::CURRENT_VERSION), vin(), vout(), nLockTime(0) { } +CTransaction::CTransaction() : nVersion(CTransaction::CURRENT_VERSION), vin(), vout(), nLockTime(0) { } CTransaction::CTransaction(const CMutableTransaction &tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime) { UpdateHash(); diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index da3501230..1b5a47e0d 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -28,8 +28,8 @@ public: READWRITE(FLATDATA(*this)); } - void SetNull() { hash = 0; n = (uint32_t) -1; } - bool IsNull() const { return (hash == 0 && n == (uint32_t) -1); } + void SetNull() { hash.SetNull(); n = (uint32_t) -1; } + bool IsNull() const { return (hash.IsNull() && n == (uint32_t) -1); } friend bool operator<(const COutPoint& a, const COutPoint& b) { diff --git a/src/protocol.cpp b/src/protocol.cpp index 71c6bd152..2dfded43b 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -96,7 +96,7 @@ void CAddress::Init() CInv::CInv() { type = 0; - hash = 0; + hash.SetNull(); } CInv::CInv(int typeIn, const uint256& hashIn) diff --git a/src/pubkey.h b/src/pubkey.h index 69b73a4e1..b0768d4f4 100644 --- a/src/pubkey.h +++ b/src/pubkey.h @@ -27,7 +27,7 @@ class CKeyID : public uint160 { public: - CKeyID() : uint160(0) {} + CKeyID() : uint160() {} CKeyID(const uint160& in) : uint160(in) {} }; diff --git a/src/rest.cpp b/src/rest.cpp index 4702f0d70..1ee1d5291 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -240,7 +240,7 @@ static bool rest_tx(AcceptedConnection* conn, throw RESTERR(HTTP_BAD_REQUEST, "Invalid hash: " + hashStr); CTransaction tx; - uint256 hashBlock = 0; + uint256 hashBlock = uint256(); if (!GetTransaction(hash, tx, hashBlock, true)) throw RESTERR(HTTP_NOT_FOUND, hashStr + " not found"); diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 71fb7c823..4705c07b8 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -70,7 +70,7 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDe if(txDetails) { Object objTx; - TxToJSON(tx, uint256(0), objTx); + TxToJSON(tx, uint256(), objTx); txs.push_back(objTx); } else diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index b87a8baac..10dc2ca93 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -89,7 +89,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) } entry.push_back(Pair("vout", vout)); - if (hashBlock != 0) { + if (!hashBlock.IsNull()) { entry.push_back(Pair("blockhash", hashBlock.GetHex())); BlockMap::iterator mi = mapBlockIndex.find(hashBlock); if (mi != mapBlockIndex.end() && (*mi).second) { @@ -178,7 +178,7 @@ Value getrawtransaction(const Array& params, bool fHelp) fVerbose = (params[1].get_int() != 0); CTransaction tx; - uint256 hashBlock = 0; + uint256 hashBlock; if (!GetTransaction(hash, tx, hashBlock, true)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "No information available about transaction"); @@ -438,7 +438,7 @@ Value decoderawtransaction(const Array& params, bool fHelp) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); Object result; - TxToJSON(tx, 0, result); + TxToJSON(tx, uint256(), result); return result; } diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index af7e8221c..21f6bcae3 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1477,7 +1477,7 @@ Value listsinceblock(const Array& params, bool fHelp) if (params.size() > 0) { - uint256 blockId = 0; + uint256 blockId; blockId.SetHex(params[0].get_str()); BlockMap::iterator it = mapBlockIndex.find(blockId); @@ -1510,7 +1510,7 @@ Value listsinceblock(const Array& params, bool fHelp) } CBlockIndex *pblockLast = chainActive[chainActive.Height() + 1 - target_confirms]; - uint256 lastblock = pblockLast ? pblockLast->GetBlockHash() : 0; + uint256 lastblock = pblockLast ? pblockLast->GetBlockHash() : uint256(); Object ret; ret.push_back(Pair("transactions", transactions)); diff --git a/src/script/standard.h b/src/script/standard.h index 1d29ef57a..dbeeace4d 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -20,7 +20,7 @@ class CScript; class CScriptID : public uint160 { public: - CScriptID() : uint160(0) {} + CScriptID() : uint160() {} CScriptID(const CScript& in); CScriptID(const uint160& in) : uint160(in) {} }; diff --git a/src/test/pmt_tests.cpp b/src/test/pmt_tests.cpp index 56e054166..af3d90f2e 100644 --- a/src/test/pmt_tests.cpp +++ b/src/test/pmt_tests.cpp @@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(pmt_test1) // calculate actual merkle root and height uint256 merkleRoot1 = block.BuildMerkleTree(); - std::vector vTxid(nTx, 0); + std::vector vTxid(nTx, uint256()); for (unsigned int j=0; j vTxid2; - BOOST_CHECK(tree.ExtractMatches(vTxid) == 0); + BOOST_CHECK(tree.ExtractMatches(vTxid).IsNull()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/script_P2SH_tests.cpp b/src/test/script_P2SH_tests.cpp index 63553556e..77e70022d 100644 --- a/src/test/script_P2SH_tests.cpp +++ b/src/test/script_P2SH_tests.cpp @@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(set) BOOST_AUTO_TEST_CASE(is) { // Test CScript::IsPayToScriptHash() - uint160 dummy(0); + uint160 dummy; CScript p2sh; p2sh << OP_HASH160 << ToByteVector(dummy) << OP_EQUAL; BOOST_CHECK(p2sh.IsPayToScriptHash()); diff --git a/src/test/sigopcount_tests.cpp b/src/test/sigopcount_tests.cpp index 332660149..3c8264d89 100644 --- a/src/test/sigopcount_tests.cpp +++ b/src/test/sigopcount_tests.cpp @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(GetSigOpCount) BOOST_CHECK_EQUAL(s1.GetSigOpCount(false), 0U); BOOST_CHECK_EQUAL(s1.GetSigOpCount(true), 0U); - uint160 dummy(0); + uint160 dummy; s1 << OP_1 << ToByteVector(dummy) << ToByteVector(dummy) << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK_EQUAL(s1.GetSigOpCount(true), 2U); s1 << OP_IF << OP_CHECKSIG << OP_ENDIF; diff --git a/src/txdb.cpp b/src/txdb.cpp index 5096ab19a..4467cdce7 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -39,7 +39,7 @@ bool CCoinsViewDB::HaveCoins(const uint256 &txid) const { uint256 CCoinsViewDB::GetBestBlock() const { uint256 hashBestChain; if (!db.Read('B', hashBestChain)) - return uint256(0); + return uint256(); return hashBestChain; } @@ -56,7 +56,7 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) { CCoinsMap::iterator itOld = it++; mapCoins.erase(itOld); } - if (hashBlock != uint256(0)) + if (!hashBlock.IsNull()) BatchWriteHashBestChain(batch, hashBlock); LogPrint("coindb", "Committing %u changed transactions (out of %u) to coin database...\n", (unsigned int)changed, (unsigned int)count); @@ -179,7 +179,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts() boost::scoped_ptr pcursor(NewIterator()); CDataStream ssKeySet(SER_DISK, CLIENT_VERSION); - ssKeySet << make_pair('b', uint256(0)); + ssKeySet << make_pair('b', uint256()); pcursor->Seek(ssKeySet.str()); // Load mapBlockIndex diff --git a/src/wallet.cpp b/src/wallet.cpp index 4920cb21f..6c5af3bdc 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -579,7 +579,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet) wtx.nOrderPos = IncOrderPosNext(); wtx.nTimeSmart = wtx.nTimeReceived; - if (wtxIn.hashBlock != 0) + if (!wtxIn.hashBlock.IsNull()) { if (mapBlockIndex.count(wtxIn.hashBlock)) { @@ -630,7 +630,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet) if (!fInsertedNew) { // Merge - if (wtxIn.hashBlock != 0 && wtxIn.hashBlock != wtx.hashBlock) + if (!wtxIn.hashBlock.IsNull() && wtxIn.hashBlock != wtx.hashBlock) { wtx.hashBlock = wtxIn.hashBlock; fUpdated = true; @@ -795,7 +795,7 @@ int CWalletTx::GetRequestCount() const if (IsCoinBase()) { // Generated block - if (hashBlock != 0) + if (!hashBlock.IsNull()) { map::const_iterator mi = pwallet->mapRequestCount.find(hashBlock); if (mi != pwallet->mapRequestCount.end()) @@ -811,7 +811,7 @@ int CWalletTx::GetRequestCount() const nRequests = (*mi).second; // How about the block it's in? - if (nRequests == 0 && hashBlock != 0) + if (nRequests == 0 && !hashBlock.IsNull()) { map::const_iterator mi = pwallet->mapRequestCount.find(hashBlock); if (mi != pwallet->mapRequestCount.end()) @@ -2317,7 +2317,7 @@ int CMerkleTx::SetMerkleBranch(const CBlock& block) int CMerkleTx::GetDepthInMainChainINTERNAL(const CBlockIndex* &pindexRet) const { - if (hashBlock == 0 || nIndex == -1) + if (hashBlock.IsNull() || nIndex == -1) return 0; AssertLockHeld(cs_main); diff --git a/src/wallet.h b/src/wallet.h index 4d95d0ae2..1d0dc97c6 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -519,7 +519,7 @@ public: void Init() { - hashBlock = 0; + hashBlock = uint256(); nIndex = -1; fMerkleVerified = false; } diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 4fd7eb512..0ec83e7b3 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -439,7 +439,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, } CKey key; CPrivKey pkey; - uint256 hash = 0; + uint256 hash; if (strType == "key") { @@ -464,7 +464,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, bool fSkipCheck = false; - if (hash != 0) + if (!hash.IsNull()) { // hash pubkey/privkey to accelerate wallet load std::vector vchKey; From 807658549c61d1fb0da3138ea0ca749ecba61723 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 15 Dec 2014 09:12:11 +0100 Subject: [PATCH 79/88] Replace GetLow64 with GetCheapHash --- src/addrman.cpp | 8 ++++---- src/main.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/addrman.cpp b/src/addrman.cpp index 1982db52a..1e08ae772 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -15,12 +15,12 @@ int CAddrInfo::GetTriedBucket(const std::vector& nKey) const CDataStream ss1(SER_GETHASH, 0); std::vector vchKey = GetKey(); ss1 << nKey << vchKey; - uint64_t hash1 = Hash(ss1.begin(), ss1.end()).GetLow64(); + uint64_t hash1 = Hash(ss1.begin(), ss1.end()).GetCheapHash(); CDataStream ss2(SER_GETHASH, 0); std::vector vchGroupKey = GetGroup(); ss2 << nKey << vchGroupKey << (hash1 % ADDRMAN_TRIED_BUCKETS_PER_GROUP); - uint64_t hash2 = Hash(ss2.begin(), ss2.end()).GetLow64(); + uint64_t hash2 = Hash(ss2.begin(), ss2.end()).GetCheapHash(); return hash2 % ADDRMAN_TRIED_BUCKET_COUNT; } @@ -30,11 +30,11 @@ int CAddrInfo::GetNewBucket(const std::vector& nKey, const CNetAd std::vector vchGroupKey = GetGroup(); std::vector vchSourceGroupKey = src.GetGroup(); ss1 << nKey << vchGroupKey << vchSourceGroupKey; - uint64_t hash1 = Hash(ss1.begin(), ss1.end()).GetLow64(); + uint64_t hash1 = Hash(ss1.begin(), ss1.end()).GetCheapHash(); CDataStream ss2(SER_GETHASH, 0); ss2 << nKey << vchSourceGroupKey << (hash1 % ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP); - uint64_t hash2 = Hash(ss2.begin(), ss2.end()).GetLow64(); + uint64_t hash2 = Hash(ss2.begin(), ss2.end()).GetCheapHash(); return hash2 % ADDRMAN_NEW_BUCKET_COUNT; } diff --git a/src/main.h b/src/main.h index 9049f5bb7..1e0011476 100644 --- a/src/main.h +++ b/src/main.h @@ -106,7 +106,7 @@ static const unsigned char REJECT_CHECKPOINT = 0x43; struct BlockHasher { - size_t operator()(const uint256& hash) const { return hash.GetLow64(); } + size_t operator()(const uint256& hash) const { return hash.GetCheapHash(); } }; extern CScript COINBASE_FLAGS; From 2eae3157f65197109d7745ea3926d086de812f7b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 15 Dec 2014 09:17:25 +0100 Subject: [PATCH 80/88] Replace uint256(1) with static constant SignatureHash and its test function SignatureHashOld return uint256(1) as a special error signaling value. Return a local static constant with the same value instead. --- src/script/interpreter.cpp | 5 +++-- src/test/sighash_tests.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 80a32e78f..7f8b371d6 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1030,16 +1030,17 @@ public: uint256 SignatureHash(const CScript& scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType) { + static const uint256 one("0000000000000000000000000000000000000000000000000000000000000001"); if (nIn >= txTo.vin.size()) { // nIn out of range - return 1; + return one; } // Check for invalid use of SIGHASH_SINGLE if ((nHashType & 0x1f) == SIGHASH_SINGLE) { if (nIn >= txTo.vout.size()) { // nOut out of range - return 1; + return one; } } diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index a9d2f9e8c..036f70ec0 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -24,10 +24,11 @@ extern Array read_json(const std::string& jsondata); // Old script.cpp SignatureHash function uint256 static SignatureHashOld(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType) { + static const uint256 one("0000000000000000000000000000000000000000000000000000000000000001"); if (nIn >= txTo.vin.size()) { printf("ERROR: SignatureHash() : nIn=%d out of range\n", nIn); - return 1; + return one; } CMutableTransaction txTmp(txTo); @@ -58,7 +59,7 @@ uint256 static SignatureHashOld(CScript scriptCode, const CTransaction& txTo, un if (nOut >= txTmp.vout.size()) { printf("ERROR: SignatureHash() : nOut=%d out of range\n", nOut); - return 1; + return one; } txTmp.vout.resize(nOut+1); for (unsigned int i = 0; i < nOut; i++) From 34cdc41128eee5da0be9c5e17b3c24b1f91a1957 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 16 Dec 2014 14:50:05 +0100 Subject: [PATCH 81/88] String conversions uint256 -> uint256S If uint256() constructor takes a string, uint256(0) will become dangerous when uint256 does not take integers anymore (it will go through std::string(const char*) making a NULL string, and the explicit keyword is no help). --- src/bitcoin-tx.cpp | 2 +- src/chainparams.cpp | 38 +++++++++++----------- src/main.cpp | 4 +-- src/qt/coincontroldialog.cpp | 8 ++--- src/rpcblockchain.cpp | 8 ++--- src/rpcwallet.cpp | 2 +- src/script/interpreter.cpp | 2 +- src/test/Checkpoints_tests.cpp | 4 +-- src/test/bloom_tests.cpp | 58 +++++++++++++++++----------------- src/test/sighash_tests.cpp | 2 +- src/test/transaction_tests.cpp | 4 +-- 11 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index f095551c4..e9dac9ffb 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -191,7 +191,7 @@ static void MutateTxAddInput(CMutableTransaction& tx, const string& strInput) string strTxid = strInput.substr(0, pos); if ((strTxid.size() != 64) || !IsHex(strTxid)) throw runtime_error("invalid TX input txid"); - uint256 txid(strTxid); + uint256 txid(uint256S(strTxid)); static const unsigned int minTxOutSz = 9; static const unsigned int maxVout = MAX_BLOCK_SIZE / minTxOutSz; diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 7e76a0bfa..844640061 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -54,19 +54,19 @@ static void convertSeed6(std::vector &vSeedsOut, const SeedSpec6 *data */ static Checkpoints::MapCheckpoints mapCheckpoints = boost::assign::map_list_of - ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) - ( 33333, uint256("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")) - ( 74000, uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) - (105000, uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) - (134444, uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")) - (168000, uint256("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763")) - (193000, uint256("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317")) - (210000, uint256("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e")) - (216116, uint256("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e")) - (225430, uint256("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932")) - (250000, uint256("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214")) - (279000, uint256("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40")) - (295000, uint256("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")) + ( 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) + ( 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")) + ( 74000, uint256S("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) + (105000, uint256S("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) + (134444, uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")) + (168000, uint256S("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763")) + (193000, uint256S("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317")) + (210000, uint256S("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e")) + (216116, uint256S("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e")) + (225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932")) + (250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214")) + (279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40")) + (295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")) ; static const Checkpoints::CCheckpointData data = { &mapCheckpoints, @@ -78,7 +78,7 @@ static const Checkpoints::CCheckpointData data = { static Checkpoints::MapCheckpoints mapCheckpointsTestnet = boost::assign::map_list_of - ( 546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")) + ( 546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")) ; static const Checkpoints::CCheckpointData dataTestnet = { &mapCheckpointsTestnet, @@ -89,7 +89,7 @@ static const Checkpoints::CCheckpointData dataTestnet = { static Checkpoints::MapCheckpoints mapCheckpointsRegtest = boost::assign::map_list_of - ( 0, uint256("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")) + ( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")) ; static const Checkpoints::CCheckpointData dataRegtest = { &mapCheckpointsRegtest, @@ -149,8 +149,8 @@ public: genesis.nNonce = 2083236893; hashGenesisBlock = genesis.GetHash(); - assert(hashGenesisBlock == uint256("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")); - assert(genesis.hashMerkleRoot == uint256("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")); + assert(hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")); + assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b")); vSeeds.push_back(CDNSSeedData("bitcoin.sipa.be", "seed.bitcoin.sipa.be")); vSeeds.push_back(CDNSSeedData("bluematt.me", "dnsseed.bluematt.me")); @@ -208,7 +208,7 @@ public: genesis.nTime = 1296688602; genesis.nNonce = 414098458; hashGenesisBlock = genesis.GetHash(); - assert(hashGenesisBlock == uint256("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943")); + assert(hashGenesisBlock == uint256S("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943")); vFixedSeeds.clear(); vSeeds.clear(); @@ -265,7 +265,7 @@ public: genesis.nNonce = 2; hashGenesisBlock = genesis.GetHash(); nDefaultPort = 18444; - assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")); + assert(hashGenesisBlock == uint256S("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")); vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds. vSeeds.clear(); //! Regtest mode doesn't have any DNS seeds. diff --git a/src/main.cpp b/src/main.cpp index c392138ff..77d2dcb20 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1738,8 +1738,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin // two in the chain that violate it. This prevents exploiting the issue against nodes in their // initial block download. bool fEnforceBIP30 = (!pindex->phashBlock) || // Enforce on CreateNewBlock invocations which don't have a hash. - !((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) || - (pindex->nHeight==91880 && pindex->GetBlockHash() == uint256("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721"))); + !((pindex->nHeight==91842 && pindex->GetBlockHash() == uint256S("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) || + (pindex->nHeight==91880 && pindex->GetBlockHash() == uint256S("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721"))); if (fEnforceBIP30) { BOOST_FOREACH(const CTransaction& tx, block.vtx) { const CCoins* coins = view.AccessCoins(tx.GetHash()); diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 60e7d62a7..8422f316f 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -213,7 +213,7 @@ void CoinControlDialog::showMenu(const QPoint &point) if (item->text(COLUMN_TXHASH).length() == 64) // transaction hash is 64 characters (this means its a child node, so its not a parent node in tree mode) { copyTransactionHashAction->setEnabled(true); - if (model->isLockedCoin(uint256(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt())) + if (model->isLockedCoin(uint256S(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt())) { lockAction->setEnabled(false); unlockAction->setEnabled(true); @@ -272,7 +272,7 @@ void CoinControlDialog::lockCoin() if (contextMenuItem->checkState(COLUMN_CHECKBOX) == Qt::Checked) contextMenuItem->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); - COutPoint outpt(uint256(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt()); + COutPoint outpt(uint256S(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt()); model->lockCoin(outpt); contextMenuItem->setDisabled(true); contextMenuItem->setIcon(COLUMN_CHECKBOX, SingleColorIcon(":/icons/lock_closed")); @@ -282,7 +282,7 @@ void CoinControlDialog::lockCoin() // context menu action: unlock coin void CoinControlDialog::unlockCoin() { - COutPoint outpt(uint256(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt()); + COutPoint outpt(uint256S(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt()); model->unlockCoin(outpt); contextMenuItem->setDisabled(false); contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon()); @@ -388,7 +388,7 @@ void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column) { if (column == COLUMN_CHECKBOX && item->text(COLUMN_TXHASH).length() == 64) // transaction hash is 64 characters (this means its a child node, so its not a parent node in tree mode) { - COutPoint outpt(uint256(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt()); + COutPoint outpt(uint256S(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt()); if (item->checkState(COLUMN_CHECKBOX) == Qt::Unchecked) coinControl->UnSelect(outpt); diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 4705c07b8..cfc559d19 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -278,7 +278,7 @@ Value getblock(const Array& params, bool fHelp) ); std::string strHash = params[0].get_str(); - uint256 hash(strHash); + uint256 hash(uint256S(strHash)); bool fVerbose = true; if (params.size() > 1) @@ -383,7 +383,7 @@ Value gettxout(const Array& params, bool fHelp) Object ret; std::string strHash = params[0].get_str(); - uint256 hash(strHash); + uint256 hash(uint256S(strHash)); int n = params[1].get_int(); bool fMempool = true; if (params.size() > 2) @@ -619,7 +619,7 @@ Value invalidateblock(const Array& params, bool fHelp) ); std::string strHash = params[0].get_str(); - uint256 hash(strHash); + uint256 hash(uint256S(strHash)); CValidationState state; { @@ -658,7 +658,7 @@ Value reconsiderblock(const Array& params, bool fHelp) ); std::string strHash = params[0].get_str(); - uint256 hash(strHash); + uint256 hash(uint256S(strHash)); CValidationState state; { diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 21f6bcae3..470a48e4f 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1902,7 +1902,7 @@ Value lockunspent(const Array& params, bool fHelp) if (nOutput < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive"); - COutPoint outpt(uint256(txid), nOutput); + COutPoint outpt(uint256S(txid), nOutput); if (fUnlock) pwalletMain->UnlockCoin(outpt); diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 7f8b371d6..e979f61f6 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1030,7 +1030,7 @@ public: uint256 SignatureHash(const CScript& scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType) { - static const uint256 one("0000000000000000000000000000000000000000000000000000000000000001"); + static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001")); if (nIn >= txTo.vin.size()) { // nIn out of range return one; diff --git a/src/test/Checkpoints_tests.cpp b/src/test/Checkpoints_tests.cpp index 4ea6a91d5..a9b6cd44a 100644 --- a/src/test/Checkpoints_tests.cpp +++ b/src/test/Checkpoints_tests.cpp @@ -18,8 +18,8 @@ BOOST_AUTO_TEST_SUITE(Checkpoints_tests) BOOST_AUTO_TEST_CASE(sanity) { - uint256 p11111 = uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"); - uint256 p134444 = uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"); + uint256 p11111 = uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"); + uint256 p134444 = uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"); BOOST_CHECK(Checkpoints::CheckBlock(11111, p11111)); BOOST_CHECK(Checkpoints::CheckBlock(134444, p134444)); diff --git a/src/test/bloom_tests.cpp b/src/test/bloom_tests.cpp index c32098efa..f9cbcb0d9 100644 --- a/src/test/bloom_tests.cpp +++ b/src/test/bloom_tests.cpp @@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(bloom_match) spendStream >> spendingTx; CBloomFilter filter(10, 0.000001, 0, BLOOM_UPDATE_ALL); - filter.insert(uint256("0xb4749f017444b051c44dfd2720e88f314ff94f3dd6d56d40ef65854fcd7fff6b")); + filter.insert(uint256S("0xb4749f017444b051c44dfd2720e88f314ff94f3dd6d56d40ef65854fcd7fff6b")); BOOST_CHECK_MESSAGE(filter.IsRelevantAndUpdate(tx), "Simple Bloom filter didn't match tx hash"); filter = CBloomFilter(10, 0.000001, 0, BLOOM_UPDATE_ALL); @@ -151,11 +151,11 @@ BOOST_AUTO_TEST_CASE(bloom_match) BOOST_CHECK_MESSAGE(filter.IsRelevantAndUpdate(tx), "Simple Bloom filter didn't match output address"); filter = CBloomFilter(10, 0.000001, 0, BLOOM_UPDATE_ALL); - filter.insert(COutPoint(uint256("0x90c122d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"), 0)); + filter.insert(COutPoint(uint256S("0x90c122d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"), 0)); BOOST_CHECK_MESSAGE(filter.IsRelevantAndUpdate(tx), "Simple Bloom filter didn't match COutPoint"); filter = CBloomFilter(10, 0.000001, 0, BLOOM_UPDATE_ALL); - COutPoint prevOutPoint(uint256("0x90c122d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"), 0); + COutPoint prevOutPoint(uint256S("0x90c122d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"), 0); { vector data(32 + sizeof(unsigned int)); memcpy(&data[0], prevOutPoint.hash.begin(), 32); @@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE(bloom_match) BOOST_CHECK_MESSAGE(filter.IsRelevantAndUpdate(tx), "Simple Bloom filter didn't match manually serialized COutPoint"); filter = CBloomFilter(10, 0.000001, 0, BLOOM_UPDATE_ALL); - filter.insert(uint256("00000009e784f32f62ef849763d4f45b98e07ba658647343b915ff832b110436")); + filter.insert(uint256S("00000009e784f32f62ef849763d4f45b98e07ba658647343b915ff832b110436")); BOOST_CHECK_MESSAGE(!filter.IsRelevantAndUpdate(tx), "Simple Bloom filter matched random tx hash"); filter = CBloomFilter(10, 0.000001, 0, BLOOM_UPDATE_ALL); @@ -173,11 +173,11 @@ BOOST_AUTO_TEST_CASE(bloom_match) BOOST_CHECK_MESSAGE(!filter.IsRelevantAndUpdate(tx), "Simple Bloom filter matched random address"); filter = CBloomFilter(10, 0.000001, 0, BLOOM_UPDATE_ALL); - filter.insert(COutPoint(uint256("0x90c122d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"), 1)); + filter.insert(COutPoint(uint256S("0x90c122d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"), 1)); BOOST_CHECK_MESSAGE(!filter.IsRelevantAndUpdate(tx), "Simple Bloom filter matched COutPoint for an output we didn't care about"); filter = CBloomFilter(10, 0.000001, 0, BLOOM_UPDATE_ALL); - filter.insert(COutPoint(uint256("0x000000d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"), 0)); + filter.insert(COutPoint(uint256S("0x000000d70786e899529d71dbeba91ba216982fb6ba58f3bdaab65e73b7e9260b"), 0)); BOOST_CHECK_MESSAGE(!filter.IsRelevantAndUpdate(tx), "Simple Bloom filter matched COutPoint for an output we didn't care about"); } @@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_1) CBloomFilter filter(10, 0.000001, 0, BLOOM_UPDATE_ALL); // Match the last transaction - filter.insert(uint256("0x74d681e0e03bafa802c8aa084379aa98d9fcd632ddc2ed9782b586ec87451f20")); + filter.insert(uint256S("0x74d681e0e03bafa802c8aa084379aa98d9fcd632ddc2ed9782b586ec87451f20")); CMerkleBlock merkleBlock(block, filter); BOOST_CHECK(merkleBlock.header.GetHash() == block.GetHash()); @@ -199,7 +199,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_1) BOOST_CHECK(merkleBlock.vMatchedTxn.size() == 1); pair pair = merkleBlock.vMatchedTxn[0]; - BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256("0x74d681e0e03bafa802c8aa084379aa98d9fcd632ddc2ed9782b586ec87451f20")); + BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256S("0x74d681e0e03bafa802c8aa084379aa98d9fcd632ddc2ed9782b586ec87451f20")); BOOST_CHECK(merkleBlock.vMatchedTxn[0].first == 8); vector vMatched; @@ -209,7 +209,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_1) BOOST_CHECK(vMatched[i] == merkleBlock.vMatchedTxn[i].second); // Also match the 8th transaction - filter.insert(uint256("0xdd1fd2a6fc16404faf339881a90adbde7f4f728691ac62e8f168809cdfae1053")); + filter.insert(uint256S("0xdd1fd2a6fc16404faf339881a90adbde7f4f728691ac62e8f168809cdfae1053")); merkleBlock = CMerkleBlock(block, filter); BOOST_CHECK(merkleBlock.header.GetHash() == block.GetHash()); @@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_1) BOOST_CHECK(merkleBlock.vMatchedTxn[1] == pair); - BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256("0xdd1fd2a6fc16404faf339881a90adbde7f4f728691ac62e8f168809cdfae1053")); + BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256S("0xdd1fd2a6fc16404faf339881a90adbde7f4f728691ac62e8f168809cdfae1053")); BOOST_CHECK(merkleBlock.vMatchedTxn[0].first == 7); BOOST_CHECK(merkleBlock.txn.ExtractMatches(vMatched) == block.hashMerkleRoot); @@ -236,7 +236,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_2) CBloomFilter filter(10, 0.000001, 0, BLOOM_UPDATE_ALL); // Match the first transaction - filter.insert(uint256("0xe980fe9f792d014e73b95203dc1335c5f9ce19ac537a419e6df5b47aecb93b70")); + filter.insert(uint256S("0xe980fe9f792d014e73b95203dc1335c5f9ce19ac537a419e6df5b47aecb93b70")); CMerkleBlock merkleBlock(block, filter); BOOST_CHECK(merkleBlock.header.GetHash() == block.GetHash()); @@ -244,7 +244,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_2) BOOST_CHECK(merkleBlock.vMatchedTxn.size() == 1); pair pair = merkleBlock.vMatchedTxn[0]; - BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256("0xe980fe9f792d014e73b95203dc1335c5f9ce19ac537a419e6df5b47aecb93b70")); + BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256S("0xe980fe9f792d014e73b95203dc1335c5f9ce19ac537a419e6df5b47aecb93b70")); BOOST_CHECK(merkleBlock.vMatchedTxn[0].first == 0); vector vMatched; @@ -265,13 +265,13 @@ BOOST_AUTO_TEST_CASE(merkle_block_2) BOOST_CHECK(pair == merkleBlock.vMatchedTxn[0]); - BOOST_CHECK(merkleBlock.vMatchedTxn[1].second == uint256("0x28204cad1d7fc1d199e8ef4fa22f182de6258a3eaafe1bbe56ebdcacd3069a5f")); + BOOST_CHECK(merkleBlock.vMatchedTxn[1].second == uint256S("0x28204cad1d7fc1d199e8ef4fa22f182de6258a3eaafe1bbe56ebdcacd3069a5f")); BOOST_CHECK(merkleBlock.vMatchedTxn[1].first == 1); - BOOST_CHECK(merkleBlock.vMatchedTxn[2].second == uint256("0x6b0f8a73a56c04b519f1883e8aafda643ba61a30bd1439969df21bea5f4e27e2")); + BOOST_CHECK(merkleBlock.vMatchedTxn[2].second == uint256S("0x6b0f8a73a56c04b519f1883e8aafda643ba61a30bd1439969df21bea5f4e27e2")); BOOST_CHECK(merkleBlock.vMatchedTxn[2].first == 2); - BOOST_CHECK(merkleBlock.vMatchedTxn[3].second == uint256("0x3c1d7e82342158e4109df2e0b6348b6e84e403d8b4046d7007663ace63cddb23")); + BOOST_CHECK(merkleBlock.vMatchedTxn[3].second == uint256S("0x3c1d7e82342158e4109df2e0b6348b6e84e403d8b4046d7007663ace63cddb23")); BOOST_CHECK(merkleBlock.vMatchedTxn[3].first == 3); BOOST_CHECK(merkleBlock.txn.ExtractMatches(vMatched) == block.hashMerkleRoot); @@ -290,7 +290,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_2_with_update_none) CBloomFilter filter(10, 0.000001, 0, BLOOM_UPDATE_NONE); // Match the first transaction - filter.insert(uint256("0xe980fe9f792d014e73b95203dc1335c5f9ce19ac537a419e6df5b47aecb93b70")); + filter.insert(uint256S("0xe980fe9f792d014e73b95203dc1335c5f9ce19ac537a419e6df5b47aecb93b70")); CMerkleBlock merkleBlock(block, filter); BOOST_CHECK(merkleBlock.header.GetHash() == block.GetHash()); @@ -298,7 +298,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_2_with_update_none) BOOST_CHECK(merkleBlock.vMatchedTxn.size() == 1); pair pair = merkleBlock.vMatchedTxn[0]; - BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256("0xe980fe9f792d014e73b95203dc1335c5f9ce19ac537a419e6df5b47aecb93b70")); + BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256S("0xe980fe9f792d014e73b95203dc1335c5f9ce19ac537a419e6df5b47aecb93b70")); BOOST_CHECK(merkleBlock.vMatchedTxn[0].first == 0); vector vMatched; @@ -319,10 +319,10 @@ BOOST_AUTO_TEST_CASE(merkle_block_2_with_update_none) BOOST_CHECK(pair == merkleBlock.vMatchedTxn[0]); - BOOST_CHECK(merkleBlock.vMatchedTxn[1].second == uint256("0x28204cad1d7fc1d199e8ef4fa22f182de6258a3eaafe1bbe56ebdcacd3069a5f")); + BOOST_CHECK(merkleBlock.vMatchedTxn[1].second == uint256S("0x28204cad1d7fc1d199e8ef4fa22f182de6258a3eaafe1bbe56ebdcacd3069a5f")); BOOST_CHECK(merkleBlock.vMatchedTxn[1].first == 1); - BOOST_CHECK(merkleBlock.vMatchedTxn[2].second == uint256("0x3c1d7e82342158e4109df2e0b6348b6e84e403d8b4046d7007663ace63cddb23")); + BOOST_CHECK(merkleBlock.vMatchedTxn[2].second == uint256S("0x3c1d7e82342158e4109df2e0b6348b6e84e403d8b4046d7007663ace63cddb23")); BOOST_CHECK(merkleBlock.vMatchedTxn[2].first == 3); BOOST_CHECK(merkleBlock.txn.ExtractMatches(vMatched) == block.hashMerkleRoot); @@ -341,14 +341,14 @@ BOOST_AUTO_TEST_CASE(merkle_block_3_and_serialize) CBloomFilter filter(10, 0.000001, 0, BLOOM_UPDATE_ALL); // Match the only transaction - filter.insert(uint256("0x63194f18be0af63f2c6bc9dc0f777cbefed3d9415c4af83f3ee3a3d669c00cb5")); + filter.insert(uint256S("0x63194f18be0af63f2c6bc9dc0f777cbefed3d9415c4af83f3ee3a3d669c00cb5")); CMerkleBlock merkleBlock(block, filter); BOOST_CHECK(merkleBlock.header.GetHash() == block.GetHash()); BOOST_CHECK(merkleBlock.vMatchedTxn.size() == 1); - BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256("0x63194f18be0af63f2c6bc9dc0f777cbefed3d9415c4af83f3ee3a3d669c00cb5")); + BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256S("0x63194f18be0af63f2c6bc9dc0f777cbefed3d9415c4af83f3ee3a3d669c00cb5")); BOOST_CHECK(merkleBlock.vMatchedTxn[0].first == 0); vector vMatched; @@ -379,7 +379,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_4) CBloomFilter filter(10, 0.000001, 0, BLOOM_UPDATE_ALL); // Match the last transaction - filter.insert(uint256("0x0a2a92f0bda4727d0a13eaddf4dd9ac6b5c61a1429e6b2b818f19b15df0ac154")); + filter.insert(uint256S("0x0a2a92f0bda4727d0a13eaddf4dd9ac6b5c61a1429e6b2b818f19b15df0ac154")); CMerkleBlock merkleBlock(block, filter); BOOST_CHECK(merkleBlock.header.GetHash() == block.GetHash()); @@ -387,7 +387,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_4) BOOST_CHECK(merkleBlock.vMatchedTxn.size() == 1); pair pair = merkleBlock.vMatchedTxn[0]; - BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256("0x0a2a92f0bda4727d0a13eaddf4dd9ac6b5c61a1429e6b2b818f19b15df0ac154")); + BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256S("0x0a2a92f0bda4727d0a13eaddf4dd9ac6b5c61a1429e6b2b818f19b15df0ac154")); BOOST_CHECK(merkleBlock.vMatchedTxn[0].first == 6); vector vMatched; @@ -397,13 +397,13 @@ BOOST_AUTO_TEST_CASE(merkle_block_4) BOOST_CHECK(vMatched[i] == merkleBlock.vMatchedTxn[i].second); // Also match the 4th transaction - filter.insert(uint256("0x02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041")); + filter.insert(uint256S("0x02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041")); merkleBlock = CMerkleBlock(block, filter); BOOST_CHECK(merkleBlock.header.GetHash() == block.GetHash()); BOOST_CHECK(merkleBlock.vMatchedTxn.size() == 2); - BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256("0x02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041")); + BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256S("0x02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041")); BOOST_CHECK(merkleBlock.vMatchedTxn[0].first == 3); BOOST_CHECK(merkleBlock.vMatchedTxn[1] == pair); @@ -432,9 +432,9 @@ BOOST_AUTO_TEST_CASE(merkle_block_4_test_p2pubkey_only) BOOST_CHECK(merkleBlock.header.GetHash() == block.GetHash()); // We should match the generation outpoint - BOOST_CHECK(filter.contains(COutPoint(uint256("0x147caa76786596590baa4e98f5d9f48b86c7765e489f7a6ff3360fe5c674360b"), 0))); + BOOST_CHECK(filter.contains(COutPoint(uint256S("0x147caa76786596590baa4e98f5d9f48b86c7765e489f7a6ff3360fe5c674360b"), 0))); // ... but not the 4th transaction's output (its not pay-2-pubkey) - BOOST_CHECK(!filter.contains(COutPoint(uint256("0x02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041"), 0))); + BOOST_CHECK(!filter.contains(COutPoint(uint256S("0x02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041"), 0))); } BOOST_AUTO_TEST_CASE(merkle_block_4_test_update_none) @@ -455,8 +455,8 @@ BOOST_AUTO_TEST_CASE(merkle_block_4_test_update_none) BOOST_CHECK(merkleBlock.header.GetHash() == block.GetHash()); // We shouldn't match any outpoints (UPDATE_NONE) - BOOST_CHECK(!filter.contains(COutPoint(uint256("0x147caa76786596590baa4e98f5d9f48b86c7765e489f7a6ff3360fe5c674360b"), 0))); - BOOST_CHECK(!filter.contains(COutPoint(uint256("0x02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041"), 0))); + BOOST_CHECK(!filter.contains(COutPoint(uint256S("0x147caa76786596590baa4e98f5d9f48b86c7765e489f7a6ff3360fe5c674360b"), 0))); + BOOST_CHECK(!filter.contains(COutPoint(uint256S("0x02981fa052f0481dbc5868f4fc2166035a10f27a03cfd2de67326471df5bc041"), 0))); } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index 036f70ec0..662f765a0 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -24,7 +24,7 @@ extern Array read_json(const std::string& jsondata); // Old script.cpp SignatureHash function uint256 static SignatureHashOld(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType) { - static const uint256 one("0000000000000000000000000000000000000000000000000000000000000001"); + static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001")); if (nIn >= txTo.vin.size()) { printf("ERROR: SignatureHash() : nIn=%d out of range\n", nIn); diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index 2594f89ac..efa2af917 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE(tx_valid) break; } - mapprevOutScriptPubKeys[COutPoint(uint256(vinput[0].get_str()), vinput[1].get_int())] = ParseScript(vinput[2].get_str()); + mapprevOutScriptPubKeys[COutPoint(uint256S(vinput[0].get_str()), vinput[1].get_int())] = ParseScript(vinput[2].get_str()); } if (!fValid) { @@ -194,7 +194,7 @@ BOOST_AUTO_TEST_CASE(tx_invalid) break; } - mapprevOutScriptPubKeys[COutPoint(uint256(vinput[0].get_str()), vinput[1].get_int())] = ParseScript(vinput[2].get_str()); + mapprevOutScriptPubKeys[COutPoint(uint256S(vinput[0].get_str()), vinput[1].get_int())] = ParseScript(vinput[2].get_str()); } if (!fValid) { From 734f85c4f0b40efd3f6c0367683c1bab1a2a7b19 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 16 Dec 2014 15:43:03 +0100 Subject: [PATCH 82/88] Use arith_uint256 where necessary Also add conversion from/to uint256 where needed. --- src/chain.h | 5 +++-- src/chainparams.cpp | 4 ++-- src/chainparams.h | 6 +++--- src/key.cpp | 3 ++- src/main.cpp | 9 +++++---- src/miner.cpp | 4 ++-- src/pow.cpp | 15 ++++++++------- src/pow.h | 3 ++- src/rpcmining.cpp | 4 ++-- src/test/pmt_tests.cpp | 12 +++++++++--- src/test/skiplist_tests.cpp | 12 ++++++------ 11 files changed, 44 insertions(+), 33 deletions(-) diff --git a/src/chain.h b/src/chain.h index d7741762c..004e87ab5 100644 --- a/src/chain.h +++ b/src/chain.h @@ -6,6 +6,7 @@ #ifndef BITCOIN_CHAIN_H #define BITCOIN_CHAIN_H +#include "arith_uint256.h" #include "primitives/block.h" #include "pow.h" #include "tinyformat.h" @@ -117,7 +118,7 @@ public: unsigned int nUndoPos; //! (memory only) Total amount of work (expected number of hashes) in the chain up to and including this block - uint256 nChainWork; + arith_uint256 nChainWork; //! Number of transactions in this block. //! Note: in a potential headers-first mode, this number cannot be relied upon @@ -150,7 +151,7 @@ public: nFile = 0; nDataPos = 0; nUndoPos = 0; - nChainWork = uint256(); + nChainWork = arith_uint256(); nTx = 0; nChainTx = 0; nStatus = 0; diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 844640061..3abc569dc 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -114,7 +114,7 @@ public: pchMessageStart[3] = 0xd9; vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284"); nDefaultPort = 8333; - bnProofOfWorkLimit = ~uint256(0) >> 32; + bnProofOfWorkLimit = ~arith_uint256(0) >> 32; nSubsidyHalvingInterval = 210000; nEnforceBlockUpgradeMajority = 750; nRejectBlockOutdatedMajority = 950; @@ -259,7 +259,7 @@ public: nMinerThreads = 1; nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks nTargetSpacing = 10 * 60; - bnProofOfWorkLimit = ~uint256(0) >> 1; + bnProofOfWorkLimit = ~arith_uint256(0) >> 1; genesis.nTime = 1296688602; genesis.nBits = 0x207fffff; genesis.nNonce = 2; diff --git a/src/chainparams.h b/src/chainparams.h index 60c7b4758..f1ef6a11f 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -10,7 +10,7 @@ #include "checkpoints.h" #include "primitives/block.h" #include "protocol.h" -#include "uint256.h" +#include "arith_uint256.h" #include @@ -45,7 +45,7 @@ public: const MessageStartChars& MessageStart() const { return pchMessageStart; } const std::vector& AlertKey() const { return vAlertPubKey; } int GetDefaultPort() const { return nDefaultPort; } - const uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; } + const arith_uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; } int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; } /** Used to check majorities for block version upgrade */ int EnforceBlockUpgradeMajority() const { return nEnforceBlockUpgradeMajority; } @@ -87,7 +87,7 @@ protected: //! Raw pub key bytes for the broadcast alert signing key. std::vector vAlertPubKey; int nDefaultPort; - uint256 bnProofOfWorkLimit; + arith_uint256 bnProofOfWorkLimit; int nSubsidyHalvingInterval; int nEnforceBlockUpgradeMajority; int nRejectBlockOutdatedMajority; diff --git a/src/key.cpp b/src/key.cpp index 50ccb0921..2235c271d 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -4,6 +4,7 @@ #include "key.h" +#include "arith_uint256.h" #include "crypto/hmac_sha512.h" #include "crypto/rfc6979_hmac_sha256.h" #include "eccryptoverify.h" @@ -81,7 +82,7 @@ bool CKey::Sign(const uint256 &hash, std::vector& vchSig, uint32_ do { uint256 nonce; prng.Generate((unsigned char*)&nonce, 32); - nonce += test_case; + nonce = ArithToUint256(UintToArith256(nonce) + test_case); int nSigLen = 72; int ret = secp256k1_ecdsa_sign((const unsigned char*)&hash, (unsigned char*)&vchSig[0], &nSigLen, begin(), (unsigned char*)&nonce); nonce = uint256(); diff --git a/src/main.cpp b/src/main.cpp index 77d2dcb20..d115f763f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,6 +5,7 @@ #include "main.h" +#include "arith_uint256.h" #include "addrman.h" #include "alert.h" #include "chainparams.h" @@ -3607,7 +3608,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, if (hashSalt.IsNull()) hashSalt = GetRandHash(); uint64_t hashAddr = addr.GetHash(); - uint256 hashRand = hashSalt ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60)); + uint256 hashRand = ArithToUint256(UintToArith256(hashSalt) ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60))); hashRand = Hash(BEGIN(hashRand), END(hashRand)); multimap mapMix; BOOST_FOREACH(CNode* pnode, vNodes) @@ -3616,7 +3617,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, continue; unsigned int nPointer; memcpy(&nPointer, &pnode, sizeof(nPointer)); - uint256 hashKey = hashRand ^ nPointer; + uint256 hashKey = ArithToUint256(UintToArith256(hashRand) ^ nPointer); hashKey = Hash(BEGIN(hashKey), END(hashKey)); mapMix.insert(make_pair(hashKey, pnode)); } @@ -4485,9 +4486,9 @@ bool SendMessages(CNode* pto, bool fSendTrickle) static uint256 hashSalt; if (hashSalt.IsNull()) hashSalt = GetRandHash(); - uint256 hashRand = inv.hash ^ hashSalt; + uint256 hashRand = ArithToUint256(UintToArith256(inv.hash) ^ UintToArith256(hashSalt)); hashRand = Hash(BEGIN(hashRand), END(hashRand)); - bool fTrickleWait = ((hashRand & 3) != 0); + bool fTrickleWait = ((UintToArith256(hashRand) & 3) != 0); if (fTrickleWait) { diff --git a/src/miner.cpp b/src/miner.cpp index 3bd2a9a41..87cb15833 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -481,7 +481,7 @@ void static BitcoinMiner(CWallet *pwallet) // Search // int64_t nStart = GetTime(); - uint256 hashTarget = uint256().SetCompact(pblock->nBits); + arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits); uint256 hash; uint32_t nNonce = 0; uint32_t nOldNonce = 0; @@ -493,7 +493,7 @@ void static BitcoinMiner(CWallet *pwallet) // Check if something found if (fFound) { - if (hash <= hashTarget) + if (UintToArith256(hash) <= hashTarget) { // Found a solution pblock->nNonce = nNonce; diff --git a/src/pow.cpp b/src/pow.cpp index e91e3d893..90bbff0a3 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -5,6 +5,7 @@ #include "pow.h" +#include "arith_uint256.h" #include "chain.h" #include "chainparams.h" #include "primitives/block.h" @@ -56,8 +57,8 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead nActualTimespan = Params().TargetTimespan()*4; // Retarget - uint256 bnNew; - uint256 bnOld; + arith_uint256 bnNew; + arith_uint256 bnOld; bnNew.SetCompact(pindexLast->nBits); bnOld = bnNew; bnNew *= nActualTimespan; @@ -79,7 +80,7 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits) { bool fNegative; bool fOverflow; - uint256 bnTarget; + arith_uint256 bnTarget; if (Params().SkipProofOfWorkCheck()) return true; @@ -91,22 +92,22 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits) return error("CheckProofOfWork() : nBits below minimum work"); // Check proof of work matches claimed amount - if (hash > bnTarget) + if (UintToArith256(hash) > bnTarget) return error("CheckProofOfWork() : hash doesn't match nBits"); return true; } -uint256 GetBlockProof(const CBlockIndex& block) +arith_uint256 GetBlockProof(const CBlockIndex& block) { - uint256 bnTarget; + arith_uint256 bnTarget; bool fNegative; bool fOverflow; bnTarget.SetCompact(block.nBits, &fNegative, &fOverflow); if (fNegative || fOverflow || bnTarget == 0) return 0; // We need to compute 2**256 / (bnTarget+1), but we can't represent 2**256 - // as it's too large for a uint256. However, as 2**256 is at least as large + // as it's too large for a arith_uint256. However, as 2**256 is at least as large // as bnTarget+1, it is equal to ((2**256 - bnTarget - 1) / (bnTarget+1)) + 1, // or ~bnTarget / (nTarget+1) + 1. return (~bnTarget / (bnTarget + 1)) + 1; diff --git a/src/pow.h b/src/pow.h index 89b219f80..3337a30a5 100644 --- a/src/pow.h +++ b/src/pow.h @@ -11,11 +11,12 @@ class CBlockHeader; class CBlockIndex; class uint256; +class arith_uint256; unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock); /** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */ bool CheckProofOfWork(uint256 hash, unsigned int nBits); -uint256 GetBlockProof(const CBlockIndex& block); +arith_uint256 GetBlockProof(const CBlockIndex& block); #endif // BITCOIN_POW_H diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 35760f9af..603e2935d 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -64,7 +64,7 @@ Value GetNetworkHashPS(int lookup, int height) { if (minTime == maxTime) return 0; - uint256 workDiff = pb->nChainWork - pb0->nChainWork; + arith_uint256 workDiff = pb->nChainWork - pb0->nChainWork; int64_t timeDiff = maxTime - minTime; return (int64_t)(workDiff.getdouble() / timeDiff); @@ -562,7 +562,7 @@ Value getblocktemplate(const Array& params, bool fHelp) Object aux; aux.push_back(Pair("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end()))); - uint256 hashTarget = uint256().SetCompact(pblock->nBits); + arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits); static Array aMutable; if (aMutable.empty()) diff --git a/src/test/pmt_tests.cpp b/src/test/pmt_tests.cpp index af3d90f2e..372cf3b30 100644 --- a/src/test/pmt_tests.cpp +++ b/src/test/pmt_tests.cpp @@ -6,6 +6,7 @@ #include "serialize.h" #include "streams.h" #include "uint256.h" +#include "arith_uint256.h" #include "version.h" #include @@ -22,8 +23,7 @@ public: void Damage() { unsigned int n = rand() % vHash.size(); int bit = rand() % 256; - uint256 &hash = vHash[n]; - hash ^= ((uint256)1 << bit); + *(vHash[n].begin() + (bit>>3)) ^= 1<<(bit&7); } }; @@ -107,7 +107,13 @@ BOOST_AUTO_TEST_CASE(pmt_test1) BOOST_AUTO_TEST_CASE(pmt_malleability) { - std::vector vTxid = boost::assign::list_of(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(9)(10); + std::vector vTxid = boost::assign::list_of + (ArithToUint256(1))(ArithToUint256(2)) + (ArithToUint256(3))(ArithToUint256(4)) + (ArithToUint256(5))(ArithToUint256(6)) + (ArithToUint256(7))(ArithToUint256(8)) + (ArithToUint256(9))(ArithToUint256(10)) + (ArithToUint256(9))(ArithToUint256(10)); std::vector vMatch = boost::assign::list_of(false)(false)(false)(false)(false)(false)(false)(false)(false)(true)(true)(false); CPartialMerkleTree tree(vTxid, vMatch); diff --git a/src/test/skiplist_tests.cpp b/src/test/skiplist_tests.cpp index 646c7e6ad..c75e21a2a 100644 --- a/src/test/skiplist_tests.cpp +++ b/src/test/skiplist_tests.cpp @@ -49,12 +49,12 @@ BOOST_AUTO_TEST_CASE(getlocator_test) std::vector vHashMain(100000); std::vector vBlocksMain(100000); for (unsigned int i=0; inHeight + 1); } @@ -62,12 +62,12 @@ BOOST_AUTO_TEST_CASE(getlocator_test) std::vector vHashSide(50000); std::vector vBlocksSide(50000); for (unsigned int i=0; inHeight + 1); } @@ -87,13 +87,13 @@ BOOST_AUTO_TEST_CASE(getlocator_test) // Entries 1 through 11 (inclusive) go back one step each. for (unsigned int i = 1; i < 12 && i < locator.vHave.size() - 1; i++) { - BOOST_CHECK_EQUAL(locator.vHave[i].GetLow64(), tip->nHeight - i); + BOOST_CHECK_EQUAL(UintToArith256(locator.vHave[i]).GetLow64(), tip->nHeight - i); } // The further ones (excluding the last one) go back with exponential steps. unsigned int dist = 2; for (unsigned int i = 12; i < locator.vHave.size() - 1; i++) { - BOOST_CHECK_EQUAL(locator.vHave[i - 1].GetLow64() - locator.vHave[i].GetLow64(), dist); + BOOST_CHECK_EQUAL(UintToArith256(locator.vHave[i - 1]).GetLow64() - UintToArith256(locator.vHave[i]).GetLow64(), dist); dist *= 2; } } From bfc6070342b9f43bcf125526e6a3c8ed34e29a71 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 15 Dec 2014 10:22:19 +0100 Subject: [PATCH 83/88] uint256->arith_uint256 blob256->uint256 Introduce new opaque implementation of `uint256`, move old "arithmetic" implementation to `arith_uint256. --- src/Makefile.am | 31 +- src/Makefile.test.include | 2 +- src/arith_uint256.cpp | 357 ++++++++++++++++++ src/arith_uint256.h | 351 ++++++++++++++++- ...t256_tests.cpp => arith_uint256_tests.cpp} | 331 ++++++++-------- src/uint256.cpp | 281 ++------------ src/uint256.h | 343 ++++------------- 7 files changed, 990 insertions(+), 706 deletions(-) create mode 100644 src/arith_uint256.cpp rename src/test/{uint256_tests.cpp => arith_uint256_tests.cpp} (75%) diff --git a/src/Makefile.am b/src/Makefile.am index d6ac6e127..bc2b1aff9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -74,11 +74,12 @@ BITCOIN_CORE_H = \ alert.h \ allocators.h \ amount.h \ + arith_uint256.h \ base58.h \ bloom.h \ chain.h \ - chainparams.h \ chainparamsbase.h \ + chainparams.h \ chainparamsseeds.h \ checkpoints.h \ checkqueue.h \ @@ -87,8 +88,6 @@ BITCOIN_CORE_H = \ coins.h \ compat.h \ compressor.h \ - primitives/block.h \ - primitives/transaction.h \ core_io.h \ crypter.h \ db.h \ @@ -108,6 +107,8 @@ BITCOIN_CORE_H = \ net.h \ noui.h \ pow.h \ + primitives/block.h \ + primitives/transaction.h \ protocol.h \ pubkey.h \ random.h \ @@ -115,11 +116,11 @@ BITCOIN_CORE_H = \ rpcprotocol.h \ rpcserver.h \ script/interpreter.h \ + script/script_error.h \ script/script.h \ script/sigcache.h \ script/sign.h \ script/standard.h \ - script/script_error.h \ serialize.h \ streams.h \ sync.h \ @@ -132,13 +133,13 @@ BITCOIN_CORE_H = \ uint256.h \ undo.h \ util.h \ - utilstrencodings.h \ utilmoneystr.h \ + utilstrencodings.h \ utiltime.h \ version.h \ + walletdb.h \ wallet.h \ wallet_ismine.h \ - walletdb.h \ compat/sanity.h JSON_H = \ @@ -261,18 +262,19 @@ libbitcoin_common_a_SOURCES = \ # backward-compatibility objects and their sanity checks are linked. libbitcoin_util_a_CPPFLAGS = $(BITCOIN_INCLUDES) libbitcoin_util_a_SOURCES = \ - compat/strnlen.cpp \ - compat/glibc_sanity.cpp \ - compat/glibcxx_sanity.cpp \ + arith_uint256.cpp \ chainparamsbase.cpp \ clientversion.cpp \ + compat/glibc_sanity.cpp \ + compat/glibcxx_sanity.cpp \ + compat/strnlen.cpp \ random.cpp \ rpcprotocol.cpp \ sync.cpp \ uint256.cpp \ util.cpp \ - utilstrencodings.cpp \ utilmoneystr.cpp \ + utilstrencodings.cpp \ utiltime.cpp \ $(BITCOIN_CORE_H) @@ -352,19 +354,20 @@ bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) if BUILD_BITCOIN_LIBS include_HEADERS = script/bitcoinconsensus.h libbitcoinconsensus_la_SOURCES = \ - primitives/transaction.cpp \ + arith_uint256.cpp \ crypto/hmac_sha512.cpp \ + crypto/ripemd160.cpp \ crypto/sha1.cpp \ crypto/sha256.cpp \ crypto/sha512.cpp \ - crypto/ripemd160.cpp \ eccryptoverify.cpp \ ecwrapper.cpp \ hash.cpp \ + primitives/transaction.cpp \ pubkey.cpp \ - script/script.cpp \ - script/interpreter.cpp \ script/bitcoinconsensus.cpp \ + script/interpreter.cpp \ + script/script.cpp \ uint256.cpp \ utilstrencodings.cpp diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 5f388e280..21d91acc6 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -34,6 +34,7 @@ RAW_TEST_FILES = test/data/alertTests.raw GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.raw.h) BITCOIN_TESTS =\ + test/arith_uint256_tests.cpp \ test/bignum.h \ test/alert_tests.cpp \ test/allocator_tests.cpp \ @@ -67,7 +68,6 @@ BITCOIN_TESTS =\ test/test_bitcoin.cpp \ test/timedata_tests.cpp \ test/transaction_tests.cpp \ - test/uint256_tests.cpp \ test/univalue_tests.cpp \ test/util_tests.cpp diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp new file mode 100644 index 000000000..0dba429a8 --- /dev/null +++ b/src/arith_uint256.cpp @@ -0,0 +1,357 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2014 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "arith_uint256.h" + +#include "utilstrencodings.h" + +#include +#include + +template +base_uint::base_uint(const std::string& str) +{ + SetHex(str); +} + +template +base_uint::base_uint(const std::vector& vch) +{ + if (vch.size() != sizeof(pn)) + throw uint_error("Converting vector of wrong size to base_uint"); + memcpy(pn, &vch[0], sizeof(pn)); +} + +template +base_uint& base_uint::operator<<=(unsigned int shift) +{ + base_uint a(*this); + for (int i = 0; i < WIDTH; i++) + pn[i] = 0; + int k = shift / 32; + shift = shift % 32; + for (int i = 0; i < WIDTH; i++) { + if (i + k + 1 < WIDTH && shift != 0) + pn[i + k + 1] |= (a.pn[i] >> (32 - shift)); + if (i + k < WIDTH) + pn[i + k] |= (a.pn[i] << shift); + } + return *this; +} + +template +base_uint& base_uint::operator>>=(unsigned int shift) +{ + base_uint a(*this); + for (int i = 0; i < WIDTH; i++) + pn[i] = 0; + int k = shift / 32; + shift = shift % 32; + for (int i = 0; i < WIDTH; i++) { + if (i - k - 1 >= 0 && shift != 0) + pn[i - k - 1] |= (a.pn[i] << (32 - shift)); + if (i - k >= 0) + pn[i - k] |= (a.pn[i] >> shift); + } + return *this; +} + +template +base_uint& base_uint::operator*=(uint32_t b32) +{ + uint64_t carry = 0; + for (int i = 0; i < WIDTH; i++) { + uint64_t n = carry + (uint64_t)b32 * pn[i]; + pn[i] = n & 0xffffffff; + carry = n >> 32; + } + return *this; +} + +template +base_uint& base_uint::operator*=(const base_uint& b) +{ + base_uint a = *this; + *this = 0; + for (int j = 0; j < WIDTH; j++) { + uint64_t carry = 0; + for (int i = 0; i + j < WIDTH; i++) { + uint64_t n = carry + pn[i + j] + (uint64_t)a.pn[j] * b.pn[i]; + pn[i + j] = n & 0xffffffff; + carry = n >> 32; + } + } + return *this; +} + +template +base_uint& base_uint::operator/=(const base_uint& b) +{ + base_uint div = b; // make a copy, so we can shift. + base_uint num = *this; // make a copy, so we can subtract. + *this = 0; // the quotient. + int num_bits = num.bits(); + int div_bits = div.bits(); + if (div_bits == 0) + throw uint_error("Division by zero"); + if (div_bits > num_bits) // the result is certainly 0. + return *this; + int shift = num_bits - div_bits; + div <<= shift; // shift so that div and num align. + while (shift >= 0) { + if (num >= div) { + num -= div; + pn[shift / 32] |= (1 << (shift & 31)); // set a bit of the result. + } + div >>= 1; // shift back. + shift--; + } + // num now contains the remainder of the division. + return *this; +} + +template +int base_uint::CompareTo(const base_uint& b) const +{ + for (int i = WIDTH - 1; i >= 0; i--) { + if (pn[i] < b.pn[i]) + return -1; + if (pn[i] > b.pn[i]) + return 1; + } + return 0; +} + +template +bool base_uint::EqualTo(uint64_t b) const +{ + for (int i = WIDTH - 1; i >= 2; i--) { + if (pn[i]) + return false; + } + if (pn[1] != (b >> 32)) + return false; + if (pn[0] != (b & 0xfffffffful)) + return false; + return true; +} + +template +double base_uint::getdouble() const +{ + double ret = 0.0; + double fact = 1.0; + for (int i = 0; i < WIDTH; i++) { + ret += fact * pn[i]; + fact *= 4294967296.0; + } + return ret; +} + +template +std::string base_uint::GetHex() const +{ + char psz[sizeof(pn) * 2 + 1]; + for (unsigned int i = 0; i < sizeof(pn); i++) + sprintf(psz + i * 2, "%02x", ((unsigned char*)pn)[sizeof(pn) - i - 1]); + return std::string(psz, psz + sizeof(pn) * 2); +} + +template +void base_uint::SetHex(const char* psz) +{ + memset(pn, 0, sizeof(pn)); + + // skip leading spaces + while (isspace(*psz)) + psz++; + + // skip 0x + if (psz[0] == '0' && tolower(psz[1]) == 'x') + psz += 2; + + // hex string to uint + const char* pbegin = psz; + while (::HexDigit(*psz) != -1) + psz++; + psz--; + unsigned char* p1 = (unsigned char*)pn; + unsigned char* pend = p1 + WIDTH * 4; + while (psz >= pbegin && p1 < pend) { + *p1 = ::HexDigit(*psz--); + if (psz >= pbegin) { + *p1 |= ((unsigned char)::HexDigit(*psz--) << 4); + p1++; + } + } +} + +template +void base_uint::SetHex(const std::string& str) +{ + SetHex(str.c_str()); +} + +template +std::string base_uint::ToString() const +{ + return (GetHex()); +} + +template +unsigned int base_uint::bits() const +{ + for (int pos = WIDTH - 1; pos >= 0; pos--) { + if (pn[pos]) { + for (int bits = 31; bits > 0; bits--) { + if (pn[pos] & 1 << bits) + return 32 * pos + bits + 1; + } + return 32 * pos + 1; + } + } + return 0; +} + +// Explicit instantiations for base_uint<160> +template base_uint<160>::base_uint(const std::string&); +template base_uint<160>::base_uint(const std::vector&); +template base_uint<160>& base_uint<160>::operator<<=(unsigned int); +template base_uint<160>& base_uint<160>::operator>>=(unsigned int); +template base_uint<160>& base_uint<160>::operator*=(uint32_t b32); +template base_uint<160>& base_uint<160>::operator*=(const base_uint<160>& b); +template base_uint<160>& base_uint<160>::operator/=(const base_uint<160>& b); +template int base_uint<160>::CompareTo(const base_uint<160>&) const; +template bool base_uint<160>::EqualTo(uint64_t) const; +template double base_uint<160>::getdouble() const; +template std::string base_uint<160>::GetHex() const; +template std::string base_uint<160>::ToString() const; +template void base_uint<160>::SetHex(const char*); +template void base_uint<160>::SetHex(const std::string&); +template unsigned int base_uint<160>::bits() const; + +// Explicit instantiations for base_uint<256> +template base_uint<256>::base_uint(const std::string&); +template base_uint<256>::base_uint(const std::vector&); +template base_uint<256>& base_uint<256>::operator<<=(unsigned int); +template base_uint<256>& base_uint<256>::operator>>=(unsigned int); +template base_uint<256>& base_uint<256>::operator*=(uint32_t b32); +template base_uint<256>& base_uint<256>::operator*=(const base_uint<256>& b); +template base_uint<256>& base_uint<256>::operator/=(const base_uint<256>& b); +template int base_uint<256>::CompareTo(const base_uint<256>&) const; +template bool base_uint<256>::EqualTo(uint64_t) const; +template double base_uint<256>::getdouble() const; +template std::string base_uint<256>::GetHex() const; +template std::string base_uint<256>::ToString() const; +template void base_uint<256>::SetHex(const char*); +template void base_uint<256>::SetHex(const std::string&); +template unsigned int base_uint<256>::bits() const; + +// This implementation directly uses shifts instead of going +// through an intermediate MPI representation. +arith_uint256& arith_uint256::SetCompact(uint32_t nCompact, bool* pfNegative, bool* pfOverflow) +{ + int nSize = nCompact >> 24; + uint32_t nWord = nCompact & 0x007fffff; + if (nSize <= 3) { + nWord >>= 8 * (3 - nSize); + *this = nWord; + } else { + *this = nWord; + *this <<= 8 * (nSize - 3); + } + if (pfNegative) + *pfNegative = nWord != 0 && (nCompact & 0x00800000) != 0; + if (pfOverflow) + *pfOverflow = nWord != 0 && ((nSize > 34) || + (nWord > 0xff && nSize > 33) || + (nWord > 0xffff && nSize > 32)); + return *this; +} + +uint32_t arith_uint256::GetCompact(bool fNegative) const +{ + int nSize = (bits() + 7) / 8; + uint32_t nCompact = 0; + if (nSize <= 3) { + nCompact = GetLow64() << 8 * (3 - nSize); + } else { + arith_uint256 bn = *this >> 8 * (nSize - 3); + nCompact = bn.GetLow64(); + } + // The 0x00800000 bit denotes the sign. + // Thus, if it is already set, divide the mantissa by 256 and increase the exponent. + if (nCompact & 0x00800000) { + nCompact >>= 8; + nSize++; + } + assert((nCompact & ~0x007fffff) == 0); + assert(nSize < 256); + nCompact |= nSize << 24; + nCompact |= (fNegative && (nCompact & 0x007fffff) ? 0x00800000 : 0); + return nCompact; +} + +static void inline HashMix(uint32_t& a, uint32_t& b, uint32_t& c) +{ + // Taken from lookup3, by Bob Jenkins. + a -= c; + a ^= ((c << 4) | (c >> 28)); + c += b; + b -= a; + b ^= ((a << 6) | (a >> 26)); + a += c; + c -= b; + c ^= ((b << 8) | (b >> 24)); + b += a; + a -= c; + a ^= ((c << 16) | (c >> 16)); + c += b; + b -= a; + b ^= ((a << 19) | (a >> 13)); + a += c; + c -= b; + c ^= ((b << 4) | (b >> 28)); + b += a; +} + +static void inline HashFinal(uint32_t& a, uint32_t& b, uint32_t& c) +{ + // Taken from lookup3, by Bob Jenkins. + c ^= b; + c -= ((b << 14) | (b >> 18)); + a ^= c; + a -= ((c << 11) | (c >> 21)); + b ^= a; + b -= ((a << 25) | (a >> 7)); + c ^= b; + c -= ((b << 16) | (b >> 16)); + a ^= c; + a -= ((c << 4) | (c >> 28)); + b ^= a; + b -= ((a << 14) | (a >> 18)); + c ^= b; + c -= ((b << 24) | (b >> 8)); +} + +uint64_t arith_uint256::GetHash(const arith_uint256& salt) const +{ + uint32_t a, b, c; + a = b = c = 0xdeadbeef + (WIDTH << 2); + + a += pn[0] ^ salt.pn[0]; + b += pn[1] ^ salt.pn[1]; + c += pn[2] ^ salt.pn[2]; + HashMix(a, b, c); + a += pn[3] ^ salt.pn[3]; + b += pn[4] ^ salt.pn[4]; + c += pn[5] ^ salt.pn[5]; + HashMix(a, b, c); + a += pn[6] ^ salt.pn[6]; + b += pn[7] ^ salt.pn[7]; + HashFinal(a, b, c); + + return ((((uint64_t)b) << 32) | c); +} diff --git a/src/arith_uint256.h b/src/arith_uint256.h index 3bb384ca8..9e32b124c 100644 --- a/src/arith_uint256.h +++ b/src/arith_uint256.h @@ -1,19 +1,350 @@ +// Copyright (c) 2009-2010 Satoshi Nakamoto +// Copyright (c) 2009-2014 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef BITCOIN_ARITH_UINT256_H #define BITCOIN_ARITH_UINT256_H -// Temporary for migration to opaque uint160/256 -#include "uint256.h" +#include +#include +#include +#include +#include +#include -class arith_uint256 : public uint256 { +class uint_error : public std::runtime_error { public: - arith_uint256() {} - arith_uint256(const base_uint<256>& b) : uint256(b) {} - arith_uint256(uint64_t b) : uint256(b) {} - explicit arith_uint256(const std::string& str) : uint256(str) {} - explicit arith_uint256(const std::vector& vch) : uint256(vch) {} + explicit uint_error(const std::string& str) : std::runtime_error(str) {} }; -#define ArithToUint256(x) (x) -#define UintToArith256(x) (x) +/** Template base class for unsigned big integers. */ +template +class base_uint +{ +protected: + enum { WIDTH=BITS/32 }; + uint32_t pn[WIDTH]; +public: + + base_uint() + { + for (int i = 0; i < WIDTH; i++) + pn[i] = 0; + } + + base_uint(const base_uint& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] = b.pn[i]; + } + + base_uint& operator=(const base_uint& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] = b.pn[i]; + return *this; + } + + base_uint(uint64_t b) + { + pn[0] = (unsigned int)b; + pn[1] = (unsigned int)(b >> 32); + for (int i = 2; i < WIDTH; i++) + pn[i] = 0; + } + + explicit base_uint(const std::string& str); + explicit base_uint(const std::vector& vch); + + bool operator!() const + { + for (int i = 0; i < WIDTH; i++) + if (pn[i] != 0) + return false; + return true; + } + + const base_uint operator~() const + { + base_uint ret; + for (int i = 0; i < WIDTH; i++) + ret.pn[i] = ~pn[i]; + return ret; + } + + const base_uint operator-() const + { + base_uint ret; + for (int i = 0; i < WIDTH; i++) + ret.pn[i] = ~pn[i]; + ret++; + return ret; + } + + double getdouble() const; + + base_uint& operator=(uint64_t b) + { + pn[0] = (unsigned int)b; + pn[1] = (unsigned int)(b >> 32); + for (int i = 2; i < WIDTH; i++) + pn[i] = 0; + return *this; + } + + base_uint& operator^=(const base_uint& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] ^= b.pn[i]; + return *this; + } + + base_uint& operator&=(const base_uint& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] &= b.pn[i]; + return *this; + } + + base_uint& operator|=(const base_uint& b) + { + for (int i = 0; i < WIDTH; i++) + pn[i] |= b.pn[i]; + return *this; + } + + base_uint& operator^=(uint64_t b) + { + pn[0] ^= (unsigned int)b; + pn[1] ^= (unsigned int)(b >> 32); + return *this; + } + + base_uint& operator|=(uint64_t b) + { + pn[0] |= (unsigned int)b; + pn[1] |= (unsigned int)(b >> 32); + return *this; + } + + base_uint& operator<<=(unsigned int shift); + base_uint& operator>>=(unsigned int shift); + + base_uint& operator+=(const base_uint& b) + { + uint64_t carry = 0; + for (int i = 0; i < WIDTH; i++) + { + uint64_t n = carry + pn[i] + b.pn[i]; + pn[i] = n & 0xffffffff; + carry = n >> 32; + } + return *this; + } + + base_uint& operator-=(const base_uint& b) + { + *this += -b; + return *this; + } + + base_uint& operator+=(uint64_t b64) + { + base_uint b; + b = b64; + *this += b; + return *this; + } + + base_uint& operator-=(uint64_t b64) + { + base_uint b; + b = b64; + *this += -b; + return *this; + } + + base_uint& operator*=(uint32_t b32); + base_uint& operator*=(const base_uint& b); + base_uint& operator/=(const base_uint& b); + + base_uint& operator++() + { + // prefix operator + int i = 0; + while (++pn[i] == 0 && i < WIDTH-1) + i++; + return *this; + } + + const base_uint operator++(int) + { + // postfix operator + const base_uint ret = *this; + ++(*this); + return ret; + } + + base_uint& operator--() + { + // prefix operator + int i = 0; + while (--pn[i] == (uint32_t)-1 && i < WIDTH-1) + i++; + return *this; + } + + const base_uint operator--(int) + { + // postfix operator + const base_uint ret = *this; + --(*this); + return ret; + } + + int CompareTo(const base_uint& b) const; + bool EqualTo(uint64_t b) const; + + friend inline const base_uint operator+(const base_uint& a, const base_uint& b) { return base_uint(a) += b; } + friend inline const base_uint operator-(const base_uint& a, const base_uint& b) { return base_uint(a) -= b; } + friend inline const base_uint operator*(const base_uint& a, const base_uint& b) { return base_uint(a) *= b; } + friend inline const base_uint operator/(const base_uint& a, const base_uint& b) { return base_uint(a) /= b; } + friend inline const base_uint operator|(const base_uint& a, const base_uint& b) { return base_uint(a) |= b; } + friend inline const base_uint operator&(const base_uint& a, const base_uint& b) { return base_uint(a) &= b; } + friend inline const base_uint operator^(const base_uint& a, const base_uint& b) { return base_uint(a) ^= b; } + friend inline const base_uint operator>>(const base_uint& a, int shift) { return base_uint(a) >>= shift; } + friend inline const base_uint operator<<(const base_uint& a, int shift) { return base_uint(a) <<= shift; } + friend inline const base_uint operator*(const base_uint& a, uint32_t b) { return base_uint(a) *= b; } + friend inline bool operator==(const base_uint& a, const base_uint& b) { return memcmp(a.pn, b.pn, sizeof(a.pn)) == 0; } + friend inline bool operator!=(const base_uint& a, const base_uint& b) { return memcmp(a.pn, b.pn, sizeof(a.pn)) != 0; } + friend inline bool operator>(const base_uint& a, const base_uint& b) { return a.CompareTo(b) > 0; } + friend inline bool operator<(const base_uint& a, const base_uint& b) { return a.CompareTo(b) < 0; } + friend inline bool operator>=(const base_uint& a, const base_uint& b) { return a.CompareTo(b) >= 0; } + friend inline bool operator<=(const base_uint& a, const base_uint& b) { return a.CompareTo(b) <= 0; } + friend inline bool operator==(const base_uint& a, uint64_t b) { return a.EqualTo(b); } + friend inline bool operator!=(const base_uint& a, uint64_t b) { return !a.EqualTo(b); } + + std::string GetHex() const; + void SetHex(const char* psz); + void SetHex(const std::string& str); + std::string ToString() const; + + unsigned char* begin() + { + return (unsigned char*)&pn[0]; + } + + unsigned char* end() + { + return (unsigned char*)&pn[WIDTH]; + } + + const unsigned char* begin() const + { + return (unsigned char*)&pn[0]; + } + + const unsigned char* end() const + { + return (unsigned char*)&pn[WIDTH]; + } + + unsigned int size() const + { + return sizeof(pn); + } + + /** + * Returns the position of the highest bit set plus one, or zero if the + * value is zero. + */ + unsigned int bits() const; + + uint64_t GetLow64() const + { + assert(WIDTH >= 2); + return pn[0] | (uint64_t)pn[1] << 32; + } + + unsigned int GetSerializeSize(int nType, int nVersion) const + { + return sizeof(pn); + } + + template + void Serialize(Stream& s, int nType, int nVersion) const + { + s.write((char*)pn, sizeof(pn)); + } + + template + void Unserialize(Stream& s, int nType, int nVersion) + { + s.read((char*)pn, sizeof(pn)); + } + + // Temporary for migration to blob160/256 + uint64_t GetCheapHash() const + { + return GetLow64(); + } + void SetNull() + { + memset(pn, 0, sizeof(pn)); + } + bool IsNull() const + { + for (int i = 0; i < WIDTH; i++) + if (pn[i] != 0) + return false; + return true; + } +}; + +/** 160-bit unsigned big integer. */ +class arith_uint160 : public base_uint<160> { +public: + arith_uint160() {} + arith_uint160(const base_uint<160>& b) : base_uint<160>(b) {} + arith_uint160(uint64_t b) : base_uint<160>(b) {} + explicit arith_uint160(const std::string& str) : base_uint<160>(str) {} + explicit arith_uint160(const std::vector& vch) : base_uint<160>(vch) {} +}; + +/** 256-bit unsigned big integer. */ +class arith_uint256 : public base_uint<256> { +public: + arith_uint256() {} + arith_uint256(const base_uint<256>& b) : base_uint<256>(b) {} + arith_uint256(uint64_t b) : base_uint<256>(b) {} + explicit arith_uint256(const std::string& str) : base_uint<256>(str) {} + explicit arith_uint256(const std::vector& vch) : base_uint<256>(vch) {} + + /** + * The "compact" format is a representation of a whole + * number N using an unsigned 32bit number similar to a + * floating point format. + * The most significant 8 bits are the unsigned exponent of base 256. + * This exponent can be thought of as "number of bytes of N". + * The lower 23 bits are the mantissa. + * Bit number 24 (0x800000) represents the sign of N. + * N = (-1^sign) * mantissa * 256^(exponent-3) + * + * Satoshi's original implementation used BN_bn2mpi() and BN_mpi2bn(). + * MPI uses the most significant bit of the first byte as sign. + * Thus 0x1234560000 is compact (0x05123456) + * and 0xc0de000000 is compact (0x0600c0de) + * + * Bitcoin only uses this "compact" format for encoding difficulty + * targets, which are unsigned 256bit quantities. Thus, all the + * complexities of the sign bit and using base 256 are probably an + * implementation accident. + */ + arith_uint256& SetCompact(uint32_t nCompact, bool *pfNegative = NULL, bool *pfOverflow = NULL); + uint32_t GetCompact(bool fNegative = false) const; + + uint64_t GetHash(const arith_uint256& salt) const; +}; #endif // BITCOIN_UINT256_H diff --git a/src/test/uint256_tests.cpp b/src/test/arith_uint256_tests.cpp similarity index 75% rename from src/test/uint256_tests.cpp rename to src/test/arith_uint256_tests.cpp index d05b28956..f5f71da61 100644 --- a/src/test/uint256_tests.cpp +++ b/src/test/arith_uint256_tests.cpp @@ -8,65 +8,65 @@ #include #include #include -#include "uint256.h" +#include "arith_uint256.h" #include #include "version.h" -BOOST_AUTO_TEST_SUITE(uint256_tests) - -const unsigned char R1Array[] = +BOOST_AUTO_TEST_SUITE(arith_uint256_tests) + +const unsigned char R1Array[] = "\x9c\x52\x4a\xdb\xcf\x56\x11\x12\x2b\x29\x12\x5e\x5d\x35\xd2\xd2" "\x22\x81\xaa\xb5\x33\xf0\x08\x32\xd5\x56\xb1\xf9\xea\xe5\x1d\x7d"; const char R1ArrayHex[] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c"; const double R1Ldouble = 0.4887374590559308955; // R1L equals roughly R1Ldouble * 2^256 -const double R1Sdouble = 0.7096329412477836074; -const uint256 R1L = uint256(std::vector(R1Array,R1Array+32)); -const uint160 R1S = uint160(std::vector(R1Array,R1Array+20)); +const double R1Sdouble = 0.7096329412477836074; +const arith_uint256 R1L = arith_uint256(std::vector(R1Array,R1Array+32)); +const arith_uint160 R1S = arith_uint160(std::vector(R1Array,R1Array+20)); const uint64_t R1LLow64 = 0x121156cfdb4a529cULL; -const unsigned char R2Array[] = +const unsigned char R2Array[] = "\x70\x32\x1d\x7c\x47\xa5\x6b\x40\x26\x7e\x0a\xc3\xa6\x9c\xb6\xbf" "\x13\x30\x47\xa3\x19\x2d\xda\x71\x49\x13\x72\xf0\xb4\xca\x81\xd7"; -const uint256 R2L = uint256(std::vector(R2Array,R2Array+32)); -const uint160 R2S = uint160(std::vector(R2Array,R2Array+20)); +const arith_uint256 R2L = arith_uint256(std::vector(R2Array,R2Array+32)); +const arith_uint160 R2S = arith_uint160(std::vector(R2Array,R2Array+20)); const char R1LplusR2L[] = "549FB09FEA236A1EA3E31D4D58F1B1369288D204211CA751527CFC175767850C"; -const unsigned char ZeroArray[] = +const unsigned char ZeroArray[] = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; -const uint256 ZeroL = uint256(std::vector(ZeroArray,ZeroArray+32)); -const uint160 ZeroS = uint160(std::vector(ZeroArray,ZeroArray+20)); - -const unsigned char OneArray[] = +const arith_uint256 ZeroL = arith_uint256(std::vector(ZeroArray,ZeroArray+32)); +const arith_uint160 ZeroS = arith_uint160(std::vector(ZeroArray,ZeroArray+20)); + +const unsigned char OneArray[] = "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; -const uint256 OneL = uint256(std::vector(OneArray,OneArray+32)); -const uint160 OneS = uint160(std::vector(OneArray,OneArray+20)); +const arith_uint256 OneL = arith_uint256(std::vector(OneArray,OneArray+32)); +const arith_uint160 OneS = arith_uint160(std::vector(OneArray,OneArray+20)); -const unsigned char MaxArray[] = +const unsigned char MaxArray[] = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"; -const uint256 MaxL = uint256(std::vector(MaxArray,MaxArray+32)); -const uint160 MaxS = uint160(std::vector(MaxArray,MaxArray+20)); +const arith_uint256 MaxL = arith_uint256(std::vector(MaxArray,MaxArray+32)); +const arith_uint160 MaxS = arith_uint160(std::vector(MaxArray,MaxArray+20)); -const uint256 HalfL = (OneL << 255); -const uint160 HalfS = (OneS << 159); +const arith_uint256 HalfL = (OneL << 255); +const arith_uint160 HalfS = (OneS << 159); std::string ArrayToString(const unsigned char A[], unsigned int width) { std::stringstream Stream; Stream << std::hex; - for (unsigned int i = 0; i < width; ++i) + for (unsigned int i = 0; i < width; ++i) { Stream<): + // constructor arith_uint256(vector): BOOST_CHECK(R1L.ToString() == ArrayToString(R1Array,32)); BOOST_CHECK(R1S.ToString() == ArrayToString(R1Array,20)); BOOST_CHECK(R2L.ToString() == ArrayToString(R2Array,32)); @@ -88,104 +88,104 @@ BOOST_AUTO_TEST_CASE( basics ) // constructors, equality, inequality BOOST_CHECK(~MaxL == ZeroL && ~MaxS == ZeroS); BOOST_CHECK( ((R1L ^ R2L) ^ R1L) == R2L); BOOST_CHECK( ((R1S ^ R2S) ^ R1S) == R2S); - - uint64_t Tmp64 = 0xc4dab720d9c7acaaULL; - for (unsigned int i = 0; i < 256; ++i) - { - BOOST_CHECK(ZeroL != (OneL << i)); - BOOST_CHECK((OneL << i) != ZeroL); - BOOST_CHECK(R1L != (R1L ^ (OneL << i))); - BOOST_CHECK(((uint256(Tmp64) ^ (OneL << i) ) != Tmp64 )); - } - BOOST_CHECK(ZeroL == (OneL << 256)); - for (unsigned int i = 0; i < 160; ++i) + uint64_t Tmp64 = 0xc4dab720d9c7acaaULL; + for (unsigned int i = 0; i < 256; ++i) { - BOOST_CHECK(ZeroS != (OneS << i)); - BOOST_CHECK((OneS << i) != ZeroS); - BOOST_CHECK(R1S != (R1S ^ (OneS << i))); - BOOST_CHECK(((uint160(Tmp64) ^ (OneS << i) ) != Tmp64 )); + BOOST_CHECK(ZeroL != (OneL << i)); + BOOST_CHECK((OneL << i) != ZeroL); + BOOST_CHECK(R1L != (R1L ^ (OneL << i))); + BOOST_CHECK(((arith_uint256(Tmp64) ^ (OneL << i) ) != Tmp64 )); } - BOOST_CHECK(ZeroS == (OneS << 256)); + BOOST_CHECK(ZeroL == (OneL << 256)); + + for (unsigned int i = 0; i < 160; ++i) + { + BOOST_CHECK(ZeroS != (OneS << i)); + BOOST_CHECK((OneS << i) != ZeroS); + BOOST_CHECK(R1S != (R1S ^ (OneS << i))); + BOOST_CHECK(((arith_uint160(Tmp64) ^ (OneS << i) ) != Tmp64 )); + } + BOOST_CHECK(ZeroS == (OneS << 256)); // String Constructor and Copy Constructor - BOOST_CHECK(uint256("0x"+R1L.ToString()) == R1L); - BOOST_CHECK(uint256("0x"+R2L.ToString()) == R2L); - BOOST_CHECK(uint256("0x"+ZeroL.ToString()) == ZeroL); - BOOST_CHECK(uint256("0x"+OneL.ToString()) == OneL); - BOOST_CHECK(uint256("0x"+MaxL.ToString()) == MaxL); - BOOST_CHECK(uint256(R1L.ToString()) == R1L); - BOOST_CHECK(uint256(" 0x"+R1L.ToString()+" ") == R1L); - BOOST_CHECK(uint256("") == ZeroL); - BOOST_CHECK(R1L == uint256(R1ArrayHex)); - BOOST_CHECK(uint256(R1L) == R1L); - BOOST_CHECK((uint256(R1L^R2L)^R2L) == R1L); - BOOST_CHECK(uint256(ZeroL) == ZeroL); - BOOST_CHECK(uint256(OneL) == OneL); + BOOST_CHECK(arith_uint256("0x"+R1L.ToString()) == R1L); + BOOST_CHECK(arith_uint256("0x"+R2L.ToString()) == R2L); + BOOST_CHECK(arith_uint256("0x"+ZeroL.ToString()) == ZeroL); + BOOST_CHECK(arith_uint256("0x"+OneL.ToString()) == OneL); + BOOST_CHECK(arith_uint256("0x"+MaxL.ToString()) == MaxL); + BOOST_CHECK(arith_uint256(R1L.ToString()) == R1L); + BOOST_CHECK(arith_uint256(" 0x"+R1L.ToString()+" ") == R1L); + BOOST_CHECK(arith_uint256("") == ZeroL); + BOOST_CHECK(R1L == arith_uint256(R1ArrayHex)); + BOOST_CHECK(arith_uint256(R1L) == R1L); + BOOST_CHECK((arith_uint256(R1L^R2L)^R2L) == R1L); + BOOST_CHECK(arith_uint256(ZeroL) == ZeroL); + BOOST_CHECK(arith_uint256(OneL) == OneL); - BOOST_CHECK(uint160("0x"+R1S.ToString()) == R1S); - BOOST_CHECK(uint160("0x"+R2S.ToString()) == R2S); - BOOST_CHECK(uint160("0x"+ZeroS.ToString()) == ZeroS); - BOOST_CHECK(uint160("0x"+OneS.ToString()) == OneS); - BOOST_CHECK(uint160("0x"+MaxS.ToString()) == MaxS); - BOOST_CHECK(uint160(R1S.ToString()) == R1S); - BOOST_CHECK(uint160(" 0x"+R1S.ToString()+" ") == R1S); - BOOST_CHECK(uint160("") == ZeroS); - BOOST_CHECK(R1S == uint160(R1ArrayHex)); + BOOST_CHECK(arith_uint160("0x"+R1S.ToString()) == R1S); + BOOST_CHECK(arith_uint160("0x"+R2S.ToString()) == R2S); + BOOST_CHECK(arith_uint160("0x"+ZeroS.ToString()) == ZeroS); + BOOST_CHECK(arith_uint160("0x"+OneS.ToString()) == OneS); + BOOST_CHECK(arith_uint160("0x"+MaxS.ToString()) == MaxS); + BOOST_CHECK(arith_uint160(R1S.ToString()) == R1S); + BOOST_CHECK(arith_uint160(" 0x"+R1S.ToString()+" ") == R1S); + BOOST_CHECK(arith_uint160("") == ZeroS); + BOOST_CHECK(R1S == arith_uint160(R1ArrayHex)); - BOOST_CHECK(uint160(R1S) == R1S); - BOOST_CHECK((uint160(R1S^R2S)^R2S) == R1S); - BOOST_CHECK(uint160(ZeroS) == ZeroS); - BOOST_CHECK(uint160(OneS) == OneS); + BOOST_CHECK(arith_uint160(R1S) == R1S); + BOOST_CHECK((arith_uint160(R1S^R2S)^R2S) == R1S); + BOOST_CHECK(arith_uint160(ZeroS) == ZeroS); + BOOST_CHECK(arith_uint160(OneS) == OneS); // uint64_t constructor - BOOST_CHECK( (R1L & uint256("0xffffffffffffffff")) == uint256(R1LLow64)); - BOOST_CHECK(ZeroL == uint256(0)); - BOOST_CHECK(OneL == uint256(1)); - BOOST_CHECK(uint256("0xffffffffffffffff") = uint256(0xffffffffffffffffULL)); - BOOST_CHECK( (R1S & uint160("0xffffffffffffffff")) == uint160(R1LLow64)); - BOOST_CHECK(ZeroS == uint160(0)); - BOOST_CHECK(OneS == uint160(1)); - BOOST_CHECK(uint160("0xffffffffffffffff") = uint160(0xffffffffffffffffULL)); + BOOST_CHECK( (R1L & arith_uint256("0xffffffffffffffff")) == arith_uint256(R1LLow64)); + BOOST_CHECK(ZeroL == arith_uint256(0)); + BOOST_CHECK(OneL == arith_uint256(1)); + BOOST_CHECK(arith_uint256("0xffffffffffffffff") = arith_uint256(0xffffffffffffffffULL)); + BOOST_CHECK( (R1S & arith_uint160("0xffffffffffffffff")) == arith_uint160(R1LLow64)); + BOOST_CHECK(ZeroS == arith_uint160(0)); + BOOST_CHECK(OneS == arith_uint160(1)); + BOOST_CHECK(arith_uint160("0xffffffffffffffff") = arith_uint160(0xffffffffffffffffULL)); // Assignment (from base_uint) - uint256 tmpL = ~ZeroL; BOOST_CHECK(tmpL == ~ZeroL); + arith_uint256 tmpL = ~ZeroL; BOOST_CHECK(tmpL == ~ZeroL); tmpL = ~OneL; BOOST_CHECK(tmpL == ~OneL); tmpL = ~R1L; BOOST_CHECK(tmpL == ~R1L); tmpL = ~R2L; BOOST_CHECK(tmpL == ~R2L); tmpL = ~MaxL; BOOST_CHECK(tmpL == ~MaxL); - uint160 tmpS = ~ZeroS; BOOST_CHECK(tmpS == ~ZeroS); + arith_uint160 tmpS = ~ZeroS; BOOST_CHECK(tmpS == ~ZeroS); tmpS = ~OneS; BOOST_CHECK(tmpS == ~OneS); tmpS = ~R1S; BOOST_CHECK(tmpS == ~R1S); tmpS = ~R2S; BOOST_CHECK(tmpS == ~R2S); tmpS = ~MaxS; BOOST_CHECK(tmpS == ~MaxS); // Wrong length must throw exception. - BOOST_CHECK_THROW(uint256(std::vector(OneArray,OneArray+31)), uint_error); - BOOST_CHECK_THROW(uint256(std::vector(OneArray,OneArray+20)), uint_error); - BOOST_CHECK_THROW(uint160(std::vector(OneArray,OneArray+32)), uint_error); - BOOST_CHECK_THROW(uint160(std::vector(OneArray,OneArray+19)), uint_error); + BOOST_CHECK_THROW(arith_uint256(std::vector(OneArray,OneArray+31)), uint_error); + BOOST_CHECK_THROW(arith_uint256(std::vector(OneArray,OneArray+20)), uint_error); + BOOST_CHECK_THROW(arith_uint160(std::vector(OneArray,OneArray+32)), uint_error); + BOOST_CHECK_THROW(arith_uint160(std::vector(OneArray,OneArray+19)), uint_error); } -void shiftArrayRight(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift) +void shiftArrayRight(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift) { - for (unsigned int T=0; T < arrayLength; ++T) + for (unsigned int T=0; T < arrayLength; ++T) { unsigned int F = (T+bitsToShift/8); - if (F < arrayLength) + if (F < arrayLength) to[T] = from[F] >> (bitsToShift%8); else to[T] = 0; - if (F + 1 < arrayLength) + if (F + 1 < arrayLength) to[T] |= from[(F+1)] << (8-bitsToShift%8); } } -void shiftArrayLeft(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift) +void shiftArrayLeft(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift) { - for (unsigned int T=0; T < arrayLength; ++T) + for (unsigned int T=0; T < arrayLength; ++T) { - if (T >= bitsToShift/8) + if (T >= bitsToShift/8) { unsigned int F = T-bitsToShift/8; to[T] = from[F] << (bitsToShift%8); @@ -200,39 +200,39 @@ void shiftArrayLeft(unsigned char* to, const unsigned char* from, unsigned int a BOOST_AUTO_TEST_CASE( shifts ) { // "<<" ">>" "<<=" ">>=" unsigned char TmpArray[32]; - uint256 TmpL; + arith_uint256 TmpL; for (unsigned int i = 0; i < 256; ++i) { shiftArrayLeft(TmpArray, OneArray, 32, i); - BOOST_CHECK(uint256(std::vector(TmpArray,TmpArray+32)) == (OneL << i)); + BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (OneL << i)); TmpL = OneL; TmpL <<= i; BOOST_CHECK(TmpL == (OneL << i)); BOOST_CHECK((HalfL >> (255-i)) == (OneL << i)); TmpL = HalfL; TmpL >>= (255-i); BOOST_CHECK(TmpL == (OneL << i)); - + shiftArrayLeft(TmpArray, R1Array, 32, i); - BOOST_CHECK(uint256(std::vector(TmpArray,TmpArray+32)) == (R1L << i)); + BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (R1L << i)); TmpL = R1L; TmpL <<= i; BOOST_CHECK(TmpL == (R1L << i)); shiftArrayRight(TmpArray, R1Array, 32, i); - BOOST_CHECK(uint256(std::vector(TmpArray,TmpArray+32)) == (R1L >> i)); + BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (R1L >> i)); TmpL = R1L; TmpL >>= i; BOOST_CHECK(TmpL == (R1L >> i)); shiftArrayLeft(TmpArray, MaxArray, 32, i); - BOOST_CHECK(uint256(std::vector(TmpArray,TmpArray+32)) == (MaxL << i)); + BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (MaxL << i)); TmpL = MaxL; TmpL <<= i; BOOST_CHECK(TmpL == (MaxL << i)); shiftArrayRight(TmpArray, MaxArray, 32, i); - BOOST_CHECK(uint256(std::vector(TmpArray,TmpArray+32)) == (MaxL >> i)); + BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (MaxL >> i)); TmpL = MaxL; TmpL >>= i; BOOST_CHECK(TmpL == (MaxL >> i)); } - uint256 c1L = uint256(0x0123456789abcdefULL); - uint256 c2L = c1L << 128; + arith_uint256 c1L = arith_uint256(0x0123456789abcdefULL); + arith_uint256 c2L = c1L << 128; for (unsigned int i = 0; i < 128; ++i) { BOOST_CHECK((c1L << i) == (c2L >> (128-i))); } @@ -240,39 +240,39 @@ BOOST_AUTO_TEST_CASE( shifts ) { // "<<" ">>" "<<=" ">>=" BOOST_CHECK((c1L << i) == (c2L << (i-128))); } - uint160 TmpS; + arith_uint160 TmpS; for (unsigned int i = 0; i < 160; ++i) { shiftArrayLeft(TmpArray, OneArray, 20, i); - BOOST_CHECK(uint160(std::vector(TmpArray,TmpArray+20)) == (OneS << i)); + BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (OneS << i)); TmpS = OneS; TmpS <<= i; BOOST_CHECK(TmpS == (OneS << i)); BOOST_CHECK((HalfS >> (159-i)) == (OneS << i)); TmpS = HalfS; TmpS >>= (159-i); BOOST_CHECK(TmpS == (OneS << i)); - + shiftArrayLeft(TmpArray, R1Array, 20, i); - BOOST_CHECK(uint160(std::vector(TmpArray,TmpArray+20)) == (R1S << i)); + BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (R1S << i)); TmpS = R1S; TmpS <<= i; BOOST_CHECK(TmpS == (R1S << i)); shiftArrayRight(TmpArray, R1Array, 20, i); - BOOST_CHECK(uint160(std::vector(TmpArray,TmpArray+20)) == (R1S >> i)); + BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (R1S >> i)); TmpS = R1S; TmpS >>= i; BOOST_CHECK(TmpS == (R1S >> i)); shiftArrayLeft(TmpArray, MaxArray, 20, i); - BOOST_CHECK(uint160(std::vector(TmpArray,TmpArray+20)) == (MaxS << i)); + BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (MaxS << i)); TmpS = MaxS; TmpS <<= i; BOOST_CHECK(TmpS == (MaxS << i)); shiftArrayRight(TmpArray, MaxArray, 20, i); - BOOST_CHECK(uint160(std::vector(TmpArray,TmpArray+20)) == (MaxS >> i)); + BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (MaxS >> i)); TmpS = MaxS; TmpS >>= i; BOOST_CHECK(TmpS == (MaxS >> i)); } - uint160 c1S = uint160(0x0123456789abcdefULL); - uint160 c2S = c1S << 80; + arith_uint160 c1S = arith_uint160(0x0123456789abcdefULL); + arith_uint160 c2S = c1S << 80; for (unsigned int i = 0; i < 80; ++i) { BOOST_CHECK((c1S << i) == (c2S >> (80-i))); } @@ -285,47 +285,47 @@ BOOST_AUTO_TEST_CASE( unaryOperators ) // ! ~ - { BOOST_CHECK(!ZeroL); BOOST_CHECK(!ZeroS); BOOST_CHECK(!(!OneL));BOOST_CHECK(!(!OneS)); - for (unsigned int i = 0; i < 256; ++i) + for (unsigned int i = 0; i < 256; ++i) BOOST_CHECK(!(!(OneL<(TmpArray,TmpArray+32)) == (~R1L)); - BOOST_CHECK(uint160(std::vector(TmpArray,TmpArray+20)) == (~R1S)); + for (unsigned int i = 0; i < 32; ++i) { TmpArray[i] = ~R1Array[i]; } + BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (~R1L)); + BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (~R1S)); BOOST_CHECK(-ZeroL == ZeroL); BOOST_CHECK(-ZeroS == ZeroS); BOOST_CHECK(-R1L == (~R1L)+1); BOOST_CHECK(-R1S == (~R1S)+1); - for (unsigned int i = 0; i < 256; ++i) + for (unsigned int i = 0; i < 256; ++i) BOOST_CHECK(-(OneL<(TmpArray,TmpArray+32)) == (_A_##L _OP_ _B_##L)); \ + BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (_A_##L _OP_ _B_##L)); \ for (unsigned int i = 0; i < 20; ++i) { TmpArray[i] = _A_##Array[i] _OP_ _B_##Array[i]; } \ - BOOST_CHECK(uint160(std::vector(TmpArray,TmpArray+20)) == (_A_##S _OP_ _B_##S)); + BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (_A_##S _OP_ _B_##S)); #define CHECKASSIGNMENTOPERATOR(_A_,_B_,_OP_) \ TmpL = _A_##L; TmpL _OP_##= _B_##L; BOOST_CHECK(TmpL == (_A_##L _OP_ _B_##L)); \ TmpS = _A_##S; TmpS _OP_##= _B_##S; BOOST_CHECK(TmpS == (_A_##S _OP_ _B_##S)); -BOOST_AUTO_TEST_CASE( bitwiseOperators ) +BOOST_AUTO_TEST_CASE( bitwiseOperators ) { unsigned char TmpArray[32]; - + CHECKBITWISEOPERATOR(R1,R2,|) CHECKBITWISEOPERATOR(R1,R2,^) CHECKBITWISEOPERATOR(R1,R2,&) @@ -342,8 +342,8 @@ BOOST_AUTO_TEST_CASE( bitwiseOperators ) CHECKBITWISEOPERATOR(Max,R1,^) CHECKBITWISEOPERATOR(Max,R1,&) - uint256 TmpL; - uint160 TmpS; + arith_uint256 TmpL; + arith_uint160 TmpS; CHECKASSIGNMENTOPERATOR(R1,R2,|) CHECKASSIGNMENTOPERATOR(R1,R2,^) CHECKASSIGNMENTOPERATOR(R1,R2,&) @@ -360,20 +360,20 @@ BOOST_AUTO_TEST_CASE( bitwiseOperators ) CHECKASSIGNMENTOPERATOR(Max,R1,^) CHECKASSIGNMENTOPERATOR(Max,R1,&) - uint64_t Tmp64 = 0xe1db685c9a0b47a2ULL; - TmpL = R1L; TmpL |= Tmp64; BOOST_CHECK(TmpL == (R1L | uint256(Tmp64))); - TmpS = R1S; TmpS |= Tmp64; BOOST_CHECK(TmpS == (R1S | uint160(Tmp64))); + uint64_t Tmp64 = 0xe1db685c9a0b47a2ULL; + TmpL = R1L; TmpL |= Tmp64; BOOST_CHECK(TmpL == (R1L | arith_uint256(Tmp64))); + TmpS = R1S; TmpS |= Tmp64; BOOST_CHECK(TmpS == (R1S | arith_uint160(Tmp64))); TmpL = R1L; TmpL |= 0; BOOST_CHECK(TmpL == R1L); TmpS = R1S; TmpS |= 0; BOOST_CHECK(TmpS == R1S); TmpL ^= 0; BOOST_CHECK(TmpL == R1L); TmpS ^= 0; BOOST_CHECK(TmpS == R1S); - TmpL ^= Tmp64; BOOST_CHECK(TmpL == (R1L ^ uint256(Tmp64))); - TmpS ^= Tmp64; BOOST_CHECK(TmpS == (R1S ^ uint160(Tmp64))); + TmpL ^= Tmp64; BOOST_CHECK(TmpL == (R1L ^ arith_uint256(Tmp64))); + TmpS ^= Tmp64; BOOST_CHECK(TmpS == (R1S ^ arith_uint160(Tmp64))); } BOOST_AUTO_TEST_CASE( comparison ) // <= >= < > { - uint256 TmpL; + arith_uint256 TmpL; for (unsigned int i = 0; i < 256; ++i) { TmpL= OneL<< i; BOOST_CHECK( TmpL >= ZeroL && TmpL > ZeroL && ZeroL < TmpL && ZeroL <= TmpL); @@ -383,7 +383,7 @@ BOOST_AUTO_TEST_CASE( comparison ) // <= >= < > BOOST_CHECK( R1L <= TmpL ); BOOST_CHECK( (R1L == TmpL) != (R1L < TmpL)); BOOST_CHECK( (TmpL == R1L) || !( R1L >= TmpL)); BOOST_CHECK(! (TmpL < R1L)); BOOST_CHECK(! (R1L > TmpL)); } - uint160 TmpS; + arith_uint160 TmpS; for (unsigned int i = 0; i < 160; ++i) { TmpS= OneS<< i; BOOST_CHECK( TmpS >= ZeroS && TmpS > ZeroS && ZeroS < TmpS && ZeroS <= TmpS); @@ -395,10 +395,10 @@ BOOST_AUTO_TEST_CASE( comparison ) // <= >= < > } } -BOOST_AUTO_TEST_CASE( plusMinus ) +BOOST_AUTO_TEST_CASE( plusMinus ) { - uint256 TmpL = 0; - BOOST_CHECK(R1L+R2L == uint256(R1LplusR2L)); + arith_uint256 TmpL = 0; + BOOST_CHECK(R1L+R2L == arith_uint256(R1LplusR2L)); TmpL += R1L; BOOST_CHECK(TmpL == R1L); TmpL += R2L; @@ -412,13 +412,13 @@ BOOST_AUTO_TEST_CASE( plusMinus ) BOOST_CHECK( TmpL == (HalfL >> (i-1)) ); TmpL = (MaxL>>i); TmpL += 1; BOOST_CHECK( TmpL == (HalfL >> (i-1)) ); - TmpL = (MaxL>>i); + TmpL = (MaxL>>i); BOOST_CHECK( TmpL++ == (MaxL>>i) ); BOOST_CHECK( TmpL == (HalfL >> (i-1))); } - BOOST_CHECK(uint256(0xbedc77e27940a7ULL) + 0xee8d836fce66fbULL == uint256(0xbedc77e27940a7ULL + 0xee8d836fce66fbULL)); - TmpL = uint256(0xbedc77e27940a7ULL); TmpL += 0xee8d836fce66fbULL; - BOOST_CHECK(TmpL == uint256(0xbedc77e27940a7ULL+0xee8d836fce66fbULL)); + BOOST_CHECK(arith_uint256(0xbedc77e27940a7ULL) + 0xee8d836fce66fbULL == arith_uint256(0xbedc77e27940a7ULL + 0xee8d836fce66fbULL)); + TmpL = arith_uint256(0xbedc77e27940a7ULL); TmpL += 0xee8d836fce66fbULL; + BOOST_CHECK(TmpL == arith_uint256(0xbedc77e27940a7ULL+0xee8d836fce66fbULL)); TmpL -= 0xee8d836fce66fbULL; BOOST_CHECK(TmpL == 0xbedc77e27940a7ULL); TmpL = R1L; BOOST_CHECK(++TmpL == R1L+1); @@ -439,8 +439,8 @@ BOOST_AUTO_TEST_CASE( plusMinus ) BOOST_CHECK(--TmpL == R1L-1); // 160-bit; copy-pasted - uint160 TmpS = 0; - BOOST_CHECK(R1S+R2S == uint160(R1LplusR2L)); + arith_uint160 TmpS = 0; + BOOST_CHECK(R1S+R2S == arith_uint160(R1LplusR2L)); TmpS += R1S; BOOST_CHECK(TmpS == R1S); TmpS += R2S; @@ -454,13 +454,13 @@ BOOST_AUTO_TEST_CASE( plusMinus ) BOOST_CHECK( TmpS == (HalfS >> (i-1)) ); TmpS = (MaxS>>i); TmpS += 1; BOOST_CHECK( TmpS == (HalfS >> (i-1)) ); - TmpS = (MaxS>>i); + TmpS = (MaxS>>i); BOOST_CHECK( TmpS++ == (MaxS>>i) ); BOOST_CHECK( TmpS == (HalfS >> (i-1))); } - BOOST_CHECK(uint160(0xbedc77e27940a7ULL) + 0xee8d836fce66fbULL == uint160(0xbedc77e27940a7ULL + 0xee8d836fce66fbULL)); - TmpS = uint160(0xbedc77e27940a7ULL); TmpS += 0xee8d836fce66fbULL; - BOOST_CHECK(TmpS == uint160(0xbedc77e27940a7ULL+0xee8d836fce66fbULL)); + BOOST_CHECK(arith_uint160(0xbedc77e27940a7ULL) + 0xee8d836fce66fbULL == arith_uint160(0xbedc77e27940a7ULL + 0xee8d836fce66fbULL)); + TmpS = arith_uint160(0xbedc77e27940a7ULL); TmpS += 0xee8d836fce66fbULL; + BOOST_CHECK(TmpS == arith_uint160(0xbedc77e27940a7ULL+0xee8d836fce66fbULL)); TmpS -= 0xee8d836fce66fbULL; BOOST_CHECK(TmpS == 0xbedc77e27940a7ULL); TmpS = R1S; BOOST_CHECK(++TmpS == R1S+1); @@ -521,8 +521,8 @@ BOOST_AUTO_TEST_CASE( multiply ) BOOST_AUTO_TEST_CASE( divide ) { - uint256 D1L("AD7133AC1977FA2B7"); - uint256 D2L("ECD751716"); + arith_uint256 D1L("AD7133AC1977FA2B7"); + arith_uint256 D2L("ECD751716"); BOOST_CHECK((R1L / D1L).ToString() == "00000000000000000b8ac01106981635d9ed112290f8895545a7654dde28fb3a"); BOOST_CHECK((R1L / D2L).ToString() == "000000000873ce8efec5b67150bad3aa8c5fcb70e947586153bf2cec7c37c57a"); BOOST_CHECK(R1L / OneL == R1L); @@ -536,8 +536,8 @@ BOOST_AUTO_TEST_CASE( divide ) BOOST_CHECK(MaxL / R2L == 1); BOOST_CHECK_THROW(R2L / ZeroL, uint_error); - uint160 D1S("D3C5EDCDEA54EB92679F0A4B4"); - uint160 D2S("13037"); + arith_uint160 D1S("D3C5EDCDEA54EB92679F0A4B4"); + arith_uint160 D2S("13037"); BOOST_CHECK((R1S / D1S).ToString() == "0000000000000000000000000db9af3beade6c02"); BOOST_CHECK((R1S / D2S).ToString() == "000098dfb6cc40ca592bf74366794f298ada205c"); BOOST_CHECK(R1S / OneS == R1S); @@ -553,7 +553,7 @@ BOOST_AUTO_TEST_CASE( divide ) } -bool almostEqual(double d1, double d2) +bool almostEqual(double d1, double d2) { return fabs(d1-d2) <= 4*fabs(d1)*std::numeric_limits::epsilon(); } @@ -564,7 +564,7 @@ BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 G BOOST_CHECK(R2L.GetHex() == R2L.ToString()); BOOST_CHECK(OneL.GetHex() == OneL.ToString()); BOOST_CHECK(MaxL.GetHex() == MaxL.ToString()); - uint256 TmpL(R1L); + arith_uint256 TmpL(R1L); BOOST_CHECK(TmpL == R1L); TmpL.SetHex(R2L.ToString()); BOOST_CHECK(TmpL == R2L); TmpL.SetHex(ZeroL.ToString()); BOOST_CHECK(TmpL == 0); @@ -612,7 +612,7 @@ BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 G BOOST_CHECK(R2S.GetHex() == R2S.ToString()); BOOST_CHECK(OneS.GetHex() == OneS.ToString()); BOOST_CHECK(MaxS.GetHex() == MaxS.ToString()); - uint160 TmpS(R1S); + arith_uint160 TmpS(R1S); BOOST_CHECK(TmpS == R1S); TmpS.SetHex(R2S.ToString()); BOOST_CHECK(TmpS == R2S); TmpS.SetHex(ZeroS.ToString()); BOOST_CHECK(TmpS == 0); @@ -634,7 +634,7 @@ BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 G BOOST_CHECK(MaxS.begin() + 20 == MaxS.end()); BOOST_CHECK(TmpS.begin() + 20 == TmpS.end()); BOOST_CHECK(R1S.GetLow64() == R1LLow64); - BOOST_CHECK(HalfS.GetLow64() ==0x0000000000000000ULL); + BOOST_CHECK(HalfS.GetLow64() ==0x0000000000000000ULL); BOOST_CHECK(OneS.GetLow64() ==0x0000000000000001ULL); BOOST_CHECK(R1S.GetSerializeSize(0,PROTOCOL_VERSION) == 20); BOOST_CHECK(ZeroS.GetSerializeSize(0,PROTOCOL_VERSION) == 20); @@ -654,17 +654,17 @@ BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 G TmpS.Unserialize(ss,0,PROTOCOL_VERSION); BOOST_CHECK(MaxS == TmpS); ss.str(""); - - for (unsigned int i = 0; i < 255; ++i) + + for (unsigned int i = 0; i < 255; ++i) { BOOST_CHECK((OneL << i).getdouble() == ldexp(1.0,i)); if (i < 160) BOOST_CHECK((OneS << i).getdouble() == ldexp(1.0,i)); } BOOST_CHECK(ZeroL.getdouble() == 0.0); BOOST_CHECK(ZeroS.getdouble() == 0.0); - for (int i = 256; i > 53; --i) + for (int i = 256; i > 53; --i) BOOST_CHECK(almostEqual((R1L>>(256-i)).getdouble(), ldexp(R1Ldouble,i))); - for (int i = 160; i > 53; --i) + for (int i = 160; i > 53; --i) BOOST_CHECK(almostEqual((R1S>>(160-i)).getdouble(), ldexp(R1Sdouble,i))); uint64_t R1L64part = (R1L>>192).GetLow64(); uint64_t R1S64part = (R1S>>96).GetLow64(); @@ -677,7 +677,7 @@ BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 G BOOST_AUTO_TEST_CASE(bignum_SetCompact) { - uint256 num; + arith_uint256 num; bool fNegative; bool fOverflow; num.SetCompact(0, &fNegative, &fOverflow); @@ -809,21 +809,21 @@ BOOST_AUTO_TEST_CASE( getmaxcoverage ) // some more tests just to get 100% cover // ~R1L give a base_uint<256> BOOST_CHECK((~~R1L >> 10) == (R1L >> 10)); BOOST_CHECK((~~R1S >> 10) == (R1S >> 10)); BOOST_CHECK((~~R1L << 10) == (R1L << 10)); BOOST_CHECK((~~R1S << 10) == (R1S << 10)); - BOOST_CHECK(!(~~R1L < R1L)); BOOST_CHECK(!(~~R1S < R1S)); - BOOST_CHECK(~~R1L <= R1L); BOOST_CHECK(~~R1S <= R1S); - BOOST_CHECK(!(~~R1L > R1L)); BOOST_CHECK(!(~~R1S > R1S)); - BOOST_CHECK(~~R1L >= R1L); BOOST_CHECK(~~R1S >= R1S); - BOOST_CHECK(!(R1L < ~~R1L)); BOOST_CHECK(!(R1S < ~~R1S)); - BOOST_CHECK(R1L <= ~~R1L); BOOST_CHECK(R1S <= ~~R1S); - BOOST_CHECK(!(R1L > ~~R1L)); BOOST_CHECK(!(R1S > ~~R1S)); - BOOST_CHECK(R1L >= ~~R1L); BOOST_CHECK(R1S >= ~~R1S); - + BOOST_CHECK(!(~~R1L < R1L)); BOOST_CHECK(!(~~R1S < R1S)); + BOOST_CHECK(~~R1L <= R1L); BOOST_CHECK(~~R1S <= R1S); + BOOST_CHECK(!(~~R1L > R1L)); BOOST_CHECK(!(~~R1S > R1S)); + BOOST_CHECK(~~R1L >= R1L); BOOST_CHECK(~~R1S >= R1S); + BOOST_CHECK(!(R1L < ~~R1L)); BOOST_CHECK(!(R1S < ~~R1S)); + BOOST_CHECK(R1L <= ~~R1L); BOOST_CHECK(R1S <= ~~R1S); + BOOST_CHECK(!(R1L > ~~R1L)); BOOST_CHECK(!(R1S > ~~R1S)); + BOOST_CHECK(R1L >= ~~R1L); BOOST_CHECK(R1S >= ~~R1S); + BOOST_CHECK(~~R1L + R2L == R1L + ~~R2L); BOOST_CHECK(~~R1S + R2S == R1S + ~~R2S); BOOST_CHECK(~~R1L - R2L == R1L - ~~R2L); BOOST_CHECK(~~R1S - R2S == R1S - ~~R2S); - BOOST_CHECK(~R1L != R1L); BOOST_CHECK(R1L != ~R1L); - BOOST_CHECK(~R1S != R1S); BOOST_CHECK(R1S != ~R1S); + BOOST_CHECK(~R1L != R1L); BOOST_CHECK(R1L != ~R1L); + BOOST_CHECK(~R1S != R1S); BOOST_CHECK(R1S != ~R1S); unsigned char TmpArray[32]; CHECKBITWISEOPERATOR(~R1,R2,|) CHECKBITWISEOPERATOR(~R1,R2,^) @@ -834,4 +834,3 @@ BOOST_AUTO_TEST_CASE( getmaxcoverage ) // some more tests just to get 100% cover } BOOST_AUTO_TEST_SUITE_END() - diff --git a/src/uint256.cpp b/src/uint256.cpp index 918c1a7cd..3b1334a03 100644 --- a/src/uint256.cpp +++ b/src/uint256.cpp @@ -11,158 +11,25 @@ #include template -base_uint::base_uint(const std::string& str) +base_blob::base_blob(const std::vector& vch) { - SetHex(str); + assert(vch.size() == sizeof(data)); + memcpy(data, &vch[0], sizeof(data)); } template -base_uint::base_uint(const std::vector& vch) +std::string base_blob::GetHex() const { - if (vch.size() != sizeof(pn)) - throw uint_error("Converting vector of wrong size to base_uint"); - memcpy(pn, &vch[0], sizeof(pn)); + char psz[sizeof(data) * 2 + 1]; + for (unsigned int i = 0; i < sizeof(data); i++) + sprintf(psz + i * 2, "%02x", data[sizeof(data) - i - 1]); + return std::string(psz, psz + sizeof(data) * 2); } template -base_uint& base_uint::operator<<=(unsigned int shift) +void base_blob::SetHex(const char* psz) { - base_uint a(*this); - for (int i = 0; i < WIDTH; i++) - pn[i] = 0; - int k = shift / 32; - shift = shift % 32; - for (int i = 0; i < WIDTH; i++) { - if (i + k + 1 < WIDTH && shift != 0) - pn[i + k + 1] |= (a.pn[i] >> (32 - shift)); - if (i + k < WIDTH) - pn[i + k] |= (a.pn[i] << shift); - } - return *this; -} - -template -base_uint& base_uint::operator>>=(unsigned int shift) -{ - base_uint a(*this); - for (int i = 0; i < WIDTH; i++) - pn[i] = 0; - int k = shift / 32; - shift = shift % 32; - for (int i = 0; i < WIDTH; i++) { - if (i - k - 1 >= 0 && shift != 0) - pn[i - k - 1] |= (a.pn[i] << (32 - shift)); - if (i - k >= 0) - pn[i - k] |= (a.pn[i] >> shift); - } - return *this; -} - -template -base_uint& base_uint::operator*=(uint32_t b32) -{ - uint64_t carry = 0; - for (int i = 0; i < WIDTH; i++) { - uint64_t n = carry + (uint64_t)b32 * pn[i]; - pn[i] = n & 0xffffffff; - carry = n >> 32; - } - return *this; -} - -template -base_uint& base_uint::operator*=(const base_uint& b) -{ - base_uint a = *this; - *this = 0; - for (int j = 0; j < WIDTH; j++) { - uint64_t carry = 0; - for (int i = 0; i + j < WIDTH; i++) { - uint64_t n = carry + pn[i + j] + (uint64_t)a.pn[j] * b.pn[i]; - pn[i + j] = n & 0xffffffff; - carry = n >> 32; - } - } - return *this; -} - -template -base_uint& base_uint::operator/=(const base_uint& b) -{ - base_uint div = b; // make a copy, so we can shift. - base_uint num = *this; // make a copy, so we can subtract. - *this = 0; // the quotient. - int num_bits = num.bits(); - int div_bits = div.bits(); - if (div_bits == 0) - throw uint_error("Division by zero"); - if (div_bits > num_bits) // the result is certainly 0. - return *this; - int shift = num_bits - div_bits; - div <<= shift; // shift so that div and num align. - while (shift >= 0) { - if (num >= div) { - num -= div; - pn[shift / 32] |= (1 << (shift & 31)); // set a bit of the result. - } - div >>= 1; // shift back. - shift--; - } - // num now contains the remainder of the division. - return *this; -} - -template -int base_uint::CompareTo(const base_uint& b) const -{ - for (int i = WIDTH - 1; i >= 0; i--) { - if (pn[i] < b.pn[i]) - return -1; - if (pn[i] > b.pn[i]) - return 1; - } - return 0; -} - -template -bool base_uint::EqualTo(uint64_t b) const -{ - for (int i = WIDTH - 1; i >= 2; i--) { - if (pn[i]) - return false; - } - if (pn[1] != (b >> 32)) - return false; - if (pn[0] != (b & 0xfffffffful)) - return false; - return true; -} - -template -double base_uint::getdouble() const -{ - double ret = 0.0; - double fact = 1.0; - for (int i = 0; i < WIDTH; i++) { - ret += fact * pn[i]; - fact *= 4294967296.0; - } - return ret; -} - -template -std::string base_uint::GetHex() const -{ - char psz[sizeof(pn) * 2 + 1]; - for (unsigned int i = 0; i < sizeof(pn); i++) - sprintf(psz + i * 2, "%02x", ((unsigned char*)pn)[sizeof(pn) - i - 1]); - return std::string(psz, psz + sizeof(pn) * 2); -} - -template -void base_uint::SetHex(const char* psz) -{ - memset(pn, 0, sizeof(pn)); + memset(data, 0, sizeof(data)); // skip leading spaces while (isspace(*psz)) @@ -177,7 +44,7 @@ void base_uint::SetHex(const char* psz) while (::HexDigit(*psz) != -1) psz++; psz--; - unsigned char* p1 = (unsigned char*)pn; + unsigned char* p1 = (unsigned char*)data; unsigned char* pend = p1 + WIDTH * 4; while (psz >= pbegin && p1 < pend) { *p1 = ::HexDigit(*psz--); @@ -189,110 +56,30 @@ void base_uint::SetHex(const char* psz) } template -void base_uint::SetHex(const std::string& str) +void base_blob::SetHex(const std::string& str) { SetHex(str.c_str()); } template -std::string base_uint::ToString() const +std::string base_blob::ToString() const { return (GetHex()); } -template -unsigned int base_uint::bits() const -{ - for (int pos = WIDTH - 1; pos >= 0; pos--) { - if (pn[pos]) { - for (int bits = 31; bits > 0; bits--) { - if (pn[pos] & 1 << bits) - return 32 * pos + bits + 1; - } - return 32 * pos + 1; - } - } - return 0; -} +// Explicit instantiations for base_blob<160> +template base_blob<160>::base_blob(const std::vector&); +template std::string base_blob<160>::GetHex() const; +template std::string base_blob<160>::ToString() const; +template void base_blob<160>::SetHex(const char*); +template void base_blob<160>::SetHex(const std::string&); -// Explicit instantiations for base_uint<160> -template base_uint<160>::base_uint(const std::string&); -template base_uint<160>::base_uint(const std::vector&); -template base_uint<160>& base_uint<160>::operator<<=(unsigned int); -template base_uint<160>& base_uint<160>::operator>>=(unsigned int); -template base_uint<160>& base_uint<160>::operator*=(uint32_t b32); -template base_uint<160>& base_uint<160>::operator*=(const base_uint<160>& b); -template base_uint<160>& base_uint<160>::operator/=(const base_uint<160>& b); -template int base_uint<160>::CompareTo(const base_uint<160>&) const; -template bool base_uint<160>::EqualTo(uint64_t) const; -template double base_uint<160>::getdouble() const; -template std::string base_uint<160>::GetHex() const; -template std::string base_uint<160>::ToString() const; -template void base_uint<160>::SetHex(const char*); -template void base_uint<160>::SetHex(const std::string&); -template unsigned int base_uint<160>::bits() const; - -// Explicit instantiations for base_uint<256> -template base_uint<256>::base_uint(const std::string&); -template base_uint<256>::base_uint(const std::vector&); -template base_uint<256>& base_uint<256>::operator<<=(unsigned int); -template base_uint<256>& base_uint<256>::operator>>=(unsigned int); -template base_uint<256>& base_uint<256>::operator*=(uint32_t b32); -template base_uint<256>& base_uint<256>::operator*=(const base_uint<256>& b); -template base_uint<256>& base_uint<256>::operator/=(const base_uint<256>& b); -template int base_uint<256>::CompareTo(const base_uint<256>&) const; -template bool base_uint<256>::EqualTo(uint64_t) const; -template double base_uint<256>::getdouble() const; -template std::string base_uint<256>::GetHex() const; -template std::string base_uint<256>::ToString() const; -template void base_uint<256>::SetHex(const char*); -template void base_uint<256>::SetHex(const std::string&); -template unsigned int base_uint<256>::bits() const; - -// This implementation directly uses shifts instead of going -// through an intermediate MPI representation. -uint256& uint256::SetCompact(uint32_t nCompact, bool* pfNegative, bool* pfOverflow) -{ - int nSize = nCompact >> 24; - uint32_t nWord = nCompact & 0x007fffff; - if (nSize <= 3) { - nWord >>= 8 * (3 - nSize); - *this = nWord; - } else { - *this = nWord; - *this <<= 8 * (nSize - 3); - } - if (pfNegative) - *pfNegative = nWord != 0 && (nCompact & 0x00800000) != 0; - if (pfOverflow) - *pfOverflow = nWord != 0 && ((nSize > 34) || - (nWord > 0xff && nSize > 33) || - (nWord > 0xffff && nSize > 32)); - return *this; -} - -uint32_t uint256::GetCompact(bool fNegative) const -{ - int nSize = (bits() + 7) / 8; - uint32_t nCompact = 0; - if (nSize <= 3) { - nCompact = GetLow64() << 8 * (3 - nSize); - } else { - uint256 bn = *this >> 8 * (nSize - 3); - nCompact = bn.GetLow64(); - } - // The 0x00800000 bit denotes the sign. - // Thus, if it is already set, divide the mantissa by 256 and increase the exponent. - if (nCompact & 0x00800000) { - nCompact >>= 8; - nSize++; - } - assert((nCompact & ~0x007fffff) == 0); - assert(nSize < 256); - nCompact |= nSize << 24; - nCompact |= (fNegative && (nCompact & 0x007fffff) ? 0x00800000 : 0); - return nCompact; -} +// Explicit instantiations for base_blob<256> +template base_blob<256>::base_blob(const std::vector&); +template std::string base_blob<256>::GetHex() const; +template std::string base_blob<256>::ToString() const; +template void base_blob<256>::SetHex(const char*); +template void base_blob<256>::SetHex(const std::string&); static void inline HashMix(uint32_t& a, uint32_t& b, uint32_t& c) { @@ -339,18 +126,20 @@ static void inline HashFinal(uint32_t& a, uint32_t& b, uint32_t& c) uint64_t uint256::GetHash(const uint256& salt) const { uint32_t a, b, c; + const uint32_t *pn = (const uint32_t*)data; + const uint32_t *salt_pn = (const uint32_t*)salt.data; a = b = c = 0xdeadbeef + (WIDTH << 2); - a += pn[0] ^ salt.pn[0]; - b += pn[1] ^ salt.pn[1]; - c += pn[2] ^ salt.pn[2]; + a += pn[0] ^ salt_pn[0]; + b += pn[1] ^ salt_pn[1]; + c += pn[2] ^ salt_pn[2]; HashMix(a, b, c); - a += pn[3] ^ salt.pn[3]; - b += pn[4] ^ salt.pn[4]; - c += pn[5] ^ salt.pn[5]; + a += pn[3] ^ salt_pn[3]; + b += pn[4] ^ salt_pn[4]; + c += pn[5] ^ salt_pn[5]; HashMix(a, b, c); - a += pn[6] ^ salt.pn[6]; - b += pn[7] ^ salt.pn[7]; + a += pn[6] ^ salt_pn[6]; + b += pn[7] ^ salt_pn[7]; HashFinal(a, b, c); return ((((uint64_t)b) << 32) | c); diff --git a/src/uint256.h b/src/uint256.h index 8189b27cb..6d016ab16 100644 --- a/src/uint256.h +++ b/src/uint256.h @@ -13,217 +13,37 @@ #include #include -class uint_error : public std::runtime_error { -public: - explicit uint_error(const std::string& str) : std::runtime_error(str) {} -}; - -/** Template base class for unsigned big integers. */ +/** Template base class for fixed-sized opaque blobs. */ template -class base_uint +class base_blob { protected: - enum { WIDTH=BITS/32 }; - uint32_t pn[WIDTH]; + enum { WIDTH=BITS/8 }; + uint8_t data[WIDTH]; public: - - base_uint() + base_blob() { - for (int i = 0; i < WIDTH; i++) - pn[i] = 0; + memset(data, 0, sizeof(data)); } - base_uint(const base_uint& b) + explicit base_blob(const std::vector& vch); + + bool IsNull() const { for (int i = 0; i < WIDTH; i++) - pn[i] = b.pn[i]; - } - - base_uint& operator=(const base_uint& b) - { - for (int i = 0; i < WIDTH; i++) - pn[i] = b.pn[i]; - return *this; - } - - base_uint(uint64_t b) - { - pn[0] = (unsigned int)b; - pn[1] = (unsigned int)(b >> 32); - for (int i = 2; i < WIDTH; i++) - pn[i] = 0; - } - - explicit base_uint(const std::string& str); - explicit base_uint(const std::vector& vch); - - bool operator!() const - { - for (int i = 0; i < WIDTH; i++) - if (pn[i] != 0) + if (data[i] != 0) return false; return true; } - const base_uint operator~() const + void SetNull() { - base_uint ret; - for (int i = 0; i < WIDTH; i++) - ret.pn[i] = ~pn[i]; - return ret; + memset(data, 0, sizeof(data)); } - const base_uint operator-() const - { - base_uint ret; - for (int i = 0; i < WIDTH; i++) - ret.pn[i] = ~pn[i]; - ret++; - return ret; - } - - double getdouble() const; - - base_uint& operator=(uint64_t b) - { - pn[0] = (unsigned int)b; - pn[1] = (unsigned int)(b >> 32); - for (int i = 2; i < WIDTH; i++) - pn[i] = 0; - return *this; - } - - base_uint& operator^=(const base_uint& b) - { - for (int i = 0; i < WIDTH; i++) - pn[i] ^= b.pn[i]; - return *this; - } - - base_uint& operator&=(const base_uint& b) - { - for (int i = 0; i < WIDTH; i++) - pn[i] &= b.pn[i]; - return *this; - } - - base_uint& operator|=(const base_uint& b) - { - for (int i = 0; i < WIDTH; i++) - pn[i] |= b.pn[i]; - return *this; - } - - base_uint& operator^=(uint64_t b) - { - pn[0] ^= (unsigned int)b; - pn[1] ^= (unsigned int)(b >> 32); - return *this; - } - - base_uint& operator|=(uint64_t b) - { - pn[0] |= (unsigned int)b; - pn[1] |= (unsigned int)(b >> 32); - return *this; - } - - base_uint& operator<<=(unsigned int shift); - base_uint& operator>>=(unsigned int shift); - - base_uint& operator+=(const base_uint& b) - { - uint64_t carry = 0; - for (int i = 0; i < WIDTH; i++) - { - uint64_t n = carry + pn[i] + b.pn[i]; - pn[i] = n & 0xffffffff; - carry = n >> 32; - } - return *this; - } - - base_uint& operator-=(const base_uint& b) - { - *this += -b; - return *this; - } - - base_uint& operator+=(uint64_t b64) - { - base_uint b; - b = b64; - *this += b; - return *this; - } - - base_uint& operator-=(uint64_t b64) - { - base_uint b; - b = b64; - *this += -b; - return *this; - } - - base_uint& operator*=(uint32_t b32); - base_uint& operator*=(const base_uint& b); - base_uint& operator/=(const base_uint& b); - - base_uint& operator++() - { - // prefix operator - int i = 0; - while (++pn[i] == 0 && i < WIDTH-1) - i++; - return *this; - } - - const base_uint operator++(int) - { - // postfix operator - const base_uint ret = *this; - ++(*this); - return ret; - } - - base_uint& operator--() - { - // prefix operator - int i = 0; - while (--pn[i] == (uint32_t)-1 && i < WIDTH-1) - i++; - return *this; - } - - const base_uint operator--(int) - { - // postfix operator - const base_uint ret = *this; - --(*this); - return ret; - } - - int CompareTo(const base_uint& b) const; - bool EqualTo(uint64_t b) const; - - friend inline const base_uint operator+(const base_uint& a, const base_uint& b) { return base_uint(a) += b; } - friend inline const base_uint operator-(const base_uint& a, const base_uint& b) { return base_uint(a) -= b; } - friend inline const base_uint operator*(const base_uint& a, const base_uint& b) { return base_uint(a) *= b; } - friend inline const base_uint operator/(const base_uint& a, const base_uint& b) { return base_uint(a) /= b; } - friend inline const base_uint operator|(const base_uint& a, const base_uint& b) { return base_uint(a) |= b; } - friend inline const base_uint operator&(const base_uint& a, const base_uint& b) { return base_uint(a) &= b; } - friend inline const base_uint operator^(const base_uint& a, const base_uint& b) { return base_uint(a) ^= b; } - friend inline const base_uint operator>>(const base_uint& a, int shift) { return base_uint(a) >>= shift; } - friend inline const base_uint operator<<(const base_uint& a, int shift) { return base_uint(a) <<= shift; } - friend inline const base_uint operator*(const base_uint& a, uint32_t b) { return base_uint(a) *= b; } - friend inline bool operator==(const base_uint& a, const base_uint& b) { return memcmp(a.pn, b.pn, sizeof(a.pn)) == 0; } - friend inline bool operator!=(const base_uint& a, const base_uint& b) { return memcmp(a.pn, b.pn, sizeof(a.pn)) != 0; } - friend inline bool operator>(const base_uint& a, const base_uint& b) { return a.CompareTo(b) > 0; } - friend inline bool operator<(const base_uint& a, const base_uint& b) { return a.CompareTo(b) < 0; } - friend inline bool operator>=(const base_uint& a, const base_uint& b) { return a.CompareTo(b) >= 0; } - friend inline bool operator<=(const base_uint& a, const base_uint& b) { return a.CompareTo(b) <= 0; } - friend inline bool operator==(const base_uint& a, uint64_t b) { return a.EqualTo(b); } - friend inline bool operator!=(const base_uint& a, uint64_t b) { return !a.EqualTo(b); } + friend inline bool operator==(const base_blob& a, const base_blob& b) { return memcmp(a.data, b.data, sizeof(a.data)) == 0; } + friend inline bool operator!=(const base_blob& a, const base_blob& b) { return memcmp(a.data, b.data, sizeof(a.data)) != 0; } + friend inline bool operator<(const base_blob& a, const base_blob& b) { return memcmp(a.data, b.data, sizeof(a.data)) < 0; } std::string GetHex() const; void SetHex(const char* psz); @@ -232,122 +52,107 @@ public: unsigned char* begin() { - return (unsigned char*)&pn[0]; + return &data[0]; } unsigned char* end() { - return (unsigned char*)&pn[WIDTH]; + return &data[WIDTH]; } const unsigned char* begin() const { - return (unsigned char*)&pn[0]; + return &data[0]; } const unsigned char* end() const { - return (unsigned char*)&pn[WIDTH]; + return &data[WIDTH]; } unsigned int size() const { - return sizeof(pn); - } - - /** - * Returns the position of the highest bit set plus one, or zero if the - * value is zero. - */ - unsigned int bits() const; - - uint64_t GetLow64() const - { - assert(WIDTH >= 2); - return pn[0] | (uint64_t)pn[1] << 32; + return sizeof(data); } unsigned int GetSerializeSize(int nType, int nVersion) const { - return sizeof(pn); + return sizeof(data); } template void Serialize(Stream& s, int nType, int nVersion) const { - s.write((char*)pn, sizeof(pn)); + s.write((char*)data, sizeof(data)); } template void Unserialize(Stream& s, int nType, int nVersion) { - s.read((char*)pn, sizeof(pn)); - } - - // Temporary for migration to opaque uint160/256 - uint64_t GetCheapHash() const - { - return GetLow64(); - } - void SetNull() - { - memset(pn, 0, sizeof(pn)); - } - bool IsNull() const - { - for (int i = 0; i < WIDTH; i++) - if (pn[i] != 0) - return false; - return true; + s.read((char*)data, sizeof(data)); } }; -/** 160-bit unsigned big integer. */ -class uint160 : public base_uint<160> { +/** 160-bit opaque blob. + * @note This type is called uint160 for historical reasons only. It is an opaque + * blob of 160 bits and has no integer operations. + */ +class uint160 : public base_blob<160> { public: uint160() {} - uint160(const base_uint<160>& b) : base_uint<160>(b) {} - uint160(uint64_t b) : base_uint<160>(b) {} - explicit uint160(const std::string& str) : base_uint<160>(str) {} - explicit uint160(const std::vector& vch) : base_uint<160>(vch) {} + uint160(const base_blob<160>& b) : base_blob<160>(b) {} + explicit uint160(const std::vector& vch) : base_blob<160>(vch) {} }; -/** 256-bit unsigned big integer. */ -class uint256 : public base_uint<256> { +/** 256-bit opaque blob. + * @note This type is called uint256 for historical reasons only. It is an + * opaque blob of 256 bits and has no integer operations. Use arith_uint256 if + * those are required. + */ +class uint256 : public base_blob<256> { public: uint256() {} - uint256(const base_uint<256>& b) : base_uint<256>(b) {} - uint256(uint64_t b) : base_uint<256>(b) {} - explicit uint256(const std::string& str) : base_uint<256>(str) {} - explicit uint256(const std::vector& vch) : base_uint<256>(vch) {} - - /** - * The "compact" format is a representation of a whole - * number N using an unsigned 32bit number similar to a - * floating point format. - * The most significant 8 bits are the unsigned exponent of base 256. - * This exponent can be thought of as "number of bytes of N". - * The lower 23 bits are the mantissa. - * Bit number 24 (0x800000) represents the sign of N. - * N = (-1^sign) * mantissa * 256^(exponent-3) - * - * Satoshi's original implementation used BN_bn2mpi() and BN_mpi2bn(). - * MPI uses the most significant bit of the first byte as sign. - * Thus 0x1234560000 is compact (0x05123456) - * and 0xc0de000000 is compact (0x0600c0de) - * - * Bitcoin only uses this "compact" format for encoding difficulty - * targets, which are unsigned 256bit quantities. Thus, all the - * complexities of the sign bit and using base 256 are probably an - * implementation accident. - */ - uint256& SetCompact(uint32_t nCompact, bool *pfNegative = NULL, bool *pfOverflow = NULL); - uint32_t GetCompact(bool fNegative = false) const; + uint256(const base_blob<256>& b) : base_blob<256>(b) {} + explicit uint256(const std::vector& vch) : base_blob<256>(vch) {} + /** A cheap hash function that just returns 64 bits from the result, it can be + * used when the contents are considered uniformly random. It is not appropriate + * when the value can easily be influenced from outside as e.g. a network adversary could + * provide values to trigger worst-case behavior. + * @note The result of this function is not stable between little and big endian. + */ + uint64_t GetCheapHash() const + { + uint64_t result; + memcpy((void*)&result, (void*)data, 8); + return result; + } + + /** A more secure, salted hash function. + * @note This hash is not stable between little and big endian. + */ uint64_t GetHash(const uint256& salt) const; }; -// Temporary for migration to opaque uint160/256 -inline uint256 uint256S(const std::string &x) { return uint256(x); } +/* uint256 from const char *. + * This is a separate function because the constructor uint256(const char*) can result + * in dangerously catching uint256(0). + */ +inline uint256 uint256S(const char *str) +{ + uint256 rv; + rv.SetHex(str); + return rv; +} +/* uint256 from std::string. + * This is a separate function because the constructor uint256(const std::string &str) can result + * in dangerously catching uint256(0) via std::string(const char*). + */ +inline uint256 uint256S(const std::string& str) +{ + uint256 rv; + rv.SetHex(str); + return rv; +} #endif // BITCOIN_UINT256_H From 92cdb1aace3c7343e9c9472061508d3b01d9883d Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 16 Dec 2014 17:29:51 +0100 Subject: [PATCH 84/88] Add conversion functions arith_uint256<->uint_256 --- src/arith_uint256.cpp | 16 ++++++++++++++++ src/arith_uint256.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index 0dba429a8..f0b6a6a3b 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -5,6 +5,7 @@ #include "arith_uint256.h" +#include "uint256.h" #include "utilstrencodings.h" #include @@ -355,3 +356,18 @@ uint64_t arith_uint256::GetHash(const arith_uint256& salt) const return ((((uint64_t)b) << 32) | c); } + +uint256 ArithToUint256(const arith_uint256 &a) +{ + uint256 b; + // TODO: needs bswap32 on big-endian + memcpy(b.begin(), a.pn, a.size()); + return b; +} +arith_uint256 UintToArith256(const uint256 &a) +{ + arith_uint256 b; + // TODO: needs bswap32 on big-endian + memcpy(b.pn, a.begin(), a.size()); + return b; +} diff --git a/src/arith_uint256.h b/src/arith_uint256.h index 9e32b124c..5cb04f3c3 100644 --- a/src/arith_uint256.h +++ b/src/arith_uint256.h @@ -13,6 +13,8 @@ #include #include +class uint256; + class uint_error : public std::runtime_error { public: explicit uint_error(const std::string& str) : std::runtime_error(str) {} @@ -345,6 +347,12 @@ public: uint32_t GetCompact(bool fNegative = false) const; uint64_t GetHash(const arith_uint256& salt) const; + + friend uint256 ArithToUint256(const arith_uint256 &); + friend arith_uint256 UintToArith256(const uint256 &); }; +uint256 ArithToUint256(const arith_uint256 &); +arith_uint256 UintToArith256(const uint256 &); + #endif // BITCOIN_UINT256_H From dba2e9141a4f07154829bdaed35adaf7af7908d3 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 16 Dec 2014 15:50:31 +0100 Subject: [PATCH 85/88] Add tests for new uint256 --- src/Makefile.test.include | 1 + src/test/uint256_tests.cpp | 268 +++++++++++++++++++++++++++++++++++++ 2 files changed, 269 insertions(+) create mode 100644 src/test/uint256_tests.cpp diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 21d91acc6..2f10702d8 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -68,6 +68,7 @@ BITCOIN_TESTS =\ test/test_bitcoin.cpp \ test/timedata_tests.cpp \ test/transaction_tests.cpp \ + test/uint256_tests.cpp \ test/univalue_tests.cpp \ test/util_tests.cpp diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp new file mode 100644 index 000000000..5b33846ba --- /dev/null +++ b/src/test/uint256_tests.cpp @@ -0,0 +1,268 @@ +// Copyright (c) 2011-2013 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include "arith_uint256.h" +#include "uint256.h" +#include "version.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +BOOST_AUTO_TEST_SUITE(uint256_tests) + +const unsigned char R1Array[] = + "\x9c\x52\x4a\xdb\xcf\x56\x11\x12\x2b\x29\x12\x5e\x5d\x35\xd2\xd2" + "\x22\x81\xaa\xb5\x33\xf0\x08\x32\xd5\x56\xb1\xf9\xea\xe5\x1d\x7d"; +const char R1ArrayHex[] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c"; +const uint256 R1L = uint256(std::vector(R1Array,R1Array+32)); +const uint160 R1S = uint160(std::vector(R1Array,R1Array+20)); + +const unsigned char R2Array[] = + "\x70\x32\x1d\x7c\x47\xa5\x6b\x40\x26\x7e\x0a\xc3\xa6\x9c\xb6\xbf" + "\x13\x30\x47\xa3\x19\x2d\xda\x71\x49\x13\x72\xf0\xb4\xca\x81\xd7"; +const uint256 R2L = uint256(std::vector(R2Array,R2Array+32)); +const uint160 R2S = uint160(std::vector(R2Array,R2Array+20)); + +const unsigned char ZeroArray[] = + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; +const uint256 ZeroL = uint256(std::vector(ZeroArray,ZeroArray+32)); +const uint160 ZeroS = uint160(std::vector(ZeroArray,ZeroArray+20)); + +const unsigned char OneArray[] = + "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; +const uint256 OneL = uint256(std::vector(OneArray,OneArray+32)); +const uint160 OneS = uint160(std::vector(OneArray,OneArray+20)); + +const unsigned char MaxArray[] = + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" + "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"; +const uint256 MaxL = uint256(std::vector(MaxArray,MaxArray+32)); +const uint160 MaxS = uint160(std::vector(MaxArray,MaxArray+20)); + +std::string ArrayToString(const unsigned char A[], unsigned int width) +{ + std::stringstream Stream; + Stream << std::hex; + for (unsigned int i = 0; i < width; ++i) + { + Stream<): + BOOST_CHECK(R1L.ToString() == ArrayToString(R1Array,32)); + BOOST_CHECK(R1S.ToString() == ArrayToString(R1Array,20)); + BOOST_CHECK(R2L.ToString() == ArrayToString(R2Array,32)); + BOOST_CHECK(R2S.ToString() == ArrayToString(R2Array,20)); + BOOST_CHECK(ZeroL.ToString() == ArrayToString(ZeroArray,32)); + BOOST_CHECK(ZeroS.ToString() == ArrayToString(ZeroArray,20)); + BOOST_CHECK(OneL.ToString() == ArrayToString(OneArray,32)); + BOOST_CHECK(OneS.ToString() == ArrayToString(OneArray,20)); + BOOST_CHECK(MaxL.ToString() == ArrayToString(MaxArray,32)); + BOOST_CHECK(MaxS.ToString() == ArrayToString(MaxArray,20)); + BOOST_CHECK(OneL.ToString() != ArrayToString(ZeroArray,32)); + BOOST_CHECK(OneS.ToString() != ArrayToString(ZeroArray,20)); + + // == and != + BOOST_CHECK(R1L != R2L && R1S != R2S); + BOOST_CHECK(ZeroL != OneL && ZeroS != OneS); + BOOST_CHECK(OneL != ZeroL && OneS != ZeroS); + BOOST_CHECK(MaxL != ZeroL && MaxS != ZeroS); + + // String Constructor and Copy Constructor + BOOST_CHECK(uint256S("0x"+R1L.ToString()) == R1L); + BOOST_CHECK(uint256S("0x"+R2L.ToString()) == R2L); + BOOST_CHECK(uint256S("0x"+ZeroL.ToString()) == ZeroL); + BOOST_CHECK(uint256S("0x"+OneL.ToString()) == OneL); + BOOST_CHECK(uint256S("0x"+MaxL.ToString()) == MaxL); + BOOST_CHECK(uint256S(R1L.ToString()) == R1L); + BOOST_CHECK(uint256S(" 0x"+R1L.ToString()+" ") == R1L); + BOOST_CHECK(uint256S("") == ZeroL); + BOOST_CHECK(R1L == uint256S(R1ArrayHex)); + BOOST_CHECK(uint256(R1L) == R1L); + BOOST_CHECK(uint256(ZeroL) == ZeroL); + BOOST_CHECK(uint256(OneL) == OneL); + + BOOST_CHECK(uint160S("0x"+R1S.ToString()) == R1S); + BOOST_CHECK(uint160S("0x"+R2S.ToString()) == R2S); + BOOST_CHECK(uint160S("0x"+ZeroS.ToString()) == ZeroS); + BOOST_CHECK(uint160S("0x"+OneS.ToString()) == OneS); + BOOST_CHECK(uint160S("0x"+MaxS.ToString()) == MaxS); + BOOST_CHECK(uint160S(R1S.ToString()) == R1S); + BOOST_CHECK(uint160S(" 0x"+R1S.ToString()+" ") == R1S); + BOOST_CHECK(uint160S("") == ZeroS); + BOOST_CHECK(R1S == uint160S(R1ArrayHex)); + + BOOST_CHECK(uint160(R1S) == R1S); + BOOST_CHECK(uint160(ZeroS) == ZeroS); + BOOST_CHECK(uint160(OneS) == OneS); +} + +BOOST_AUTO_TEST_CASE( comparison ) // <= >= < > +{ + uint256 LastL; + for (int i = 255; i >= 0; --i) { + uint256 TmpL; + *(TmpL.begin() + (i>>3)) |= 1<<(7-(i&7)); + BOOST_CHECK( LastL < TmpL ); + LastL = TmpL; + } + + BOOST_CHECK( ZeroL < R1L ); + BOOST_CHECK( R2L < R1L ); + BOOST_CHECK( ZeroL < OneL ); + BOOST_CHECK( OneL < MaxL ); + BOOST_CHECK( R1L < MaxL ); + BOOST_CHECK( R2L < MaxL ); + + uint160 LastS; + for (int i = 159; i >= 0; --i) { + uint160 TmpS; + *(TmpS.begin() + (i>>3)) |= 1<<(7-(i&7)); + BOOST_CHECK( LastS < TmpS ); + LastS = TmpS; + } + BOOST_CHECK( ZeroS < R1S ); + BOOST_CHECK( R2S < R1S ); + BOOST_CHECK( ZeroS < OneS ); + BOOST_CHECK( OneS < MaxS ); + BOOST_CHECK( R1S < MaxS ); + BOOST_CHECK( R2S < MaxS ); +} + +BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 GetSerializeSize, Serialize, Unserialize +{ + BOOST_CHECK(R1L.GetHex() == R1L.ToString()); + BOOST_CHECK(R2L.GetHex() == R2L.ToString()); + BOOST_CHECK(OneL.GetHex() == OneL.ToString()); + BOOST_CHECK(MaxL.GetHex() == MaxL.ToString()); + uint256 TmpL(R1L); + BOOST_CHECK(TmpL == R1L); + TmpL.SetHex(R2L.ToString()); BOOST_CHECK(TmpL == R2L); + TmpL.SetHex(ZeroL.ToString()); BOOST_CHECK(TmpL == uint256()); + + TmpL.SetHex(R1L.ToString()); + BOOST_CHECK(memcmp(R1L.begin(), R1Array, 32)==0); + BOOST_CHECK(memcmp(TmpL.begin(), R1Array, 32)==0); + BOOST_CHECK(memcmp(R2L.begin(), R2Array, 32)==0); + BOOST_CHECK(memcmp(ZeroL.begin(), ZeroArray, 32)==0); + BOOST_CHECK(memcmp(OneL.begin(), OneArray, 32)==0); + BOOST_CHECK(R1L.size() == sizeof(R1L)); + BOOST_CHECK(sizeof(R1L) == 32); + BOOST_CHECK(R1L.size() == 32); + BOOST_CHECK(R2L.size() == 32); + BOOST_CHECK(ZeroL.size() == 32); + BOOST_CHECK(MaxL.size() == 32); + BOOST_CHECK(R1L.begin() + 32 == R1L.end()); + BOOST_CHECK(R2L.begin() + 32 == R2L.end()); + BOOST_CHECK(OneL.begin() + 32 == OneL.end()); + BOOST_CHECK(MaxL.begin() + 32 == MaxL.end()); + BOOST_CHECK(TmpL.begin() + 32 == TmpL.end()); + BOOST_CHECK(R1L.GetSerializeSize(0,PROTOCOL_VERSION) == 32); + BOOST_CHECK(ZeroL.GetSerializeSize(0,PROTOCOL_VERSION) == 32); + + std::stringstream ss; + R1L.Serialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(ss.str() == std::string(R1Array,R1Array+32)); + TmpL.Unserialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(R1L == TmpL); + ss.str(""); + ZeroL.Serialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(ss.str() == std::string(ZeroArray,ZeroArray+32)); + TmpL.Unserialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(ZeroL == TmpL); + ss.str(""); + MaxL.Serialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(ss.str() == std::string(MaxArray,MaxArray+32)); + TmpL.Unserialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(MaxL == TmpL); + ss.str(""); + + BOOST_CHECK(R1S.GetHex() == R1S.ToString()); + BOOST_CHECK(R2S.GetHex() == R2S.ToString()); + BOOST_CHECK(OneS.GetHex() == OneS.ToString()); + BOOST_CHECK(MaxS.GetHex() == MaxS.ToString()); + uint160 TmpS(R1S); + BOOST_CHECK(TmpS == R1S); + TmpS.SetHex(R2S.ToString()); BOOST_CHECK(TmpS == R2S); + TmpS.SetHex(ZeroS.ToString()); BOOST_CHECK(TmpS == uint160()); + + TmpS.SetHex(R1S.ToString()); + BOOST_CHECK(memcmp(R1S.begin(), R1Array, 20)==0); + BOOST_CHECK(memcmp(TmpS.begin(), R1Array, 20)==0); + BOOST_CHECK(memcmp(R2S.begin(), R2Array, 20)==0); + BOOST_CHECK(memcmp(ZeroS.begin(), ZeroArray, 20)==0); + BOOST_CHECK(memcmp(OneS.begin(), OneArray, 20)==0); + BOOST_CHECK(R1S.size() == sizeof(R1S)); + BOOST_CHECK(sizeof(R1S) == 20); + BOOST_CHECK(R1S.size() == 20); + BOOST_CHECK(R2S.size() == 20); + BOOST_CHECK(ZeroS.size() == 20); + BOOST_CHECK(MaxS.size() == 20); + BOOST_CHECK(R1S.begin() + 20 == R1S.end()); + BOOST_CHECK(R2S.begin() + 20 == R2S.end()); + BOOST_CHECK(OneS.begin() + 20 == OneS.end()); + BOOST_CHECK(MaxS.begin() + 20 == MaxS.end()); + BOOST_CHECK(TmpS.begin() + 20 == TmpS.end()); + BOOST_CHECK(R1S.GetSerializeSize(0,PROTOCOL_VERSION) == 20); + BOOST_CHECK(ZeroS.GetSerializeSize(0,PROTOCOL_VERSION) == 20); + + R1S.Serialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(ss.str() == std::string(R1Array,R1Array+20)); + TmpS.Unserialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(R1S == TmpS); + ss.str(""); + ZeroS.Serialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(ss.str() == std::string(ZeroArray,ZeroArray+20)); + TmpS.Unserialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(ZeroS == TmpS); + ss.str(""); + MaxS.Serialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(ss.str() == std::string(MaxArray,MaxArray+20)); + TmpS.Unserialize(ss,0,PROTOCOL_VERSION); + BOOST_CHECK(MaxS == TmpS); + ss.str(""); +} + +BOOST_AUTO_TEST_CASE( conversion ) +{ + BOOST_CHECK(ArithToUint256(UintToArith256(ZeroL)) == ZeroL); + BOOST_CHECK(ArithToUint256(UintToArith256(OneL)) == OneL); + BOOST_CHECK(ArithToUint256(UintToArith256(R1L)) == R1L); + BOOST_CHECK(ArithToUint256(UintToArith256(R2L)) == R2L); + BOOST_CHECK(UintToArith256(ZeroL) == 0); + BOOST_CHECK(UintToArith256(OneL) == 1); + BOOST_CHECK(ArithToUint256(0) == ZeroL); + BOOST_CHECK(ArithToUint256(1) == OneL); + BOOST_CHECK(arith_uint256(R1L.GetHex()) == UintToArith256(R1L)); + BOOST_CHECK(arith_uint256(R2L.GetHex()) == UintToArith256(R2L)); + BOOST_CHECK(R1L.GetHex() == UintToArith256(R1L).GetHex()); + BOOST_CHECK(R2L.GetHex() == UintToArith256(R2L).GetHex()); +} + +BOOST_AUTO_TEST_SUITE_END() From edc720479d0749a000d5a6970da6d2d72657cf38 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 16 Dec 2014 15:44:57 +0100 Subject: [PATCH 86/88] Remove arith_uint160 We never do 160-bit arithmetic. --- src/arith_uint256.cpp | 17 -- src/arith_uint256.h | 10 -- src/test/arith_uint256_tests.cpp | 290 +++---------------------------- 3 files changed, 23 insertions(+), 294 deletions(-) diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index f0b6a6a3b..12f9e7d1b 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -216,23 +216,6 @@ unsigned int base_uint::bits() const return 0; } -// Explicit instantiations for base_uint<160> -template base_uint<160>::base_uint(const std::string&); -template base_uint<160>::base_uint(const std::vector&); -template base_uint<160>& base_uint<160>::operator<<=(unsigned int); -template base_uint<160>& base_uint<160>::operator>>=(unsigned int); -template base_uint<160>& base_uint<160>::operator*=(uint32_t b32); -template base_uint<160>& base_uint<160>::operator*=(const base_uint<160>& b); -template base_uint<160>& base_uint<160>::operator/=(const base_uint<160>& b); -template int base_uint<160>::CompareTo(const base_uint<160>&) const; -template bool base_uint<160>::EqualTo(uint64_t) const; -template double base_uint<160>::getdouble() const; -template std::string base_uint<160>::GetHex() const; -template std::string base_uint<160>::ToString() const; -template void base_uint<160>::SetHex(const char*); -template void base_uint<160>::SetHex(const std::string&); -template unsigned int base_uint<160>::bits() const; - // Explicit instantiations for base_uint<256> template base_uint<256>::base_uint(const std::string&); template base_uint<256>::base_uint(const std::vector&); diff --git a/src/arith_uint256.h b/src/arith_uint256.h index 5cb04f3c3..b69eef676 100644 --- a/src/arith_uint256.h +++ b/src/arith_uint256.h @@ -304,16 +304,6 @@ public: } }; -/** 160-bit unsigned big integer. */ -class arith_uint160 : public base_uint<160> { -public: - arith_uint160() {} - arith_uint160(const base_uint<160>& b) : base_uint<160>(b) {} - arith_uint160(uint64_t b) : base_uint<160>(b) {} - explicit arith_uint160(const std::string& str) : base_uint<160>(str) {} - explicit arith_uint160(const std::vector& vch) : base_uint<160>(vch) {} -}; - /** 256-bit unsigned big integer. */ class arith_uint256 : public base_uint<256> { public: diff --git a/src/test/arith_uint256_tests.cpp b/src/test/arith_uint256_tests.cpp index f5f71da61..e0c4b2725 100644 --- a/src/test/arith_uint256_tests.cpp +++ b/src/test/arith_uint256_tests.cpp @@ -19,16 +19,13 @@ const unsigned char R1Array[] = "\x22\x81\xaa\xb5\x33\xf0\x08\x32\xd5\x56\xb1\xf9\xea\xe5\x1d\x7d"; const char R1ArrayHex[] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c"; const double R1Ldouble = 0.4887374590559308955; // R1L equals roughly R1Ldouble * 2^256 -const double R1Sdouble = 0.7096329412477836074; const arith_uint256 R1L = arith_uint256(std::vector(R1Array,R1Array+32)); -const arith_uint160 R1S = arith_uint160(std::vector(R1Array,R1Array+20)); const uint64_t R1LLow64 = 0x121156cfdb4a529cULL; const unsigned char R2Array[] = "\x70\x32\x1d\x7c\x47\xa5\x6b\x40\x26\x7e\x0a\xc3\xa6\x9c\xb6\xbf" "\x13\x30\x47\xa3\x19\x2d\xda\x71\x49\x13\x72\xf0\xb4\xca\x81\xd7"; const arith_uint256 R2L = arith_uint256(std::vector(R2Array,R2Array+32)); -const arith_uint160 R2S = arith_uint160(std::vector(R2Array,R2Array+20)); const char R1LplusR2L[] = "549FB09FEA236A1EA3E31D4D58F1B1369288D204211CA751527CFC175767850C"; @@ -36,22 +33,18 @@ const unsigned char ZeroArray[] = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; const arith_uint256 ZeroL = arith_uint256(std::vector(ZeroArray,ZeroArray+32)); -const arith_uint160 ZeroS = arith_uint160(std::vector(ZeroArray,ZeroArray+20)); const unsigned char OneArray[] = "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; const arith_uint256 OneL = arith_uint256(std::vector(OneArray,OneArray+32)); -const arith_uint160 OneS = arith_uint160(std::vector(OneArray,OneArray+20)); const unsigned char MaxArray[] = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"; const arith_uint256 MaxL = arith_uint256(std::vector(MaxArray,MaxArray+32)); -const arith_uint160 MaxS = arith_uint160(std::vector(MaxArray,MaxArray+20)); const arith_uint256 HalfL = (OneL << 255); -const arith_uint160 HalfS = (OneS << 159); std::string ArrayToString(const unsigned char A[], unsigned int width) { std::stringstream Stream; @@ -68,26 +61,19 @@ BOOST_AUTO_TEST_CASE( basics ) // constructors, equality, inequality BOOST_CHECK(1 == 0+1); // constructor arith_uint256(vector): BOOST_CHECK(R1L.ToString() == ArrayToString(R1Array,32)); - BOOST_CHECK(R1S.ToString() == ArrayToString(R1Array,20)); BOOST_CHECK(R2L.ToString() == ArrayToString(R2Array,32)); - BOOST_CHECK(R2S.ToString() == ArrayToString(R2Array,20)); BOOST_CHECK(ZeroL.ToString() == ArrayToString(ZeroArray,32)); - BOOST_CHECK(ZeroS.ToString() == ArrayToString(ZeroArray,20)); BOOST_CHECK(OneL.ToString() == ArrayToString(OneArray,32)); - BOOST_CHECK(OneS.ToString() == ArrayToString(OneArray,20)); BOOST_CHECK(MaxL.ToString() == ArrayToString(MaxArray,32)); - BOOST_CHECK(MaxS.ToString() == ArrayToString(MaxArray,20)); BOOST_CHECK(OneL.ToString() != ArrayToString(ZeroArray,32)); - BOOST_CHECK(OneS.ToString() != ArrayToString(ZeroArray,20)); // == and != - BOOST_CHECK(R1L != R2L && R1S != R2S); - BOOST_CHECK(ZeroL != OneL && ZeroS != OneS); - BOOST_CHECK(OneL != ZeroL && OneS != ZeroS); - BOOST_CHECK(MaxL != ZeroL && MaxS != ZeroS); - BOOST_CHECK(~MaxL == ZeroL && ~MaxS == ZeroS); + BOOST_CHECK(R1L != R2L); + BOOST_CHECK(ZeroL != OneL); + BOOST_CHECK(OneL != ZeroL); + BOOST_CHECK(MaxL != ZeroL); + BOOST_CHECK(~MaxL == ZeroL); BOOST_CHECK( ((R1L ^ R2L) ^ R1L) == R2L); - BOOST_CHECK( ((R1S ^ R2S) ^ R1S) == R2S); uint64_t Tmp64 = 0xc4dab720d9c7acaaULL; for (unsigned int i = 0; i < 256; ++i) @@ -99,15 +85,6 @@ BOOST_AUTO_TEST_CASE( basics ) // constructors, equality, inequality } BOOST_CHECK(ZeroL == (OneL << 256)); - for (unsigned int i = 0; i < 160; ++i) - { - BOOST_CHECK(ZeroS != (OneS << i)); - BOOST_CHECK((OneS << i) != ZeroS); - BOOST_CHECK(R1S != (R1S ^ (OneS << i))); - BOOST_CHECK(((arith_uint160(Tmp64) ^ (OneS << i) ) != Tmp64 )); - } - BOOST_CHECK(ZeroS == (OneS << 256)); - // String Constructor and Copy Constructor BOOST_CHECK(arith_uint256("0x"+R1L.ToString()) == R1L); BOOST_CHECK(arith_uint256("0x"+R2L.ToString()) == R2L); @@ -123,30 +100,11 @@ BOOST_AUTO_TEST_CASE( basics ) // constructors, equality, inequality BOOST_CHECK(arith_uint256(ZeroL) == ZeroL); BOOST_CHECK(arith_uint256(OneL) == OneL); - BOOST_CHECK(arith_uint160("0x"+R1S.ToString()) == R1S); - BOOST_CHECK(arith_uint160("0x"+R2S.ToString()) == R2S); - BOOST_CHECK(arith_uint160("0x"+ZeroS.ToString()) == ZeroS); - BOOST_CHECK(arith_uint160("0x"+OneS.ToString()) == OneS); - BOOST_CHECK(arith_uint160("0x"+MaxS.ToString()) == MaxS); - BOOST_CHECK(arith_uint160(R1S.ToString()) == R1S); - BOOST_CHECK(arith_uint160(" 0x"+R1S.ToString()+" ") == R1S); - BOOST_CHECK(arith_uint160("") == ZeroS); - BOOST_CHECK(R1S == arith_uint160(R1ArrayHex)); - - BOOST_CHECK(arith_uint160(R1S) == R1S); - BOOST_CHECK((arith_uint160(R1S^R2S)^R2S) == R1S); - BOOST_CHECK(arith_uint160(ZeroS) == ZeroS); - BOOST_CHECK(arith_uint160(OneS) == OneS); - // uint64_t constructor BOOST_CHECK( (R1L & arith_uint256("0xffffffffffffffff")) == arith_uint256(R1LLow64)); BOOST_CHECK(ZeroL == arith_uint256(0)); BOOST_CHECK(OneL == arith_uint256(1)); BOOST_CHECK(arith_uint256("0xffffffffffffffff") = arith_uint256(0xffffffffffffffffULL)); - BOOST_CHECK( (R1S & arith_uint160("0xffffffffffffffff")) == arith_uint160(R1LLow64)); - BOOST_CHECK(ZeroS == arith_uint160(0)); - BOOST_CHECK(OneS == arith_uint160(1)); - BOOST_CHECK(arith_uint160("0xffffffffffffffff") = arith_uint160(0xffffffffffffffffULL)); // Assignment (from base_uint) arith_uint256 tmpL = ~ZeroL; BOOST_CHECK(tmpL == ~ZeroL); @@ -154,17 +112,10 @@ BOOST_AUTO_TEST_CASE( basics ) // constructors, equality, inequality tmpL = ~R1L; BOOST_CHECK(tmpL == ~R1L); tmpL = ~R2L; BOOST_CHECK(tmpL == ~R2L); tmpL = ~MaxL; BOOST_CHECK(tmpL == ~MaxL); - arith_uint160 tmpS = ~ZeroS; BOOST_CHECK(tmpS == ~ZeroS); - tmpS = ~OneS; BOOST_CHECK(tmpS == ~OneS); - tmpS = ~R1S; BOOST_CHECK(tmpS == ~R1S); - tmpS = ~R2S; BOOST_CHECK(tmpS == ~R2S); - tmpS = ~MaxS; BOOST_CHECK(tmpS == ~MaxS); // Wrong length must throw exception. BOOST_CHECK_THROW(arith_uint256(std::vector(OneArray,OneArray+31)), uint_error); BOOST_CHECK_THROW(arith_uint256(std::vector(OneArray,OneArray+20)), uint_error); - BOOST_CHECK_THROW(arith_uint160(std::vector(OneArray,OneArray+32)), uint_error); - BOOST_CHECK_THROW(arith_uint160(std::vector(OneArray,OneArray+19)), uint_error); } void shiftArrayRight(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift) @@ -239,74 +190,27 @@ BOOST_AUTO_TEST_CASE( shifts ) { // "<<" ">>" "<<=" ">>=" for (unsigned int i = 128; i < 256; ++i) { BOOST_CHECK((c1L << i) == (c2L << (i-128))); } - - arith_uint160 TmpS; - for (unsigned int i = 0; i < 160; ++i) - { - shiftArrayLeft(TmpArray, OneArray, 20, i); - BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (OneS << i)); - TmpS = OneS; TmpS <<= i; - BOOST_CHECK(TmpS == (OneS << i)); - BOOST_CHECK((HalfS >> (159-i)) == (OneS << i)); - TmpS = HalfS; TmpS >>= (159-i); - BOOST_CHECK(TmpS == (OneS << i)); - - shiftArrayLeft(TmpArray, R1Array, 20, i); - BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (R1S << i)); - TmpS = R1S; TmpS <<= i; - BOOST_CHECK(TmpS == (R1S << i)); - - shiftArrayRight(TmpArray, R1Array, 20, i); - BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (R1S >> i)); - TmpS = R1S; TmpS >>= i; - BOOST_CHECK(TmpS == (R1S >> i)); - - shiftArrayLeft(TmpArray, MaxArray, 20, i); - BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (MaxS << i)); - TmpS = MaxS; TmpS <<= i; - BOOST_CHECK(TmpS == (MaxS << i)); - - shiftArrayRight(TmpArray, MaxArray, 20, i); - BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (MaxS >> i)); - TmpS = MaxS; TmpS >>= i; - BOOST_CHECK(TmpS == (MaxS >> i)); - } - arith_uint160 c1S = arith_uint160(0x0123456789abcdefULL); - arith_uint160 c2S = c1S << 80; - for (unsigned int i = 0; i < 80; ++i) { - BOOST_CHECK((c1S << i) == (c2S >> (80-i))); - } - for (unsigned int i = 80; i < 160; ++i) { - BOOST_CHECK((c1S << i) == (c2S << (i-80))); - } } BOOST_AUTO_TEST_CASE( unaryOperators ) // ! ~ - { - BOOST_CHECK(!ZeroL); BOOST_CHECK(!ZeroS); - BOOST_CHECK(!(!OneL));BOOST_CHECK(!(!OneS)); + BOOST_CHECK(!ZeroL); + BOOST_CHECK(!(!OneL)); for (unsigned int i = 0; i < 256; ++i) BOOST_CHECK(!(!(OneL<(TmpArray,TmpArray+32)) == (~R1L)); - BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (~R1S)); - BOOST_CHECK(-ZeroL == ZeroL); BOOST_CHECK(-ZeroS == ZeroS); + BOOST_CHECK(-ZeroL == ZeroL); BOOST_CHECK(-R1L == (~R1L)+1); - BOOST_CHECK(-R1S == (~R1S)+1); for (unsigned int i = 0; i < 256; ++i) BOOST_CHECK(-(OneL<(TmpArray,TmpArray+32)) == (_A_##L _OP_ _B_##L)); \ - for (unsigned int i = 0; i < 20; ++i) { TmpArray[i] = _A_##Array[i] _OP_ _B_##Array[i]; } \ - BOOST_CHECK(arith_uint160(std::vector(TmpArray,TmpArray+20)) == (_A_##S _OP_ _B_##S)); + BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (_A_##L _OP_ _B_##L)); #define CHECKASSIGNMENTOPERATOR(_A_,_B_,_OP_) \ - TmpL = _A_##L; TmpL _OP_##= _B_##L; BOOST_CHECK(TmpL == (_A_##L _OP_ _B_##L)); \ - TmpS = _A_##S; TmpS _OP_##= _B_##S; BOOST_CHECK(TmpS == (_A_##S _OP_ _B_##S)); + TmpL = _A_##L; TmpL _OP_##= _B_##L; BOOST_CHECK(TmpL == (_A_##L _OP_ _B_##L)); BOOST_AUTO_TEST_CASE( bitwiseOperators ) { @@ -343,7 +244,6 @@ BOOST_AUTO_TEST_CASE( bitwiseOperators ) CHECKBITWISEOPERATOR(Max,R1,&) arith_uint256 TmpL; - arith_uint160 TmpS; CHECKASSIGNMENTOPERATOR(R1,R2,|) CHECKASSIGNMENTOPERATOR(R1,R2,^) CHECKASSIGNMENTOPERATOR(R1,R2,&) @@ -362,13 +262,9 @@ BOOST_AUTO_TEST_CASE( bitwiseOperators ) uint64_t Tmp64 = 0xe1db685c9a0b47a2ULL; TmpL = R1L; TmpL |= Tmp64; BOOST_CHECK(TmpL == (R1L | arith_uint256(Tmp64))); - TmpS = R1S; TmpS |= Tmp64; BOOST_CHECK(TmpS == (R1S | arith_uint160(Tmp64))); TmpL = R1L; TmpL |= 0; BOOST_CHECK(TmpL == R1L); - TmpS = R1S; TmpS |= 0; BOOST_CHECK(TmpS == R1S); TmpL ^= 0; BOOST_CHECK(TmpL == R1L); - TmpS ^= 0; BOOST_CHECK(TmpS == R1S); TmpL ^= Tmp64; BOOST_CHECK(TmpL == (R1L ^ arith_uint256(Tmp64))); - TmpS ^= Tmp64; BOOST_CHECK(TmpS == (R1S ^ arith_uint160(Tmp64))); } BOOST_AUTO_TEST_CASE( comparison ) // <= >= < > @@ -383,16 +279,6 @@ BOOST_AUTO_TEST_CASE( comparison ) // <= >= < > BOOST_CHECK( R1L <= TmpL ); BOOST_CHECK( (R1L == TmpL) != (R1L < TmpL)); BOOST_CHECK( (TmpL == R1L) || !( R1L >= TmpL)); BOOST_CHECK(! (TmpL < R1L)); BOOST_CHECK(! (R1L > TmpL)); } - arith_uint160 TmpS; - for (unsigned int i = 0; i < 160; ++i) { - TmpS= OneS<< i; - BOOST_CHECK( TmpS >= ZeroS && TmpS > ZeroS && ZeroS < TmpS && ZeroS <= TmpS); - BOOST_CHECK( TmpS >= 0 && TmpS > 0 && 0 < TmpS && 0 <= TmpS); - TmpS |= R1S; - BOOST_CHECK( TmpS >= R1S ); BOOST_CHECK( (TmpS == R1S) != (TmpS > R1S)); BOOST_CHECK( (TmpS == R1S) || !( TmpS <= R1S)); - BOOST_CHECK( R1S <= TmpS ); BOOST_CHECK( (R1S == TmpS) != (R1S < TmpS)); BOOST_CHECK( (TmpS == R1S) || !( R1S >= TmpS)); - BOOST_CHECK(! (TmpS < R1S)); BOOST_CHECK(! (R1S > TmpS)); - } } BOOST_AUTO_TEST_CASE( plusMinus ) @@ -437,49 +323,6 @@ BOOST_AUTO_TEST_CASE( plusMinus ) } TmpL = R1L; BOOST_CHECK(--TmpL == R1L-1); - - // 160-bit; copy-pasted - arith_uint160 TmpS = 0; - BOOST_CHECK(R1S+R2S == arith_uint160(R1LplusR2L)); - TmpS += R1S; - BOOST_CHECK(TmpS == R1S); - TmpS += R2S; - BOOST_CHECK(TmpS == R1S + R2S); - BOOST_CHECK(OneS+MaxS == ZeroS); - BOOST_CHECK(MaxS+OneS == ZeroS); - for (unsigned int i = 1; i < 160; ++i) { - BOOST_CHECK( (MaxS >> i) + OneS == (HalfS >> (i-1)) ); - BOOST_CHECK( OneS + (MaxS >> i) == (HalfS >> (i-1)) ); - TmpS = (MaxS>>i); TmpS += OneS; - BOOST_CHECK( TmpS == (HalfS >> (i-1)) ); - TmpS = (MaxS>>i); TmpS += 1; - BOOST_CHECK( TmpS == (HalfS >> (i-1)) ); - TmpS = (MaxS>>i); - BOOST_CHECK( TmpS++ == (MaxS>>i) ); - BOOST_CHECK( TmpS == (HalfS >> (i-1))); - } - BOOST_CHECK(arith_uint160(0xbedc77e27940a7ULL) + 0xee8d836fce66fbULL == arith_uint160(0xbedc77e27940a7ULL + 0xee8d836fce66fbULL)); - TmpS = arith_uint160(0xbedc77e27940a7ULL); TmpS += 0xee8d836fce66fbULL; - BOOST_CHECK(TmpS == arith_uint160(0xbedc77e27940a7ULL+0xee8d836fce66fbULL)); - TmpS -= 0xee8d836fce66fbULL; BOOST_CHECK(TmpS == 0xbedc77e27940a7ULL); - TmpS = R1S; - BOOST_CHECK(++TmpS == R1S+1); - - BOOST_CHECK(R1S -(-R2S) == R1S+R2S); - BOOST_CHECK(R1S -(-OneS) == R1S+OneS); - BOOST_CHECK(R1S - OneS == R1S+(-OneS)); - for (unsigned int i = 1; i < 160; ++i) { - BOOST_CHECK((MaxS>>i) - (-OneS) == (HalfS >> (i-1))); - BOOST_CHECK((HalfS >> (i-1)) - OneS == (MaxS>>i)); - TmpS = (HalfS >> (i-1)); - BOOST_CHECK(TmpS-- == (HalfS >> (i-1))); - BOOST_CHECK(TmpS == (MaxS >> i)); - TmpS = (HalfS >> (i-1)); - BOOST_CHECK(--TmpS == (MaxS >> i)); - } - TmpS = R1S; - BOOST_CHECK(--TmpS == R1S-1); - } BOOST_AUTO_TEST_CASE( multiply ) @@ -495,28 +338,12 @@ BOOST_AUTO_TEST_CASE( multiply ) BOOST_CHECK((R2L * OneL) == R2L); BOOST_CHECK((R2L * MaxL) == -R2L); - BOOST_CHECK((R1S * R1S).ToString() == "a7761bf30d5237e9873f9bff3642a732c4d84f10"); - BOOST_CHECK((R1S * R2S).ToString() == "ba51c008df851987d9dd323f0e5de07760529c40"); - BOOST_CHECK((R1S * ZeroS) == ZeroS); - BOOST_CHECK((R1S * OneS) == R1S); - BOOST_CHECK((R1S * MaxS) == -R1S); - BOOST_CHECK((R2S * R1S) == (R1S * R2S)); - BOOST_CHECK((R2S * R2S).ToString() == "c28bb2b45a1d85ab7996ccd3e102a650f74ff100"); - BOOST_CHECK((R2S * ZeroS) == ZeroS); - BOOST_CHECK((R2S * OneS) == R2S); - BOOST_CHECK((R2S * MaxS) == -R2S); - BOOST_CHECK(MaxL * MaxL == OneL); - BOOST_CHECK(MaxS * MaxS == OneS); BOOST_CHECK((R1L * 0) == 0); BOOST_CHECK((R1L * 1) == R1L); BOOST_CHECK((R1L * 3).ToString() == "7759b1c0ed14047f961ad09b20ff83687876a0181a367b813634046f91def7d4"); BOOST_CHECK((R2L * 0x87654321UL).ToString() == "23f7816e30c4ae2017257b7a0fa64d60402f5234d46e746b61c960d09a26d070"); - BOOST_CHECK((R1S * 0) == 0); - BOOST_CHECK((R1S * 1) == R1S); - BOOST_CHECK((R1S * 7).ToString() == "f7a987f3c3bf758d927f202d7e795faeff084244"); - BOOST_CHECK((R2S * 0xFFFFFFFFUL).ToString() == "1c6f6c930353e17f7d6127213bb18d2883e2cd90"); } BOOST_AUTO_TEST_CASE( divide ) @@ -535,21 +362,6 @@ BOOST_AUTO_TEST_CASE( divide ) BOOST_CHECK(R2L / MaxL == ZeroL); BOOST_CHECK(MaxL / R2L == 1); BOOST_CHECK_THROW(R2L / ZeroL, uint_error); - - arith_uint160 D1S("D3C5EDCDEA54EB92679F0A4B4"); - arith_uint160 D2S("13037"); - BOOST_CHECK((R1S / D1S).ToString() == "0000000000000000000000000db9af3beade6c02"); - BOOST_CHECK((R1S / D2S).ToString() == "000098dfb6cc40ca592bf74366794f298ada205c"); - BOOST_CHECK(R1S / OneS == R1S); - BOOST_CHECK(R1S / MaxS == ZeroS); - BOOST_CHECK(MaxS / R1S == 1); - BOOST_CHECK_THROW(R1S / ZeroS, uint_error); - BOOST_CHECK((R2S / D1S).ToString() == "0000000000000000000000000c5608e781182047"); - BOOST_CHECK((R2S / D2S).ToString() == "00008966751b7187c3c67c1fda5cea7db2c1c069"); - BOOST_CHECK(R2S / OneS == R2S); - BOOST_CHECK(R2S / MaxS == ZeroS); - BOOST_CHECK(MaxS / R2S == 1); - BOOST_CHECK_THROW(R2S / ZeroS, uint_error); } @@ -608,70 +420,17 @@ BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 G BOOST_CHECK(MaxL == TmpL); ss.str(""); - BOOST_CHECK(R1S.GetHex() == R1S.ToString()); - BOOST_CHECK(R2S.GetHex() == R2S.ToString()); - BOOST_CHECK(OneS.GetHex() == OneS.ToString()); - BOOST_CHECK(MaxS.GetHex() == MaxS.ToString()); - arith_uint160 TmpS(R1S); - BOOST_CHECK(TmpS == R1S); - TmpS.SetHex(R2S.ToString()); BOOST_CHECK(TmpS == R2S); - TmpS.SetHex(ZeroS.ToString()); BOOST_CHECK(TmpS == 0); - TmpS.SetHex(HalfS.ToString()); BOOST_CHECK(TmpS == HalfS); - - TmpS.SetHex(R1S.ToString()); - BOOST_CHECK(memcmp(R1S.begin(), R1Array, 20)==0); - BOOST_CHECK(memcmp(TmpS.begin(), R1Array, 20)==0); - BOOST_CHECK(memcmp(R2S.begin(), R2Array, 20)==0); - BOOST_CHECK(memcmp(ZeroS.begin(), ZeroArray, 20)==0); - BOOST_CHECK(memcmp(OneS.begin(), OneArray, 20)==0); - BOOST_CHECK(R1S.size() == 20); - BOOST_CHECK(R2S.size() == 20); - BOOST_CHECK(ZeroS.size() == 20); - BOOST_CHECK(MaxS.size() == 20); - BOOST_CHECK(R1S.begin() + 20 == R1S.end()); - BOOST_CHECK(R2S.begin() + 20 == R2S.end()); - BOOST_CHECK(OneS.begin() + 20 == OneS.end()); - BOOST_CHECK(MaxS.begin() + 20 == MaxS.end()); - BOOST_CHECK(TmpS.begin() + 20 == TmpS.end()); - BOOST_CHECK(R1S.GetLow64() == R1LLow64); - BOOST_CHECK(HalfS.GetLow64() ==0x0000000000000000ULL); - BOOST_CHECK(OneS.GetLow64() ==0x0000000000000001ULL); - BOOST_CHECK(R1S.GetSerializeSize(0,PROTOCOL_VERSION) == 20); - BOOST_CHECK(ZeroS.GetSerializeSize(0,PROTOCOL_VERSION) == 20); - - R1S.Serialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(ss.str() == std::string(R1Array,R1Array+20)); - TmpS.Unserialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(R1S == TmpS); - ss.str(""); - ZeroS.Serialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(ss.str() == std::string(ZeroArray,ZeroArray+20)); - TmpS.Unserialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(ZeroS == TmpS); - ss.str(""); - MaxS.Serialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(ss.str() == std::string(MaxArray,MaxArray+20)); - TmpS.Unserialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(MaxS == TmpS); - ss.str(""); - for (unsigned int i = 0; i < 255; ++i) { BOOST_CHECK((OneL << i).getdouble() == ldexp(1.0,i)); - if (i < 160) BOOST_CHECK((OneS << i).getdouble() == ldexp(1.0,i)); } BOOST_CHECK(ZeroL.getdouble() == 0.0); - BOOST_CHECK(ZeroS.getdouble() == 0.0); for (int i = 256; i > 53; --i) BOOST_CHECK(almostEqual((R1L>>(256-i)).getdouble(), ldexp(R1Ldouble,i))); - for (int i = 160; i > 53; --i) - BOOST_CHECK(almostEqual((R1S>>(160-i)).getdouble(), ldexp(R1Sdouble,i))); uint64_t R1L64part = (R1L>>192).GetLow64(); - uint64_t R1S64part = (R1S>>96).GetLow64(); for (int i = 53; i > 0; --i) // doubles can store all integers in {0,...,2^54-1} exactly { BOOST_CHECK((R1L>>(256-i)).getdouble() == (double)(R1L64part >> (64-i))); - BOOST_CHECK((R1S>>(160-i)).getdouble() == (double)(R1S64part >> (64-i))); } } @@ -807,23 +566,20 @@ BOOST_AUTO_TEST_CASE(bignum_SetCompact) BOOST_AUTO_TEST_CASE( getmaxcoverage ) // some more tests just to get 100% coverage { // ~R1L give a base_uint<256> - BOOST_CHECK((~~R1L >> 10) == (R1L >> 10)); BOOST_CHECK((~~R1S >> 10) == (R1S >> 10)); - BOOST_CHECK((~~R1L << 10) == (R1L << 10)); BOOST_CHECK((~~R1S << 10) == (R1S << 10)); - BOOST_CHECK(!(~~R1L < R1L)); BOOST_CHECK(!(~~R1S < R1S)); - BOOST_CHECK(~~R1L <= R1L); BOOST_CHECK(~~R1S <= R1S); - BOOST_CHECK(!(~~R1L > R1L)); BOOST_CHECK(!(~~R1S > R1S)); - BOOST_CHECK(~~R1L >= R1L); BOOST_CHECK(~~R1S >= R1S); - BOOST_CHECK(!(R1L < ~~R1L)); BOOST_CHECK(!(R1S < ~~R1S)); - BOOST_CHECK(R1L <= ~~R1L); BOOST_CHECK(R1S <= ~~R1S); - BOOST_CHECK(!(R1L > ~~R1L)); BOOST_CHECK(!(R1S > ~~R1S)); - BOOST_CHECK(R1L >= ~~R1L); BOOST_CHECK(R1S >= ~~R1S); + BOOST_CHECK((~~R1L >> 10) == (R1L >> 10)); + BOOST_CHECK((~~R1L << 10) == (R1L << 10)); + BOOST_CHECK(!(~~R1L < R1L)); + BOOST_CHECK(~~R1L <= R1L); + BOOST_CHECK(!(~~R1L > R1L)); + BOOST_CHECK(~~R1L >= R1L); + BOOST_CHECK(!(R1L < ~~R1L)); + BOOST_CHECK(R1L <= ~~R1L); + BOOST_CHECK(!(R1L > ~~R1L)); + BOOST_CHECK(R1L >= ~~R1L); BOOST_CHECK(~~R1L + R2L == R1L + ~~R2L); - BOOST_CHECK(~~R1S + R2S == R1S + ~~R2S); BOOST_CHECK(~~R1L - R2L == R1L - ~~R2L); - BOOST_CHECK(~~R1S - R2S == R1S - ~~R2S); BOOST_CHECK(~R1L != R1L); BOOST_CHECK(R1L != ~R1L); - BOOST_CHECK(~R1S != R1S); BOOST_CHECK(R1S != ~R1S); unsigned char TmpArray[32]; CHECKBITWISEOPERATOR(~R1,R2,|) CHECKBITWISEOPERATOR(~R1,R2,^) From 30007fda76aa7ba4e4090f7a16298874a7722926 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 16 Dec 2014 15:47:29 +0100 Subject: [PATCH 87/88] Remove now-unused methods from arith_uint256 and base_uint - Methods that access the guts of arith_uint256 are removed, as these are incompatible between endians. Use uint256 instead - Serialization is no longer needed as arith_uint256's are never read or written - GetHash is never used on arith_uint256 --- src/arith_uint256.cpp | 62 -------------------------------- src/arith_uint256.h | 56 ----------------------------- src/test/arith_uint256_tests.cpp | 31 +--------------- 3 files changed, 1 insertion(+), 148 deletions(-) diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index 12f9e7d1b..11df3b05c 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -278,68 +278,6 @@ uint32_t arith_uint256::GetCompact(bool fNegative) const return nCompact; } -static void inline HashMix(uint32_t& a, uint32_t& b, uint32_t& c) -{ - // Taken from lookup3, by Bob Jenkins. - a -= c; - a ^= ((c << 4) | (c >> 28)); - c += b; - b -= a; - b ^= ((a << 6) | (a >> 26)); - a += c; - c -= b; - c ^= ((b << 8) | (b >> 24)); - b += a; - a -= c; - a ^= ((c << 16) | (c >> 16)); - c += b; - b -= a; - b ^= ((a << 19) | (a >> 13)); - a += c; - c -= b; - c ^= ((b << 4) | (b >> 28)); - b += a; -} - -static void inline HashFinal(uint32_t& a, uint32_t& b, uint32_t& c) -{ - // Taken from lookup3, by Bob Jenkins. - c ^= b; - c -= ((b << 14) | (b >> 18)); - a ^= c; - a -= ((c << 11) | (c >> 21)); - b ^= a; - b -= ((a << 25) | (a >> 7)); - c ^= b; - c -= ((b << 16) | (b >> 16)); - a ^= c; - a -= ((c << 4) | (c >> 28)); - b ^= a; - b -= ((a << 14) | (a >> 18)); - c ^= b; - c -= ((b << 24) | (b >> 8)); -} - -uint64_t arith_uint256::GetHash(const arith_uint256& salt) const -{ - uint32_t a, b, c; - a = b = c = 0xdeadbeef + (WIDTH << 2); - - a += pn[0] ^ salt.pn[0]; - b += pn[1] ^ salt.pn[1]; - c += pn[2] ^ salt.pn[2]; - HashMix(a, b, c); - a += pn[3] ^ salt.pn[3]; - b += pn[4] ^ salt.pn[4]; - c += pn[5] ^ salt.pn[5]; - HashMix(a, b, c); - a += pn[6] ^ salt.pn[6]; - b += pn[7] ^ salt.pn[7]; - HashFinal(a, b, c); - - return ((((uint64_t)b) << 32) | c); -} - uint256 ArithToUint256(const arith_uint256 &a) { uint256 b; diff --git a/src/arith_uint256.h b/src/arith_uint256.h index b69eef676..ec8e15997 100644 --- a/src/arith_uint256.h +++ b/src/arith_uint256.h @@ -232,26 +232,6 @@ public: void SetHex(const std::string& str); std::string ToString() const; - unsigned char* begin() - { - return (unsigned char*)&pn[0]; - } - - unsigned char* end() - { - return (unsigned char*)&pn[WIDTH]; - } - - const unsigned char* begin() const - { - return (unsigned char*)&pn[0]; - } - - const unsigned char* end() const - { - return (unsigned char*)&pn[WIDTH]; - } - unsigned int size() const { return sizeof(pn); @@ -268,40 +248,6 @@ public: assert(WIDTH >= 2); return pn[0] | (uint64_t)pn[1] << 32; } - - unsigned int GetSerializeSize(int nType, int nVersion) const - { - return sizeof(pn); - } - - template - void Serialize(Stream& s, int nType, int nVersion) const - { - s.write((char*)pn, sizeof(pn)); - } - - template - void Unserialize(Stream& s, int nType, int nVersion) - { - s.read((char*)pn, sizeof(pn)); - } - - // Temporary for migration to blob160/256 - uint64_t GetCheapHash() const - { - return GetLow64(); - } - void SetNull() - { - memset(pn, 0, sizeof(pn)); - } - bool IsNull() const - { - for (int i = 0; i < WIDTH; i++) - if (pn[i] != 0) - return false; - return true; - } }; /** 256-bit unsigned big integer. */ @@ -336,8 +282,6 @@ public: arith_uint256& SetCompact(uint32_t nCompact, bool *pfNegative = NULL, bool *pfOverflow = NULL); uint32_t GetCompact(bool fNegative = false) const; - uint64_t GetHash(const arith_uint256& salt) const; - friend uint256 ArithToUint256(const arith_uint256 &); friend arith_uint256 UintToArith256(const uint256 &); }; diff --git a/src/test/arith_uint256_tests.cpp b/src/test/arith_uint256_tests.cpp index e0c4b2725..689536753 100644 --- a/src/test/arith_uint256_tests.cpp +++ b/src/test/arith_uint256_tests.cpp @@ -370,7 +370,7 @@ bool almostEqual(double d1, double d2) return fabs(d1-d2) <= 4*fabs(d1)*std::numeric_limits::epsilon(); } -BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 GetSerializeSize, Serialize, Unserialize +BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex size() GetLow64 GetSerializeSize, Serialize, Unserialize { BOOST_CHECK(R1L.GetHex() == R1L.ToString()); BOOST_CHECK(R2L.GetHex() == R2L.ToString()); @@ -383,42 +383,13 @@ BOOST_AUTO_TEST_CASE( methods ) // GetHex SetHex begin() end() size() GetLow64 G TmpL.SetHex(HalfL.ToString()); BOOST_CHECK(TmpL == HalfL); TmpL.SetHex(R1L.ToString()); - BOOST_CHECK(memcmp(R1L.begin(), R1Array, 32)==0); - BOOST_CHECK(memcmp(TmpL.begin(), R1Array, 32)==0); - BOOST_CHECK(memcmp(R2L.begin(), R2Array, 32)==0); - BOOST_CHECK(memcmp(ZeroL.begin(), ZeroArray, 32)==0); - BOOST_CHECK(memcmp(OneL.begin(), OneArray, 32)==0); BOOST_CHECK(R1L.size() == 32); BOOST_CHECK(R2L.size() == 32); BOOST_CHECK(ZeroL.size() == 32); BOOST_CHECK(MaxL.size() == 32); - BOOST_CHECK(R1L.begin() + 32 == R1L.end()); - BOOST_CHECK(R2L.begin() + 32 == R2L.end()); - BOOST_CHECK(OneL.begin() + 32 == OneL.end()); - BOOST_CHECK(MaxL.begin() + 32 == MaxL.end()); - BOOST_CHECK(TmpL.begin() + 32 == TmpL.end()); BOOST_CHECK(R1L.GetLow64() == R1LLow64); BOOST_CHECK(HalfL.GetLow64() ==0x0000000000000000ULL); BOOST_CHECK(OneL.GetLow64() ==0x0000000000000001ULL); - BOOST_CHECK(R1L.GetSerializeSize(0,PROTOCOL_VERSION) == 32); - BOOST_CHECK(ZeroL.GetSerializeSize(0,PROTOCOL_VERSION) == 32); - - std::stringstream ss; - R1L.Serialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(ss.str() == std::string(R1Array,R1Array+32)); - TmpL.Unserialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(R1L == TmpL); - ss.str(""); - ZeroL.Serialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(ss.str() == std::string(ZeroArray,ZeroArray+32)); - TmpL.Unserialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(ZeroL == TmpL); - ss.str(""); - MaxL.Serialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(ss.str() == std::string(MaxArray,MaxArray+32)); - TmpL.Unserialize(ss,0,PROTOCOL_VERSION); - BOOST_CHECK(MaxL == TmpL); - ss.str(""); for (unsigned int i = 0; i < 255; ++i) { From 6bd0dc2a845b4d17d5ffabbdadda80d47d6c2dc3 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 19 Dec 2014 13:07:07 +0100 Subject: [PATCH 88/88] arith_uint256: remove initialization from byte vector Remove initialization from vector (as this is only used in the tests). Also implement SetHex and GetHex in terms of uint256, to avoid duplicate code as well as avoid endianness issues (as they work in term of bytes). --- src/arith_uint256.cpp | 39 ++------------------------------ src/arith_uint256.h | 2 -- src/test/arith_uint256_tests.cpp | 35 +++++++++++++++------------- 3 files changed, 21 insertions(+), 55 deletions(-) diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index 11df3b05c..1243823da 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -17,14 +17,6 @@ base_uint::base_uint(const std::string& str) SetHex(str); } -template -base_uint::base_uint(const std::vector& vch) -{ - if (vch.size() != sizeof(pn)) - throw uint_error("Converting vector of wrong size to base_uint"); - memcpy(pn, &vch[0], sizeof(pn)); -} - template base_uint& base_uint::operator<<=(unsigned int shift) { @@ -154,39 +146,13 @@ double base_uint::getdouble() const template std::string base_uint::GetHex() const { - char psz[sizeof(pn) * 2 + 1]; - for (unsigned int i = 0; i < sizeof(pn); i++) - sprintf(psz + i * 2, "%02x", ((unsigned char*)pn)[sizeof(pn) - i - 1]); - return std::string(psz, psz + sizeof(pn) * 2); + return ArithToUint256(*this).GetHex(); } template void base_uint::SetHex(const char* psz) { - memset(pn, 0, sizeof(pn)); - - // skip leading spaces - while (isspace(*psz)) - psz++; - - // skip 0x - if (psz[0] == '0' && tolower(psz[1]) == 'x') - psz += 2; - - // hex string to uint - const char* pbegin = psz; - while (::HexDigit(*psz) != -1) - psz++; - psz--; - unsigned char* p1 = (unsigned char*)pn; - unsigned char* pend = p1 + WIDTH * 4; - while (psz >= pbegin && p1 < pend) { - *p1 = ::HexDigit(*psz--); - if (psz >= pbegin) { - *p1 |= ((unsigned char)::HexDigit(*psz--) << 4); - p1++; - } - } + *this = UintToArith256(uint256S(psz)); } template @@ -218,7 +184,6 @@ unsigned int base_uint::bits() const // Explicit instantiations for base_uint<256> template base_uint<256>::base_uint(const std::string&); -template base_uint<256>::base_uint(const std::vector&); template base_uint<256>& base_uint<256>::operator<<=(unsigned int); template base_uint<256>& base_uint<256>::operator>>=(unsigned int); template base_uint<256>& base_uint<256>::operator*=(uint32_t b32); diff --git a/src/arith_uint256.h b/src/arith_uint256.h index ec8e15997..b6ba3a108 100644 --- a/src/arith_uint256.h +++ b/src/arith_uint256.h @@ -57,7 +57,6 @@ public: } explicit base_uint(const std::string& str); - explicit base_uint(const std::vector& vch); bool operator!() const { @@ -257,7 +256,6 @@ public: arith_uint256(const base_uint<256>& b) : base_uint<256>(b) {} arith_uint256(uint64_t b) : base_uint<256>(b) {} explicit arith_uint256(const std::string& str) : base_uint<256>(str) {} - explicit arith_uint256(const std::vector& vch) : base_uint<256>(vch) {} /** * The "compact" format is a representation of a whole diff --git a/src/test/arith_uint256_tests.cpp b/src/test/arith_uint256_tests.cpp index 689536753..565b02ae6 100644 --- a/src/test/arith_uint256_tests.cpp +++ b/src/test/arith_uint256_tests.cpp @@ -8,41 +8,48 @@ #include #include #include +#include "uint256.h" #include "arith_uint256.h" #include #include "version.h" BOOST_AUTO_TEST_SUITE(arith_uint256_tests) +/// Convert vector to arith_uint256, via uint256 blob +inline arith_uint256 arith_uint256V(const std::vector& vch) +{ + return UintToArith256(uint256(vch)); +} + const unsigned char R1Array[] = "\x9c\x52\x4a\xdb\xcf\x56\x11\x12\x2b\x29\x12\x5e\x5d\x35\xd2\xd2" "\x22\x81\xaa\xb5\x33\xf0\x08\x32\xd5\x56\xb1\xf9\xea\xe5\x1d\x7d"; const char R1ArrayHex[] = "7D1DE5EAF9B156D53208F033B5AA8122D2d2355d5e12292b121156cfdb4a529c"; const double R1Ldouble = 0.4887374590559308955; // R1L equals roughly R1Ldouble * 2^256 -const arith_uint256 R1L = arith_uint256(std::vector(R1Array,R1Array+32)); +const arith_uint256 R1L = arith_uint256V(std::vector(R1Array,R1Array+32)); const uint64_t R1LLow64 = 0x121156cfdb4a529cULL; const unsigned char R2Array[] = "\x70\x32\x1d\x7c\x47\xa5\x6b\x40\x26\x7e\x0a\xc3\xa6\x9c\xb6\xbf" "\x13\x30\x47\xa3\x19\x2d\xda\x71\x49\x13\x72\xf0\xb4\xca\x81\xd7"; -const arith_uint256 R2L = arith_uint256(std::vector(R2Array,R2Array+32)); +const arith_uint256 R2L = arith_uint256V(std::vector(R2Array,R2Array+32)); const char R1LplusR2L[] = "549FB09FEA236A1EA3E31D4D58F1B1369288D204211CA751527CFC175767850C"; const unsigned char ZeroArray[] = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; -const arith_uint256 ZeroL = arith_uint256(std::vector(ZeroArray,ZeroArray+32)); +const arith_uint256 ZeroL = arith_uint256V(std::vector(ZeroArray,ZeroArray+32)); const unsigned char OneArray[] = "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; -const arith_uint256 OneL = arith_uint256(std::vector(OneArray,OneArray+32)); +const arith_uint256 OneL = arith_uint256V(std::vector(OneArray,OneArray+32)); const unsigned char MaxArray[] = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"; -const arith_uint256 MaxL = arith_uint256(std::vector(MaxArray,MaxArray+32)); +const arith_uint256 MaxL = arith_uint256V(std::vector(MaxArray,MaxArray+32)); const arith_uint256 HalfL = (OneL << 255); std::string ArrayToString(const unsigned char A[], unsigned int width) @@ -112,10 +119,6 @@ BOOST_AUTO_TEST_CASE( basics ) // constructors, equality, inequality tmpL = ~R1L; BOOST_CHECK(tmpL == ~R1L); tmpL = ~R2L; BOOST_CHECK(tmpL == ~R2L); tmpL = ~MaxL; BOOST_CHECK(tmpL == ~MaxL); - - // Wrong length must throw exception. - BOOST_CHECK_THROW(arith_uint256(std::vector(OneArray,OneArray+31)), uint_error); - BOOST_CHECK_THROW(arith_uint256(std::vector(OneArray,OneArray+20)), uint_error); } void shiftArrayRight(unsigned char* to, const unsigned char* from, unsigned int arrayLength, unsigned int bitsToShift) @@ -155,7 +158,7 @@ BOOST_AUTO_TEST_CASE( shifts ) { // "<<" ">>" "<<=" ">>=" for (unsigned int i = 0; i < 256; ++i) { shiftArrayLeft(TmpArray, OneArray, 32, i); - BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (OneL << i)); + BOOST_CHECK(arith_uint256V(std::vector(TmpArray,TmpArray+32)) == (OneL << i)); TmpL = OneL; TmpL <<= i; BOOST_CHECK(TmpL == (OneL << i)); BOOST_CHECK((HalfL >> (255-i)) == (OneL << i)); @@ -163,22 +166,22 @@ BOOST_AUTO_TEST_CASE( shifts ) { // "<<" ">>" "<<=" ">>=" BOOST_CHECK(TmpL == (OneL << i)); shiftArrayLeft(TmpArray, R1Array, 32, i); - BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (R1L << i)); + BOOST_CHECK(arith_uint256V(std::vector(TmpArray,TmpArray+32)) == (R1L << i)); TmpL = R1L; TmpL <<= i; BOOST_CHECK(TmpL == (R1L << i)); shiftArrayRight(TmpArray, R1Array, 32, i); - BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (R1L >> i)); + BOOST_CHECK(arith_uint256V(std::vector(TmpArray,TmpArray+32)) == (R1L >> i)); TmpL = R1L; TmpL >>= i; BOOST_CHECK(TmpL == (R1L >> i)); shiftArrayLeft(TmpArray, MaxArray, 32, i); - BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (MaxL << i)); + BOOST_CHECK(arith_uint256V(std::vector(TmpArray,TmpArray+32)) == (MaxL << i)); TmpL = MaxL; TmpL <<= i; BOOST_CHECK(TmpL == (MaxL << i)); shiftArrayRight(TmpArray, MaxArray, 32, i); - BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (MaxL >> i)); + BOOST_CHECK(arith_uint256V(std::vector(TmpArray,TmpArray+32)) == (MaxL >> i)); TmpL = MaxL; TmpL >>= i; BOOST_CHECK(TmpL == (MaxL >> i)); } @@ -205,7 +208,7 @@ BOOST_AUTO_TEST_CASE( unaryOperators ) // ! ~ - unsigned char TmpArray[32]; for (unsigned int i = 0; i < 32; ++i) { TmpArray[i] = ~R1Array[i]; } - BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (~R1L)); + BOOST_CHECK(arith_uint256V(std::vector(TmpArray,TmpArray+32)) == (~R1L)); BOOST_CHECK(-ZeroL == ZeroL); BOOST_CHECK(-R1L == (~R1L)+1); @@ -218,7 +221,7 @@ BOOST_AUTO_TEST_CASE( unaryOperators ) // ! ~ - // element of Aarray and Barray, and then converting the result into a arith_uint256. #define CHECKBITWISEOPERATOR(_A_,_B_,_OP_) \ for (unsigned int i = 0; i < 32; ++i) { TmpArray[i] = _A_##Array[i] _OP_ _B_##Array[i]; } \ - BOOST_CHECK(arith_uint256(std::vector(TmpArray,TmpArray+32)) == (_A_##L _OP_ _B_##L)); + BOOST_CHECK(arith_uint256V(std::vector(TmpArray,TmpArray+32)) == (_A_##L _OP_ _B_##L)); #define CHECKASSIGNMENTOPERATOR(_A_,_B_,_OP_) \ TmpL = _A_##L; TmpL _OP_##= _B_##L; BOOST_CHECK(TmpL == (_A_##L _OP_ _B_##L));