aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am2
-rw-r--r--src/init.cpp8
-rw-r--r--src/main.cpp52
-rw-r--r--src/qt/bitcoingui.cpp9
-rw-r--r--src/qt/coincontroldialog.cpp2
-rw-r--r--src/qt/forms/modaloverlay.ui4
-rw-r--r--src/qt/modaloverlay.cpp3
-rw-r--r--src/qt/sendcoinsdialog.cpp2
-rw-r--r--src/wallet/coincontrol.h (renamed from src/coincontrol.h)6
-rw-r--r--src/wallet/rpcdump.cpp8
-rw-r--r--src/wallet/wallet.cpp2
11 files changed, 50 insertions, 48 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e7f1d82b8b..ab3104ec63 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -87,7 +87,6 @@ BITCOIN_CORE_H = \
checkpoints.h \
checkqueue.h \
clientversion.h \
- coincontrol.h \
coins.h \
compat.h \
compat/byteswap.h \
@@ -147,6 +146,7 @@ BITCOIN_CORE_H = \
utiltime.h \
validationinterface.h \
versionbits.h \
+ wallet/coincontrol.h \
wallet/crypter.h \
wallet/db.h \
wallet/rpcwallet.h \
diff --git a/src/init.cpp b/src/init.cpp
index d3efc9f978..e2f25eda74 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -960,8 +960,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
::minRelayTxFee = CFeeRate(n);
}
- fRequireStandard = !GetBoolArg("-acceptnonstdtxn", !Params().RequireStandard());
- if (Params().RequireStandard() && !fRequireStandard)
+ fRequireStandard = !GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
+ if (chainparams.RequireStandard() && !fRequireStandard)
return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString()));
nBytesPerSigOp = GetArg("-bytespersigop", nBytesPerSigOp);
@@ -996,7 +996,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (!mapMultiArgs["-bip9params"].empty()) {
// Allow overriding BIP9 parameters for testing
- if (!Params().MineBlocksOnDemand()) {
+ if (!chainparams.MineBlocksOnDemand()) {
return InitError("BIP9 parameters may only be overridden on regtest.");
}
const vector<string>& deployments = mapMultiArgs["-bip9params"];
@@ -1447,7 +1447,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
- if (Params().GetConsensus().vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout != 0) {
+ if (chainparams.GetConsensus().vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout != 0) {
// Only advertize witness capabilities if they have a reasonable start time.
// This allows us to have the code merged without a defined softfork, by setting its
// end time to 0.
diff --git a/src/main.cpp b/src/main.cpp
index 50158b4687..df4f5e3959 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3006,9 +3006,8 @@ static void NotifyHeaderTip() {
CBlockIndex* pindexHeader = NULL;
{
LOCK(cs_main);
- if (!setBlockIndexCandidates.empty()) {
- pindexHeader = *setBlockIndexCandidates.rbegin();
- }
+ pindexHeader = pindexBestHeader;
+
if (pindexHeader != pindexHeaderOld) {
fNotify = true;
fInitialBlockDownload = IsInitialBlockDownload();
@@ -5829,29 +5828,34 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
BlockTransactions resp;
vRecv >> resp;
- LOCK(cs_main);
+ CBlock block;
+ bool fBlockRead = false;
+ {
+ LOCK(cs_main);
- map<uint256, pair<NodeId, list<QueuedBlock>::iterator> >::iterator it = mapBlocksInFlight.find(resp.blockhash);
- if (it == mapBlocksInFlight.end() || !it->second.second->partialBlock ||
- it->second.first != pfrom->GetId()) {
- LogPrint("net", "Peer %d sent us block transactions for block we weren't expecting\n", pfrom->id);
- return true;
- }
+ map<uint256, pair<NodeId, list<QueuedBlock>::iterator> >::iterator it = mapBlocksInFlight.find(resp.blockhash);
+ if (it == mapBlocksInFlight.end() || !it->second.second->partialBlock ||
+ it->second.first != pfrom->GetId()) {
+ LogPrint("net", "Peer %d sent us block transactions for block we weren't expecting\n", pfrom->id);
+ return true;
+ }
- PartiallyDownloadedBlock& partialBlock = *it->second.second->partialBlock;
- CBlock block;
- ReadStatus status = partialBlock.FillBlock(block, resp.txn);
- if (status == READ_STATUS_INVALID) {
- MarkBlockAsReceived(resp.blockhash); // Reset in-flight state in case of whitelist
- Misbehaving(pfrom->GetId(), 100);
- LogPrintf("Peer %d sent us invalid compact block/non-matching block transactions\n", pfrom->id);
- return true;
- } else if (status == READ_STATUS_FAILED) {
- // Might have collided, fall back to getdata now :(
- std::vector<CInv> invs;
- invs.push_back(CInv(MSG_BLOCK | GetFetchFlags(pfrom, chainActive.Tip(), chainparams.GetConsensus()), resp.blockhash));
- pfrom->PushMessage(NetMsgType::GETDATA, invs);
- } else {
+ PartiallyDownloadedBlock& partialBlock = *it->second.second->partialBlock;
+ ReadStatus status = partialBlock.FillBlock(block, resp.txn);
+ if (status == READ_STATUS_INVALID) {
+ MarkBlockAsReceived(resp.blockhash); // Reset in-flight state in case of whitelist
+ Misbehaving(pfrom->GetId(), 100);
+ LogPrintf("Peer %d sent us invalid compact block/non-matching block transactions\n", pfrom->id);
+ return true;
+ } else if (status == READ_STATUS_FAILED) {
+ // Might have collided, fall back to getdata now :(
+ std::vector<CInv> invs;
+ invs.push_back(CInv(MSG_BLOCK | GetFetchFlags(pfrom, chainActive.Tip(), chainparams.GetConsensus()), resp.blockhash));
+ pfrom->PushMessage(NetMsgType::GETDATA, invs);
+ } else
+ fBlockRead = true;
+ } // Don't hold cs_main when we call into ProcessNewBlock
+ if (fBlockRead) {
CValidationState state;
ProcessNewBlock(state, chainparams, pfrom, &block, false, NULL);
int nDoS;
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index af767aa6c6..ee5102c4f9 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -717,13 +717,10 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
{
if (modalOverlay)
{
- if (header) {
- /* use clientmodels getHeaderTipHeight and getHeaderTipTime because the NotifyHeaderTip signal does not fire when updating the best header */
- modalOverlay->setKnownBestHeight(clientModel->getHeaderTipHeight(), QDateTime::fromTime_t(clientModel->getHeaderTipTime()));
- }
- else {
+ if (header)
+ modalOverlay->setKnownBestHeight(count, blockDate);
+ else
modalOverlay->tipUpdate(count, blockDate, nVerificationProgress);
- }
}
if (!clientModel)
return;
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index 86fd4ebd65..1a1671f0ee 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -13,7 +13,7 @@
#include "txmempool.h"
#include "walletmodel.h"
-#include "coincontrol.h"
+#include "wallet/coincontrol.h"
#include "init.h"
#include "main.h" // For minRelayTxFee
#include "wallet/wallet.h"
diff --git a/src/qt/forms/modaloverlay.ui b/src/qt/forms/modaloverlay.ui
index 73223735f5..27998f90c5 100644
--- a/src/qt/forms/modaloverlay.ui
+++ b/src/qt/forms/modaloverlay.ui
@@ -219,7 +219,7 @@ QLabel { color: rgb(40,40,40); }</string>
<item row="0" column="1">
<widget class="QLabel" name="numberOfBlocksLeft">
<property name="text">
- <string>unknown...</string>
+ <string>Unknown...</string>
</property>
</widget>
</item>
@@ -245,7 +245,7 @@ QLabel { color: rgb(40,40,40); }</string>
</sizepolicy>
</property>
<property name="text">
- <string>unknown...</string>
+ <string>Unknown...</string>
</property>
</widget>
</item>
diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp
index ae0d8f5f63..1a843a07ac 100644
--- a/src/qt/modaloverlay.cpp
+++ b/src/qt/modaloverlay.cpp
@@ -132,7 +132,8 @@ void ModalOverlay::tipUpdate(int count, const QDateTime& blockDate, double nVeri
if (estimateNumHeadersLeft < 24 && hasBestHeader) {
ui->numberOfBlocksLeft->setText(QString::number(bestHeaderHeight - count));
} else {
- ui->expectedTimeLeft->setText(tr("Unknown. Syncing Headers..."));
+ ui->numberOfBlocksLeft->setText(tr("Unknown. Syncing Headers (%1)...").arg(bestHeaderHeight));
+ ui->expectedTimeLeft->setText(tr("Unknown..."));
}
}
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index 4b2ba7d624..f1c867e6f8 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -16,7 +16,7 @@
#include "walletmodel.h"
#include "base58.h"
-#include "coincontrol.h"
+#include "wallet/coincontrol.h"
#include "main.h" // mempool and minRelayTxFee
#include "ui_interface.h"
#include "txmempool.h"
diff --git a/src/coincontrol.h b/src/wallet/coincontrol.h
index e33adc4d2b..78516770e6 100644
--- a/src/coincontrol.h
+++ b/src/wallet/coincontrol.h
@@ -2,8 +2,8 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#ifndef BITCOIN_COINCONTROL_H
-#define BITCOIN_COINCONTROL_H
+#ifndef BITCOIN_WALLET_COINCONTROL_H
+#define BITCOIN_WALLET_COINCONTROL_H
#include "primitives/transaction.h"
@@ -73,4 +73,4 @@ private:
std::set<COutPoint> setSelected;
};
-#endif // BITCOIN_COINCONTROL_H
+#endif // BITCOIN_WALLET_COINCONTROL_H
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 7b16b4adfb..b638810e9d 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -808,7 +808,7 @@ UniValue processImport(const UniValue& data) {
CBitcoinAddress pubKeyAddress = CBitcoinAddress(pubKey.GetID());
// Consistency check.
- if (!isScript && pubKeyAddress.Get() != address.Get()) {
+ if (!isScript && !(pubKeyAddress.Get() == address.Get())) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Consistency check failed");
}
@@ -819,7 +819,7 @@ UniValue processImport(const UniValue& data) {
if (ExtractDestination(script, destination)) {
scriptAddress = CBitcoinAddress(destination);
- if (scriptAddress.Get() != pubKeyAddress.Get()) {
+ if (!(scriptAddress.Get() == pubKeyAddress.Get())) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Consistency check failed");
}
}
@@ -881,7 +881,7 @@ UniValue processImport(const UniValue& data) {
CBitcoinAddress pubKeyAddress = CBitcoinAddress(pubKey.GetID());
// Consistency check.
- if (!isScript && pubKeyAddress.Get() != address.Get()) {
+ if (!isScript && !(pubKeyAddress.Get() == address.Get())) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Consistency check failed");
}
@@ -892,7 +892,7 @@ UniValue processImport(const UniValue& data) {
if (ExtractDestination(script, destination)) {
scriptAddress = CBitcoinAddress(destination);
- if (scriptAddress.Get() != pubKeyAddress.Get()) {
+ if (!(scriptAddress.Get() == pubKeyAddress.Get())) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Consistency check failed");
}
}
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index c7f98b238e..60a769704b 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -8,7 +8,7 @@
#include "base58.h"
#include "checkpoints.h"
#include "chain.h"
-#include "coincontrol.h"
+#include "wallet/coincontrol.h"
#include "consensus/consensus.h"
#include "consensus/validation.h"
#include "key.h"