mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 11:45:51 +00:00
Adjust stall period to 15 seconds and min speed to 5 kB/s. The previous 6 seconds caused otherwise quick peers to be disconnected too often. Also, fixed a compare bug and a comment.
This commit is contained in:
parent
7e12da357c
commit
c6ee7449c3
@ -1464,9 +1464,8 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
private class ChainDownloadSpeedCalculator extends AbstractPeerEventListener implements Runnable {
|
||||
private int blocksInLastSecond, txnsInLastSecond, origTxnsInLastSecond, stallWarning;
|
||||
|
||||
private static final int STALL_PERIOD_SECONDS = 6;
|
||||
private static final int STALL_MIN_SPEED = 10;
|
||||
|
||||
private static final int STALL_PERIOD_SECONDS = 15;
|
||||
private static final int STALL_MIN_SPEED = 5;
|
||||
|
||||
@Override
|
||||
public synchronized void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft) {
|
||||
@ -1482,9 +1481,9 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
|
||||
@Override
|
||||
public synchronized void run() {
|
||||
if (blocksInLastSecond > 1) {
|
||||
if (blocksInLastSecond > 0) {
|
||||
log.info("{} blocks/sec, {} tx/sec, {} pre-filtered tx/sec", blocksInLastSecond, txnsInLastSecond, origTxnsInLastSecond);
|
||||
if (blocksInLastSecond > STALL_MIN_SPEED)
|
||||
if (blocksInLastSecond >= STALL_MIN_SPEED)
|
||||
stallWarning = 0;
|
||||
}
|
||||
if (chain != null && chain.getBestChainHeight() < getMostCommonChainHeight() && blocksInLastSecond < STALL_MIN_SPEED && stallWarning > -1) {
|
||||
@ -1492,7 +1491,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
if (stallWarning == STALL_PERIOD_SECONDS) {
|
||||
stallWarning = -1;
|
||||
Peer peer = getDownloadPeer();
|
||||
log.warn("Chain download stalled: no progress for {} seconds, disconnecting {}", STALL_PERIOD_SECONDS, peer);
|
||||
log.warn("Chain download stalled: slow progress for {} seconds, disconnecting {}", STALL_PERIOD_SECONDS, peer);
|
||||
peer.close();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user