aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/m4/bitcoin_qt.m412
-rw-r--r--src/main.cpp18
-rw-r--r--src/main.h1
-rw-r--r--src/qt/addresstablemodel.cpp2
-rw-r--r--src/qt/bitcoingui.cpp20
-rw-r--r--src/qt/coincontroldialog.cpp16
-rw-r--r--src/qt/forms/receivecoinsdialog.ui6
-rw-r--r--src/qt/locale/bitcoin_en.ts13
-rw-r--r--src/qt/optionsmodel.cpp23
-rw-r--r--src/qt/optionsmodel.h3
-rw-r--r--src/qt/receivecoinsdialog.cpp15
-rw-r--r--src/qt/receivecoinsdialog.h2
-rw-r--r--src/rpcmisc.cpp6
-rw-r--r--src/test/checkblock_tests.cpp3
-rw-r--r--src/test/data/script_invalid.json4
-rw-r--r--src/test/data/script_valid.json4
-rw-r--r--src/wallet.cpp7
17 files changed, 111 insertions, 44 deletions
diff --git a/src/m4/bitcoin_qt.m4 b/src/m4/bitcoin_qt.m4
index 068371e83a..e71ecd7172 100644
--- a/src/m4/bitcoin_qt.m4
+++ b/src/m4/bitcoin_qt.m4
@@ -124,12 +124,12 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
if test x$have_qt_test = xno; then
bitcoin_enable_qt_test=no
fi
- bitcoin_enable_qt_dbus=yes
- if test x$have_qt_dbus = xno; then
- bitcoin_enable_qt_dbus=no
- if test x$use_dbus = xyes; then
- AC_MSG_ERROR("libQtDBus not found. Install libQtDBus or remove --with-qtdbus.")
- fi
+ bitcoin_enable_qt_dbus=no
+ if test x$use_dbus != xno && test x$have_qt_dbus = xyes; then
+ bitcoin_enable_qt_dbus=yes
+ fi
+ if test x$use_dbus = xyes && test x$have_qt_dbus = xno; then
+ AC_MSG_ERROR("libQtDBus not found. Install libQtDBus or remove --with-qtdbus.")
fi
if test x$LUPDATE == x; then
AC_MSG_WARN("lupdate is required to update qt translations")
diff --git a/src/main.cpp b/src/main.cpp
index 5f50e05780..836c86483a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1823,7 +1823,7 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
return state.DoS(100,
error("ConnectBlock() : coinbase pays too much (actual=%d vs limit=%d)",
block.vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees)),
- REJECT_INVALID, "bad-cb-amount");
+ REJECT_INVALID, "bad-cb-amount");
if (!control.Wait())
return state.DoS(100, false);
@@ -3244,14 +3244,14 @@ void static ProcessGetData(CNode* pfrom)
int nHeight = mi->second->nHeight;
CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex);
if (pcheckpoint && nHeight < pcheckpoint->nHeight) {
- if (!chainActive.Contains(mi->second))
- {
- LogPrintf("ProcessGetData(): ignoring request for old block that isn't in the main chain\n");
- } else {
- send = true;
- }
+ if (!chainActive.Contains(mi->second))
+ {
+ LogPrintf("ProcessGetData(): ignoring request for old block that isn't in the main chain\n");
+ } else {
+ send = true;
+ }
} else {
- send = true;
+ send = true;
}
}
if (send)
@@ -3759,7 +3759,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
}
int nDoS = 0;
if (state.IsInvalid(nDoS))
- {
+ {
LogPrint("mempool", "%s from %s %s was not accepted into the memory pool: %s\n", tx.GetHash().ToString(),
pfrom->addr.ToString(), pfrom->cleanSubVer,
state.GetRejectReason());
diff --git a/src/main.h b/src/main.h
index b9c8dd7050..5ecf9d8365 100644
--- a/src/main.h
+++ b/src/main.h
@@ -427,6 +427,7 @@ class CMerkleTx : public CTransaction
{
private:
int GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const;
+
public:
uint256 hashBlock;
std::vector<uint256> vMerkleBranch;
diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp
index 2987e5fdda..dfbd445ce3 100644
--- a/src/qt/addresstablemodel.cpp
+++ b/src/qt/addresstablemodel.cpp
@@ -114,7 +114,7 @@ public:
case CT_NEW:
if(inModel)
{
- qDebug() << "AddressTablePriv::updateEntry : Warning: Got CT_NOW, but entry is already in model";
+ qDebug() << "AddressTablePriv::updateEntry : Warning: Got CT_NEW, but entry is already in model";
break;
}
parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex);
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 0ca16edb8c..da7762282a 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -673,17 +673,27 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
{
// Represent time from last generated block in human readable text
QString timeBehindText;
- if(secs < 48*60*60)
+ const int HOUR_IN_SECONDS = 60*60;
+ const int DAY_IN_SECONDS = 24*60*60;
+ const int WEEK_IN_SECONDS = 7*24*60*60;
+ const int YEAR_IN_SECONDS = 31556952; // Average length of year in Gregorian calendar
+ if(secs < 2*DAY_IN_SECONDS)
{
- timeBehindText = tr("%n hour(s)","",secs/(60*60));
+ timeBehindText = tr("%n hour(s)","",secs/HOUR_IN_SECONDS);
}
- else if(secs < 14*24*60*60)
+ else if(secs < 2*WEEK_IN_SECONDS)
{
- timeBehindText = tr("%n day(s)","",secs/(24*60*60));
+ timeBehindText = tr("%n day(s)","",secs/DAY_IN_SECONDS);
+ }
+ else if(secs < YEAR_IN_SECONDS)
+ {
+ timeBehindText = tr("%n week(s)","",secs/WEEK_IN_SECONDS);
}
else
{
- timeBehindText = tr("%n week(s)","",secs/(7*24*60*60));
+ int years = secs / YEAR_IN_SECONDS;
+ int remainder = secs % YEAR_IN_SECONDS;
+ timeBehindText = tr("%1 and %2").arg(tr("%n year(s)", "", years)).arg(tr("%n week(s)","", remainder/WEEK_IN_SECONDS));
}
progressBarLabel->setVisible(true);
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index 1e5a2efc94..9df8f180b1 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -18,7 +18,6 @@
#include <QApplication>
#include <QCheckBox>
-#include <QColor>
#include <QCursor>
#include <QDialogButtonBox>
#include <QFlags>
@@ -386,6 +385,18 @@ void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column)
if (ui->treeWidget->isEnabled()) // do not update on every click for (un)select all
CoinControlDialog::updateLabels(model, this);
}
+
+ // todo: this is a temporary qt5 fix: when clicking a parent node in tree mode, the parent node
+ // including all childs are partially selected. But the parent node should be fully selected
+ // as well as the childs. Childs should never be partially selected in the first place.
+ // Please remove this ugly fix, once the bug is solved upstream.
+#if QT_VERSION >= 0x050000
+ else if (column == COLUMN_CHECKBOX && item->childCount() > 0)
+ {
+ if (item->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked && item->child(0)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked)
+ item->setCheckState(COLUMN_CHECKBOX, Qt::Checked);
+ }
+#endif
}
// return human readable label for priority number
@@ -662,9 +673,6 @@ void CoinControlDialog::updateView()
itemWalletAddress->setFlags(flgTristate);
itemWalletAddress->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked);
- for (int i = 0; i < ui->treeWidget->columnCount(); i++)
- itemWalletAddress->setBackground(i, QColor(248, 247, 246));
-
// label
itemWalletAddress->setText(COLUMN_LABEL, sWalletLabel);
diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui
index 3e1a8bccc7..e1a0a28f81 100644
--- a/src/qt/forms/receivecoinsdialog.ui
+++ b/src/qt/forms/receivecoinsdialog.ui
@@ -263,6 +263,9 @@
<property name="text">
<string>Show</string>
</property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/edit</normaloff>:/icons/edit</iconset>
@@ -277,6 +280,9 @@
<property name="text">
<string>Remove</string>
</property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/remove</normaloff>:/icons/remove</iconset>
diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts
index 628847e030..ebcfde35c4 100644
--- a/src/qt/locale/bitcoin_en.ts
+++ b/src/qt/locale/bitcoin_en.ts
@@ -637,6 +637,19 @@ This product includes software developed by the OpenSSL Project for use in the O
</translation>
</message>
<message>
+ <location line="+0"/>
+ <source>%1 and %2</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message numerus="yes">
+ <location line="+0"/>
+ <source>%n year(s)</source>
+ <translation type="unfinished">
+ <numerusform>%n year</numerusform>
+ <numerusform>%n years</numerusform>
+ </translation>
+ </message>
+ <message>
<location line="+4"/>
<source>%1 behind</source>
<translation>%1 behind</translation>
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index 3b83a5ff62..b61fdd2301 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -30,6 +30,11 @@ OptionsModel::OptionsModel(QObject *parent) :
Init();
}
+void OptionsModel::addOverriddenOption(const std::string &option)
+{
+ strOverriddenByCommandLine += QString::fromStdString(option) + "=" + QString::fromStdString(mapArgs[option]) + " ";
+}
+
// Writes all missing QSettings with their default values
void OptionsModel::Init()
{
@@ -76,23 +81,23 @@ void OptionsModel::Init()
settings.setValue("nTransactionFee", 0);
nTransactionFee = settings.value("nTransactionFee").toLongLong(); // if -paytxfee is set, this will be overridden later in init.cpp
if (mapArgs.count("-paytxfee"))
- strOverriddenByCommandLine += "-paytxfee ";
+ addOverriddenOption("-paytxfee");
if (!settings.contains("bSpendZeroConfChange"))
settings.setValue("bSpendZeroConfChange", true);
if (!SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
- strOverriddenByCommandLine += "-spendzeroconfchange ";
+ addOverriddenOption("-spendzeroconfchange");
#endif
if (!settings.contains("nDatabaseCache"))
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString()))
- strOverriddenByCommandLine += "-dbcache ";
+ addOverriddenOption("-dbcache");
if (!settings.contains("nThreadsScriptVerif"))
settings.setValue("nThreadsScriptVerif", 0);
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
- strOverriddenByCommandLine += "-par ";
+ addOverriddenOption("-par");
// Network
if (!settings.contains("fUseUPnP"))
@@ -100,9 +105,9 @@ void OptionsModel::Init()
settings.setValue("fUseUPnP", true);
#else
settings.setValue("fUseUPnP", false);
-#endif
+#endif
if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool()))
- strOverriddenByCommandLine += "-upnp ";
+ addOverriddenOption("-upnp");
if (!settings.contains("fUseProxy"))
settings.setValue("fUseProxy", false);
@@ -110,18 +115,18 @@ void OptionsModel::Init()
settings.setValue("addrProxy", "127.0.0.1:9050");
// Only try to set -proxy, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString()))
- strOverriddenByCommandLine += "-proxy ";
+ addOverriddenOption("-proxy");
if (!settings.contains("nSocksVersion"))
settings.setValue("nSocksVersion", 5);
// Only try to set -socks, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString()))
- strOverriddenByCommandLine += "-socks ";
+ addOverriddenOption("-socks");
// Display
if (!settings.contains("language"))
settings.setValue("language", "");
if (!SoftSetArg("-lang", settings.value("language").toString().toStdString()))
- strOverriddenByCommandLine += "-lang";
+ addOverriddenOption("-lang");
language = settings.value("language").toString();
}
diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h
index a3487ddd2e..ece5ef78a4 100644
--- a/src/qt/optionsmodel.h
+++ b/src/qt/optionsmodel.h
@@ -75,6 +75,9 @@ private:
/* settings that were overriden by command-line */
QString strOverriddenByCommandLine;
+ /// Add option to list of GUI options overridden through command line/config file
+ void addOverriddenOption(const std::string &option);
+
signals:
void displayUnitChanged(int unit);
void transactionFeeChanged(qint64);
diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp
index 7539645b47..2af3949ae4 100644
--- a/src/qt/receivecoinsdialog.cpp
+++ b/src/qt/receivecoinsdialog.cpp
@@ -19,6 +19,7 @@
#include <QMessageBox>
#include <QTextDocument>
#include <QScrollBar>
+#include <QItemSelection>
ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) :
QDialog(parent),
@@ -77,6 +78,11 @@ void ReceiveCoinsDialog::setModel(WalletModel *model)
ui->recentRequestsView->horizontalHeader()->resizeSection(RecentRequestsTableModel::Amount, 100);
model->getRecentRequestsTableModel()->sort(RecentRequestsTableModel::Date, Qt::DescendingOrder);
+
+ connect(ui->recentRequestsView->selectionModel(),
+ SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
+ this,
+ SLOT(on_recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
}
}
@@ -161,6 +167,15 @@ void ReceiveCoinsDialog::on_recentRequestsView_doubleClicked(const QModelIndex &
dialog->show();
}
+void ReceiveCoinsDialog::on_recentRequestsView_selectionChanged(const QItemSelection &selected,
+ const QItemSelection &deselected)
+{
+ // Enable Show/Remove buttons only if anything is selected.
+ bool enable = !ui->recentRequestsView->selectionModel()->selectedRows().isEmpty();
+ ui->showRequestButton->setEnabled(enable);
+ ui->removeRequestButton->setEnabled(enable);
+}
+
void ReceiveCoinsDialog::on_showRequestButton_clicked()
{
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())
diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h
index 12d2235782..bfe8b3401f 100644
--- a/src/qt/receivecoinsdialog.h
+++ b/src/qt/receivecoinsdialog.h
@@ -10,6 +10,7 @@
#include <QMenu>
#include <QPoint>
#include <QVariant>
+#include <QItemSelection>
namespace Ui {
class ReceiveCoinsDialog;
@@ -51,6 +52,7 @@ private slots:
void on_showRequestButton_clicked();
void on_removeRequestButton_clicked();
void on_recentRequestsView_doubleClicked(const QModelIndex &index);
+ void on_recentRequestsView_selectionChanged(const QItemSelection &, const QItemSelection &);
void updateDisplayUnit();
void showMenu(const QPoint &);
void copyLabel();
diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp
index 353fb77b88..aa17590431 100644
--- a/src/rpcmisc.cpp
+++ b/src/rpcmisc.cpp
@@ -46,8 +46,9 @@ Value getinfo(const Array& params, bool fHelp)
" \"testnet\": true|false, (boolean) if the server is using testnet or not\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"
- " \"paytxfee\": x.xxxx, (numeric) the transaction fee set in btc\n"
" \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
+ " \"paytxfee\": x.xxxx, (numeric) the transaction fee set in btc/kb\n"
+ " \"relayfee\": x.xxxx, (numeric) minimum relay fee for non-free transactions in btc/kb\n"
" \"errors\": \"...\" (string) any error messages\n"
"}\n"
"\nExamples:\n"
@@ -78,10 +79,11 @@ Value getinfo(const Array& params, bool fHelp)
obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime()));
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
}
- obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee)));
if (pwalletMain && pwalletMain->IsCrypted())
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime));
+ obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee)));
#endif
+ obj.push_back(Pair("relayfee", ValueFromAmount(CTransaction::nMinRelayTxFee)));
obj.push_back(Pair("errors", GetWarnings("statusbar")));
return obj;
}
diff --git a/src/test/checkblock_tests.cpp b/src/test/checkblock_tests.cpp
index d47a33fd46..67503b200b 100644
--- a/src/test/checkblock_tests.cpp
+++ b/src/test/checkblock_tests.cpp
@@ -15,8 +15,7 @@
BOOST_AUTO_TEST_SUITE(CheckBlock_tests)
-bool
-read_block(const std::string& filename, CBlock& block)
+bool read_block(const std::string& filename, CBlock& block)
{
namespace fs = boost::filesystem;
fs::path testFile = fs::current_path() / "data" / filename;
diff --git a/src/test/data/script_invalid.json b/src/test/data/script_invalid.json
index 761cc4a008..8cb365a46f 100644
--- a/src/test/data/script_invalid.json
+++ b/src/test/data/script_invalid.json
@@ -325,5 +325,7 @@
["NOP1 0x01 1", "HASH160 0x14 0xda1745e9b549bd0bfa1a569971c77eba30cd5a4b EQUAL"],
["0 0x01 0x50", "HASH160 0x14 0xece424a6bb6ddf4db592c0faed60685047a361b1 EQUAL", "OP_RESERVED in P2SH should fail"],
-["0 0x01 VER", "HASH160 0x14 0x0f4d7845db968f2a81b530b6f3c1d6246d4c7e01 EQUAL", "OP_VER in P2SH should fail"]
+["0 0x01 VER", "HASH160 0x14 0x0f4d7845db968f2a81b530b6f3c1d6246d4c7e01 EQUAL", "OP_VER in P2SH should fail"],
+
+["0x00", "'00' EQUAL", "Basic OP_0 execution"]
]
diff --git a/src/test/data/script_valid.json b/src/test/data/script_valid.json
index e4c181cae8..3b4c191865 100644
--- a/src/test/data/script_valid.json
+++ b/src/test/data/script_valid.json
@@ -411,5 +411,7 @@
["0x4c 0x40 0x42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242",
"0x4d 0x4000 0x42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242 EQUAL",
-"Basic PUSHDATA1 signedness check"]
+"Basic PUSHDATA1 signedness check"],
+
+["0x00", "SIZE 0 EQUAL", "Basic OP_0 execution"]
]
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 4f7b96e7f2..df1eb549ad 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -589,7 +589,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet)
bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate)
{
{
- LOCK(cs_wallet);
+ AssertLockHeld(cs_wallet);
bool fExisted = mapWallet.count(hash);
if (fExisted && !fUpdate) return false;
if (fExisted || IsMine(tx) || IsFromMe(tx))
@@ -606,9 +606,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction&
void CWallet::SyncTransaction(const uint256 &hash, const CTransaction& tx, const CBlock* pblock)
{
- AddToWalletIfInvolvingMe(hash, tx, pblock, true);
-
- if (mapWallet.count(hash) == 0)
+ LOCK(cs_wallet);
+ if (!AddToWalletIfInvolvingMe(hash, tx, pblock, true))
return; // Not one of ours
// If a transaction changes 'conflicted' state, that changes the balance