mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-11 21:22:47 +01:00
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.
This commit is contained in:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user