aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-05-05 19:43:14 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-05-06 11:09:19 +0200
commitaa250f0453029afbf3c903899a3770c61e389468 (patch)
treee0eee277ebf62a2e20dc78a97c8868750651e12f /src/qt/clientmodel.cpp
parentd4ffe4e425b5a3f6fe4ff0ce7297608dfe6c7417 (diff)
downloadbitcoin-aa250f0453029afbf3c903899a3770c61e389468.tar.xz
Remove NumBlocksOfPeers
Generally useless information. Only updates on connect time, not after that. Peers can easily lie and the median filter is not effective in preventing that. In the past it was used for progress display in the GUI but `CheckPoints::guessVerificationProgress` provides a better way that is now used. It was too easy to mislead it. Peers do lie about it in practice, see issue #4065. From the RPC, `getpeerinfo` gives the peer raw values, which are more useful.
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r--src/qt/clientmodel.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 3c0564c208..d1f68ebd22 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -23,7 +23,7 @@ static const int64_t nClientStartupTime = GetTime();
ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
QObject(parent), optionsModel(optionsModel),
- cachedNumBlocks(0), cachedNumBlocksOfPeers(0),
+ cachedNumBlocks(0),
cachedReindexing(0), cachedImporting(0),
numBlocksAtStartup(-1), pollTimer(0)
{
@@ -101,19 +101,16 @@ void ClientModel::updateTimer()
// Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change.
// Periodically check and update with a timer.
int newNumBlocks = getNumBlocks();
- int newNumBlocksOfPeers = getNumBlocksOfPeers();
// check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state
- if (cachedNumBlocks != newNumBlocks || cachedNumBlocksOfPeers != newNumBlocksOfPeers ||
+ if (cachedNumBlocks != newNumBlocks ||
cachedReindexing != fReindex || cachedImporting != fImporting)
{
cachedNumBlocks = newNumBlocks;
- cachedNumBlocksOfPeers = newNumBlocksOfPeers;
cachedReindexing = fReindex;
cachedImporting = fImporting;
- // ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI
- emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks));
+ emit numBlocksChanged(newNumBlocks);
}
emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
@@ -166,11 +163,6 @@ enum BlockSource ClientModel::getBlockSource() const
return BLOCK_SOURCE_NONE;
}
-int ClientModel::getNumBlocksOfPeers() const
-{
- return GetNumBlocksOfPeers();
-}
-
QString ClientModel::getStatusBarWarnings() const
{
return QString::fromStdString(GetWarnings("statusbar"));