mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
Bitcoin-Qt: never display own block count > estimated block count
- some users reported it as weird, that the estimated block count could be lower than our own nodes block number (which is indeed true and not good) - this pull adds a new default behaviour, which displays our own block number as estimated block number, if own >= est. block count - the pull raises space for nodes block counts in cPeerBlockCounts to 8 to be more accurate - also removes a reduntant setNumBlocks() call in RPCConsole and moves initialisation of numBlocksAtStartup in ClientModel, where it belongs
This commit is contained in:
@@ -15,10 +15,8 @@ static const int64 nClientStartupTime = GetTime();
|
||||
|
||||
ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
|
||||
QObject(parent), optionsModel(optionsModel),
|
||||
cachedNumBlocks(0), cachedNumBlocksOfPeers(0), pollTimer(0)
|
||||
cachedNumBlocks(0), cachedNumBlocksOfPeers(0), numBlocksAtStartup(-1), pollTimer(0)
|
||||
{
|
||||
numBlocksAtStartup = -1;
|
||||
|
||||
pollTimer = new QTimer(this);
|
||||
pollTimer->setInterval(MODEL_UPDATE_DELAY);
|
||||
pollTimer->start();
|
||||
@@ -65,7 +63,8 @@ void ClientModel::updateTimer()
|
||||
cachedNumBlocks = newNumBlocks;
|
||||
cachedNumBlocksOfPeers = newNumBlocksOfPeers;
|
||||
|
||||
emit numBlocksChanged(newNumBlocks, newNumBlocksOfPeers);
|
||||
// ensure we return the maximum of newNumBlocksOfPeers and newNumBlocks to not create weird displays in the GUI
|
||||
emit numBlocksChanged(newNumBlocks, std::max(newNumBlocksOfPeers, newNumBlocks));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user