aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am11
-rw-r--r--src/bitcoin-cli.cpp1
-rw-r--r--src/coincontrol.h4
-rw-r--r--src/hash.cpp4
-rw-r--r--src/init.cpp6
-rw-r--r--src/key.h2
-rw-r--r--src/main.cpp10
-rw-r--r--src/qt/bitcoingui.cpp6
-rw-r--r--src/qt/bitcoingui.h1
-rw-r--r--src/qt/forms/rpcconsole.ui2
-rw-r--r--src/qt/optionsdialog.cpp7
-rw-r--r--src/qt/optionsdialog.h2
-rw-r--r--src/qt/trafficgraphwidget.cpp8
-rw-r--r--src/random.cpp5
-rw-r--r--src/random.h2
-rw-r--r--src/script/sign.cpp8
-rw-r--r--src/script/sign.h2
-rw-r--r--src/wallet.cpp6
18 files changed, 47 insertions, 40 deletions
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
diff --git a/src/key.h b/src/key.h
index 8c2f44801d..f36e658dee 100644
--- a/src/key.h
+++ b/src/key.h
@@ -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();