3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 10:45:51 +00:00

PeerGroup: stop calculating speed stats and printing them once we chain sync has finished in a session.

This commit is contained in:
Mike Hearn 2015-05-05 17:38:47 +02:00
parent 3d5c25e3c4
commit 1d69423f7b

View File

@ -1524,6 +1524,8 @@ public class PeerGroup implements TransactionBroadcaster {
private long[] samples; private long[] samples;
private int cursor; private int cursor;
private boolean syncDone;
@Override @Override
public synchronized void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) { public synchronized void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
blocksInLastSecond++; blocksInLastSecond++;
@ -1572,8 +1574,10 @@ public class PeerGroup implements TransactionBroadcaster {
warmupSeconds = 15; warmupSeconds = 15;
} }
boolean inChainSync = chain != null && chain.getBestChainHeight() < getMostCommonChainHeight(); boolean behindPeers = chain != null && chain.getBestChainHeight() < getMostCommonChainHeight();
if (inChainSync) { if (!behindPeers)
syncDone = true;
if (!syncDone) {
if (warmupSeconds < 0) { if (warmupSeconds < 0) {
// Calculate the moving average. // Calculate the moving average.
samples[cursor++] = bytesInLastSecond; samples[cursor++] = bytesInLastSecond;