diff options
-rw-r--r-- | configure.ac | 67 | ||||
-rw-r--r-- | depends/packages/boost.mk | 1 | ||||
-rw-r--r-- | doc/bootstrap.md | 26 | ||||
-rw-r--r-- | doc/img/bootstrap3.png | bin | 56598 -> 0 bytes | |||
-rw-r--r-- | qa/rpc-tests/util.py | 2 | ||||
-rw-r--r-- | src/Makefile.am | 11 | ||||
-rw-r--r-- | src/bitcoin-cli.cpp | 1 | ||||
-rw-r--r-- | src/coincontrol.h | 4 | ||||
-rw-r--r-- | src/hash.cpp | 4 | ||||
-rw-r--r-- | src/init.cpp | 6 | ||||
-rw-r--r-- | src/key.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 10 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 6 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 1 | ||||
-rw-r--r-- | src/qt/forms/rpcconsole.ui | 2 | ||||
-rw-r--r-- | src/qt/optionsdialog.cpp | 7 | ||||
-rw-r--r-- | src/qt/optionsdialog.h | 2 | ||||
-rw-r--r-- | src/qt/trafficgraphwidget.cpp | 8 | ||||
-rw-r--r-- | src/random.cpp | 5 | ||||
-rw-r--r-- | src/random.h | 2 | ||||
-rw-r--r-- | src/script/sign.cpp | 8 | ||||
-rw-r--r-- | src/script/sign.h | 2 | ||||
-rw-r--r-- | src/wallet.cpp | 6 |
23 files changed, 86 insertions, 97 deletions
diff --git a/configure.ac b/configure.ac index 17efd987ac..837810401a 100644 --- a/configure.ac +++ b/configure.ac @@ -14,42 +14,14 @@ AC_CONFIG_MACRO_DIR([build-aux/m4]) AC_CANONICAL_HOST -dnl By default, libtool for mingw refuses to link static libs into a dll for -dnl fear of mixing pic/non-pic objects, and import/export complications. Since -dnl we have those under control, re-enable that functionality. - -case $host in - *mingw*) - lt_cv_deplibs_check_method="pass_all" - ;; -esac - -LT_INIT([disable-shared]) - AH_TOP([#ifndef BITCOIN_CONFIG_H]) AH_TOP([#define BITCOIN_CONFIG_H]) AH_BOTTOM([#endif //BITCOIN_CONFIG_H]) -# This m4 will only be used if a system copy cannot be found. This is helpful -# on systems where autotools are installed but the pkg-config macros are not in -# a default location. It is currently used for building on OSX where autotools -# are preinstalled but pkg-config comes from macports or homebrew. It should -# probably be removed when building on <= 10.6 is no longer supported. -m4_include([pkg.m4]) - dnl faketime breaks configure and is only needed for make. Disable it here. unset FAKETIME -if test "x${CXXFLAGS+set}" = "xset"; then - CXXFLAGS_overridden=yes -else - CXXFLAGS_overridden=no -fi - -dnl ============================================================== -dnl Setup for automake -dnl ============================================================== - +dnl Automake init set-up and checks AM_INIT_AUTOMAKE([no-define subdir-objects foreign]) dnl faketime messes with timestamps and causes configure to be re-run. @@ -59,17 +31,27 @@ AM_MAINTAINER_MODE([enable]) dnl make the compilation flags quiet unless V=1 is used m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -dnl Checks for programs. +dnl Compiler checks (here before libtool). +if test "x${CXXFLAGS+set}" = "xset"; then + CXXFLAGS_overridden=yes +else + CXXFLAGS_overridden=no +fi AC_PROG_CXX -AC_PROG_CC -AC_PROG_CPP -AC_PROG_CXXCPP -AC_PROG_INSTALL -AC_PROG_OBJC -AC_PROG_LN_S m4_ifdef([AC_PROG_OBJCXX],[AC_PROG_OBJCXX]) -AC_PROG_MKDIR_P -AC_PROG_SED + +dnl By default, libtool for mingw refuses to link static libs into a dll for +dnl fear of mixing pic/non-pic objects, and import/export complications. Since +dnl we have those under control, re-enable that functionality. +case $host in + *mingw*) + lt_cv_deplibs_check_method="pass_all" + ;; +esac +dnl Libtool init checks. +LT_INIT([disable-shared]) + +dnl Check/return PATH for base programs. AC_PATH_TOOL(AR, ar) AC_PATH_TOOL(RANLIB, ranlib) AC_PATH_TOOL(STRIP, strip) @@ -81,6 +63,15 @@ AC_PATH_PROG([GIT], [git]) AC_PATH_PROG(CCACHE,ccache) AC_PATH_PROG(XGETTEXT,xgettext) AC_PATH_PROG(HEXDUMP,hexdump) + +# This m4 will only be used if a system copy cannot be found. This is helpful +# on systems where autotools are installed but the pkg-config macros are not in +# a default location. It is currently used for building on OSX where autotools +# are preinstalled but pkg-config comes from macports or homebrew. It should +# probably be removed when building on <= 10.6 is no longer supported. +m4_include([pkg.m4]) + +dnl pkg-config check. PKG_PROG_PKG_CONFIG # Enable wallet diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk index 98ed3de772..53c4c3c74e 100644 --- a/depends/packages/boost.mk +++ b/depends/packages/boost.mk @@ -21,6 +21,7 @@ $(package)_archiver_$(host_os)=$($(package)_ar) $(package)_toolset_darwin=darwin $(package)_archiver_darwin=$($(package)_libtool) $(package)_config_libraries=chrono,filesystem,program_options,system,thread,test +$(package)_cxxflags=-fvisibility=hidden $(package)_cxxflags_x86_64_linux=-fPIC $(package)_cxxflags_arm_linux=-fPIC endef diff --git a/doc/bootstrap.md b/doc/bootstrap.md index 7ce71abaad..b84fd24b11 100644 --- a/doc/bootstrap.md +++ b/doc/bootstrap.md @@ -1,41 +1,31 @@ ### Bootstrap the Blockchain Synchronization -Normally the Bitcoin client will download the transaction and network information, called the blockchain, from the network by syncing with the other clients. This can be a process that can take multiple days as the [Bitcoin block chain](https://blockchain.info/charts/blocks-size) has grown to more than 15 gigabytes, and is growing almost a gigabyte every month. Luckily there is a safe and fast way to speed up this process. We’ll show you how to bootstrap your blockchain to bring your client up to speed in just a few simple steps. +Normally the Bitcoin client will download the transaction and network information, called the blockchain, from the network by syncing with the other clients. This process can take quite some time as the [Bitcoin blockchain](https://blockchain.info/charts/blocks-size) is growing bigger and bigger for each day. Luckily there is a safe and fast way to speed up this process. We'll show you how to bootstrap your blockchain to bring your client up to speed in just a few simple steps. ### Requirements - A fresh install of the Bitcoin client software. -### Download the blockchain via Bittorent +### Download the blockchain via BitTorrent -Jeff Garzik, Bitcoin core developer, offers an [torrent file](https://bitcointalk.org/index.php?topic=145386.0) for bootstrapping purposes that is updated often. Bittorrent is a protocol that speeds up the downloading of large files by using the other clients in the network. Examples of free and safe open-source clients are [Deluge](http://deluge-torrent.org/) or [QBittorent](http://www.qbittorrent.org/). A guide to installing and configuring the torrent clients can be found [here](http://dev.deluge-torrent.org/wiki/UserGuide) for Deluge and [here](http://qbforums.shiki.hu/) for QBittorent. A further in-depth tutorial on Bittorent can be found [here](http://www.howtogeek.com/howto/31846/bittorrent-for-beginners-how-get-started-downloading-torrents/). +Jeff Garzik, Bitcoin Core developer, offers an [torrent file](https://bitcointalk.org/index.php?topic=145386.0) for bootstrapping purposes that is updated often. BitTorrent is a protocol that speeds up the downloading of large files by using the other clients in the network. Examples of free and safe open source clients are [Deluge](http://deluge-torrent.org/) or [qBittorrent](http://www.qbittorrent.org/). A guide to installing and configuring the torrent clients can be found [here](http://dev.deluge-torrent.org/wiki/UserGuide) for Deluge and [here](http://qbforums.shiki.hu/) for qBittorrent. A further in-depth tutorial on BitTorrent can be found [here](http://www.howtogeek.com/howto/31846/bittorrent-for-beginners-how-get-started-downloading-torrents/). -With the client installed we’ll proceed to download the blockchain torrent file. Use the following magnet link: +With the client installed we'll proceed to download the blockchain torrent file. Use the following magnet link: magnet:?xt=urn:btih:2d4e6c1f96c5d5fb260dff92aea4e600227f1aea&dn=bootstrap.dat&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.ccc.de:80&tr=udp://tracker.istole.it:80 - or go to [Jeff Garzik's topic](https://bitcointalk.org/index.php?topic=145386.0) for a signed magnet link. Alternately you can use the [.torrent file](http://sourceforge.net/projects/bitcoin/files/Bitcoin/blockchain/bootstrap.dat.torrent/download) found on Sourceforge. + or go to [Jeff Garzik's topic](https://bitcointalk.org/index.php?topic=145386.0) for a signed magnet link. Alternatively you can use the [.torrent file](http://sourceforge.net/projects/bitcoin/files/Bitcoin/blockchain/bootstrap.dat.torrent/download) found on SourceForge. ![Fig1](img/bootstrap1.png) The download page should look like this, with a countdown to the download. If it does not work click the direct download link. -The torrent client installed will recognize the download of the torrent file. Save the bootstrap.dat file to a folder you use for downloads. The image below shows the torrent download in QBittorent, with current speed and ETA highlighted. +The torrent client installed will recognize the download of the torrent file. Save the bootstrap.dat file to the folder you use for downloads. The image below shows the torrent download in qBittorrent, with current speed and ETA highlighted. ![Fig2](img/bootstrap2.png) -### Download the block chain directly from official repositories -The Bittorent version, see above, of the block chain download is refreshed more often than the direct download available. If Bittorent is blocked on your network then you can use the direct download method. Be sure to only use official repositories as the link displayed below. This download will only update the client to March 2013. - -Click [here](http://sourceforge.net/projects/bitcoin/files/Bitcoin/blockchain/bitcoin_blockchain_170000.zip/download) to download or copy and paste the link below. - - http://sourceforge.net/projects/bitcoin/files/Bitcoin/blockchain/bitcoin_blockchain_170000.zip/download - -The download page should look like this, with a countdown to the download. If it does not work directly click the download. Save the file to a folder you use for downloads. -![Fig3](img/bootstrap3.png) - ### Importing the blockchain -Exit the Bitcoin Client software if you have it running. Be sure not to have an actively used wallet in use. We are going to copy the download of the blockchain to the Bitcoin client data directory. You should run the client software at least once so it can generate the data directory. Copy the downloaded bootstrap.dat file into the Bitcoin data folder. +Exit the Bitcoin client software if you have it running. Be sure not to have an actively used wallet in use. We are going to copy the download of the blockchain to the Bitcoin client data directory. You should run the client software at least once so it can generate the data directory. Copy the downloaded bootstrap.dat file into the Bitcoin data folder. **For Windows users:** Open explorer, and type into the address bar: @@ -63,4 +53,4 @@ Wait until the import finishes. The client will download the last days not cover ### Is this safe? -Yes, the above method is safe. The download contains only raw block chain data and the client verifies this on import. Do not download the blockchain from unofficial sources, especially if they provide `*.rev` and `*.sst` files. These files are not verified and can contain malicious edits. +Yes, the above method is safe. The download contains only raw blockchain data and the client verifies this on import. Do not download the blockchain from unofficial sources, especially if they provide `*.rev` and `*.sst` files. These files are not verified and can contain malicious edits. diff --git a/doc/img/bootstrap3.png b/doc/img/bootstrap3.png Binary files differdeleted file mode 100644 index 8a6754e3e0..0000000000 --- a/doc/img/bootstrap3.png +++ /dev/null diff --git a/qa/rpc-tests/util.py b/qa/rpc-tests/util.py index c895eb1619..e5383b6c57 100644 --- a/qa/rpc-tests/util.py +++ b/qa/rpc-tests/util.py @@ -225,7 +225,7 @@ def gather_inputs(from_node, amount_needed): total_in += t["amount"] inputs.append({ "txid" : t["txid"], "vout" : t["vout"], "address" : t["address"] } ) if total_in < amount_needed: - raise RuntimeError("Insufficient funds: need %d, have %d"%(amount+fee*2, total_in)) + raise RuntimeError("Insufficient funds: need %d, have %d"%(amount_needed, total_in)) return (total_in, inputs) def make_change(from_node, amount_in, amount_out, fee): diff --git a/src/Makefile.am b/src/Makefile.am index 3089b2ff40..8b5d009842 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -171,6 +171,7 @@ libbitcoin_server_a_SOURCES = \ rpcnet.cpp \ rpcrawtransaction.cpp \ rpcserver.cpp \ + script/sigcache.cpp \ timedata.cpp \ txdb.cpp \ txmempool.cpp \ @@ -232,7 +233,6 @@ libbitcoin_common_a_SOURCES = \ pubkey.cpp \ script/interpreter.cpp \ script/script.cpp \ - script/sigcache.cpp \ script/sign.cpp \ script/standard.cpp \ $(BITCOIN_CORE_H) @@ -301,13 +301,10 @@ bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) # bitcoin-cli binary # bitcoin_cli_LDADD = \ $(LIBBITCOIN_CLI) \ - $(LIBBITCOIN_COMMON) \ $(LIBBITCOIN_UTIL) \ - $(LIBBITCOIN_CRYPTO) \ $(BOOST_LIBS) \ $(SSL_LIBS) \ - $(CRYPTO_LIBS) \ - $(MINIUPNPC_LIBS) + $(CRYPTO_LIBS) bitcoin_cli_SOURCES = \ bitcoin-cli.cpp @@ -330,9 +327,7 @@ if USE_LIBSECP256K1 endif bitcoin_tx_LDADD += $(BOOST_LIBS) \ - $(SSL_LIBS) \ - $(CRYPTO_LIBS) \ - $(MINIUPNPC_LIBS) + $(CRYPTO_LIBS) bitcoin_tx_SOURCES = bitcoin-tx.cpp bitcoin_tx_CPPFLAGS = $(BITCOIN_INCLUDES) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 11840e62a8..a2b95d5086 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -5,7 +5,6 @@ #include "chainparamsbase.h" #include "clientversion.h" -#include "init.h" #include "rpcclient.h" #include "rpcprotocol.h" #include "util.h" diff --git a/src/coincontrol.h b/src/coincontrol.h index c9057017d8..c8bdd3b39d 100644 --- a/src/coincontrol.h +++ b/src/coincontrol.h @@ -35,12 +35,12 @@ public: return (setSelected.count(outpt) > 0); } - void Select(COutPoint& output) + void Select(const COutPoint& output) { setSelected.insert(output); } - void UnSelect(COutPoint& output) + void UnSelect(const COutPoint& output) { setSelected.erase(output); } diff --git a/src/hash.cpp b/src/hash.cpp index 29376b45aa..2cca06ae23 100644 --- a/src/hash.cpp +++ b/src/hash.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2013-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 "hash.h" inline uint32_t ROTL32(uint32_t x, int8_t r) diff --git a/src/init.cpp b/src/init.cpp index ee93fedd25..b290d54158 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -320,7 +320,7 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += ".\n"; #ifdef ENABLE_WALLET strUsage += " -gen " + strprintf(_("Generate coins (default: %u)"), 0) + "\n"; - strUsage += " -genproclimit=<n> " + strprintf(_("Set the processor limit for when generation is on (-1 = unlimited, default: %d)"), -1) + "\n"; + strUsage += " -genproclimit=<n> " + strprintf(_("Set the number of threads for coin generation if enabled (-1 = all cores, default: %d)"), 1) + "\n"; #endif strUsage += " -help-debug " + _("Show all debugging options (usage: --help -help-debug)") + "\n"; strUsage += " -logips " + strprintf(_("Include IP addresses in debug output (default: %u)"), 0) + "\n"; @@ -749,8 +749,8 @@ bool AppInit2(boost::thread_group& threadGroup) LogPrintf("Using at most %i connections (%i file descriptors available)\n", nMaxConnections, nFD); std::ostringstream strErrors; + LogPrintf("Using %u threads for script verification\n", nScriptCheckThreads); if (nScriptCheckThreads) { - LogPrintf("Using %u threads for script verification\n", nScriptCheckThreads); for (int i=0; i<nScriptCheckThreads-1; i++) threadGroup.create_thread(&ThreadScriptCheck); } @@ -1266,7 +1266,7 @@ bool AppInit2(boost::thread_group& threadGroup) #ifdef ENABLE_WALLET // Generate coins in the background if (pwalletMain) - GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", -1)); + GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 1)); #endif // ********************************************************* Step 11: finished @@ -13,7 +13,7 @@ #include <stdexcept> #include <vector> -class CExtPubKey; +struct CExtPubKey; class CPubKey; /** diff --git a/src/main.cpp b/src/main.cpp index 9f87a11007..2bff781bfa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1760,9 +1760,9 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C } // Update the on-disk chain state. -bool static WriteChainState(CValidationState &state) { +bool static WriteChainState(CValidationState &state, bool forceWrite=false) { static int64_t nLastWrite = 0; - if (pcoinsTip->GetCacheSize() > nCoinCacheSize || (!IsInitialBlockDownload() && GetTimeMicros() > nLastWrite + 600*1000000)) { + if (forceWrite || pcoinsTip->GetCacheSize() > nCoinCacheSize || (!IsInitialBlockDownload() && GetTimeMicros() > nLastWrite + 600*1000000)) { // Typical CCoins structures on disk are around 100 bytes in size. // Pushing a new one to the database can cause it to be written // twice (once in the log, and once in the tables). This is already @@ -3022,6 +3022,8 @@ bool InitBlockIndex() { return error("LoadBlockIndex() : genesis block not accepted"); if (!ActivateBestChain(state, &block)) return error("LoadBlockIndex() : genesis block cannot be activated"); + // Force a chainstate write so that when we VerifyDB in a moment, it doesnt check stale data + return WriteChainState(state, true); } catch(std::runtime_error &e) { return error("LoadBlockIndex() : failed to initialize block database: %s", e.what()); } @@ -3157,12 +3159,14 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) } // process in case the block isn't known yet - if (mapBlockIndex.count(hash) == 0) { + if (mapBlockIndex.count(hash) == 0 || (mapBlockIndex[hash]->nStatus & BLOCK_HAVE_DATA) == 0) { CValidationState state; if (ProcessNewBlock(state, NULL, &block, dbp)) nLoaded++; if (state.IsError()) break; + } else if (hash != Params().HashGenesisBlock() && mapBlockIndex[hash]->nHeight % 1000 == 0) { + LogPrintf("Block Import: already had block %s at height %d\n", hash.ToString(), mapBlockIndex[hash]->nHeight); } // Recursively process earlier encountered successors of this block diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 77cfdceef0..450b83a8c6 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -103,9 +103,9 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) : QString windowTitle = tr("Bitcoin Core") + " - "; #ifdef ENABLE_WALLET /* if compiled with wallet support, -disablewallet can still disable the wallet */ - bool enableWallet = !GetBoolArg("-disablewallet", false); + enableWallet = !GetBoolArg("-disablewallet", false); #else - bool enableWallet = false; + enableWallet = false; #endif // ENABLE_WALLET if(enableWallet) { @@ -554,7 +554,7 @@ void BitcoinGUI::optionsClicked() if(!clientModel || !clientModel->getOptionsModel()) return; - OptionsDialog dlg(this); + OptionsDialog dlg(this, enableWallet); dlg.setModel(clientModel->getOptionsModel()); dlg.exec(); } diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 35b36811c4..662ef9d9e8 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -64,6 +64,7 @@ public: bool setCurrentWallet(const QString& name); void removeAllWallets(); #endif // ENABLE_WALLET + bool enableWallet; protected: void changeEvent(QEvent *e); diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index 898df2b080..c5ac371619 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -689,7 +689,7 @@ <item row="0" column="0" rowspan="2"> <widget class="QTableView" name="peerWidget"> <property name="horizontalScrollBarPolicy"> - <enum>Qt::ScrollBarAlwaysOff</enum> + <enum>Qt::ScrollBarAsNeeded</enum> </property> <property name="sortingEnabled"> <bool>true</bool> diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 67be174d55..f5a0759c92 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -30,7 +30,7 @@ #include <QMessageBox> #include <QTimer> -OptionsDialog::OptionsDialog(QWidget *parent) : +OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : QDialog(parent), ui(new Ui::OptionsDialog), model(0), @@ -66,6 +66,11 @@ OptionsDialog::OptionsDialog(QWidget *parent) : ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow)); #endif + /* remove Wallet tab in case of -disablewallet */ + if (!enableWallet) { + ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWallet)); + } + /* Display elements init */ QDir translations(":translations"); ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant("")); diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h index 108609610d..794a39590c 100644 --- a/src/qt/optionsdialog.h +++ b/src/qt/optionsdialog.h @@ -24,7 +24,7 @@ class OptionsDialog : public QDialog Q_OBJECT public: - explicit OptionsDialog(QWidget *parent); + explicit OptionsDialog(QWidget *parent, bool enableWallet); ~OptionsDialog(); void setModel(OptionsModel *model); diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index 74565bb6d0..5f14b80797 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -76,10 +76,12 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *) int base = floor(log10(fMax)); float val = pow(10.0f, base); - const QString units = tr("KB/s"); + const QString units = tr("KB/s"); + const float yMarginText = 2.0; + // draw lines painter.setPen(axisCol); - painter.drawText(XMARGIN, YMARGIN + h - h * val / fMax, QString("%1 %2").arg(val).arg(units)); + painter.drawText(XMARGIN, YMARGIN + h - h * val / fMax-yMarginText, QString("%1 %2").arg(val).arg(units)); for(float y = val; y < fMax; y += val) { int yy = YMARGIN + h - h * y / fMax; painter.drawLine(XMARGIN, yy, width() - XMARGIN, yy); @@ -89,7 +91,7 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *) axisCol = axisCol.darker(); val = pow(10.0f, base - 1); painter.setPen(axisCol); - painter.drawText(XMARGIN, YMARGIN + h - h * val / fMax, QString("%1 %2").arg(val).arg(units)); + painter.drawText(XMARGIN, YMARGIN + h - h * val / fMax-yMarginText, QString("%1 %2").arg(val).arg(units)); int count = 1; for(float y = val; y < fMax; y += val, count++) { // don't overwrite lines drawn above diff --git a/src/random.cpp b/src/random.cpp index 998e7dfb08..fc9505ae73 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -82,13 +82,12 @@ void RandAddSeedPerfmon() #endif } -bool GetRandBytes(unsigned char* buf, int num) +void GetRandBytes(unsigned char* buf, int num) { if (RAND_bytes(buf, num) != 1) { LogPrintf("%s: OpenSSL RAND_bytes() failed with error: %s\n", __func__, ERR_error_string(ERR_get_error(), NULL)); - return false; + assert(false); } - return true; } uint64_t GetRand(uint64_t nMax) diff --git a/src/random.h b/src/random.h index 161ebe8986..ec73d910c4 100644 --- a/src/random.h +++ b/src/random.h @@ -19,7 +19,7 @@ void RandAddSeedPerfmon(); /** * Functions to gather random data via the OpenSSL PRNG */ -bool GetRandBytes(unsigned char* buf, int num); +void GetRandBytes(unsigned char* buf, int num); uint64_t GetRand(uint64_t nMax); int GetRandInt(int nMax); uint256 GetRandHash(); diff --git a/src/script/sign.cpp b/src/script/sign.cpp index 0eab0626e5..9dfd640dfb 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -144,9 +144,9 @@ static CScript PushAll(const vector<valtype>& values) return result; } -static CScript CombineMultisig(CScript scriptPubKey, const CMutableTransaction& txTo, unsigned int nIn, +static CScript CombineMultisig(const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, const vector<valtype>& vSolutions, - vector<valtype>& sigs1, vector<valtype>& sigs2) + const vector<valtype>& sigs1, const vector<valtype>& sigs2) { // Combine all the signatures we've got: set<valtype> allsigs; @@ -199,7 +199,7 @@ static CScript CombineMultisig(CScript scriptPubKey, const CMutableTransaction& return result; } -static CScript CombineSignatures(CScript scriptPubKey, const CTransaction& txTo, unsigned int nIn, +static CScript CombineSignatures(const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, const txnouttype txType, const vector<valtype>& vSolutions, vector<valtype>& sigs1, vector<valtype>& sigs2) { @@ -244,7 +244,7 @@ static CScript CombineSignatures(CScript scriptPubKey, const CTransaction& txTo, return CScript(); } -CScript CombineSignatures(CScript scriptPubKey, const CTransaction& txTo, unsigned int nIn, +CScript CombineSignatures(const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, const CScript& scriptSig1, const CScript& scriptSig2) { txnouttype txType; diff --git a/src/script/sign.h b/src/script/sign.h index c84d3f9a94..99d5516adb 100644 --- a/src/script/sign.h +++ b/src/script/sign.h @@ -19,6 +19,6 @@ bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CMutab // Given two sets of signatures for scriptPubKey, possibly with OP_0 placeholders, // combine them intelligently and return the result. -CScript CombineSignatures(CScript scriptPubKey, const CTransaction& txTo, unsigned int nIn, const CScript& scriptSig1, const CScript& scriptSig2); +CScript CombineSignatures(const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn, const CScript& scriptSig1, const CScript& scriptSig2); #endif // BITCOIN_SCRIPT_SIGN_H diff --git a/src/wallet.cpp b/src/wallet.cpp index d392149dbb..ec439c5aad 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -422,15 +422,13 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase) RandAddSeedPerfmon(); vMasterKey.resize(WALLET_CRYPTO_KEY_SIZE); - if (!GetRandBytes(&vMasterKey[0], WALLET_CRYPTO_KEY_SIZE)) - return false; + GetRandBytes(&vMasterKey[0], WALLET_CRYPTO_KEY_SIZE); CMasterKey kMasterKey; RandAddSeedPerfmon(); kMasterKey.vchSalt.resize(WALLET_CRYPTO_SALT_SIZE); - if (!GetRandBytes(&kMasterKey.vchSalt[0], WALLET_CRYPTO_SALT_SIZE)) - return false; + GetRandBytes(&kMasterKey.vchSalt[0], WALLET_CRYPTO_SALT_SIZE); CCrypter crypter; int64_t nStartTime = GetTimeMillis(); |