|
|
@ -4546,12 +4546,12 @@ bool SendMessages(CNode* pto, bool fSendTrickle) |
|
|
|
LogPrintf("Peer=%d is stalling block download, disconnecting\n", pto->id); |
|
|
|
LogPrintf("Peer=%d is stalling block download, disconnecting\n", pto->id); |
|
|
|
pto->fDisconnect = true; |
|
|
|
pto->fDisconnect = true; |
|
|
|
} |
|
|
|
} |
|
|
|
// In case there is a block that has been in flight from this peer for (1 + 0.5 * N) times the block interval
|
|
|
|
// In case there is a block that has been in flight from this peer for (2 + 0.5 * N) times the block interval
|
|
|
|
// (with N the number of validated blocks that were in flight at the time it was requested), disconnect due to
|
|
|
|
// (with N the number of validated blocks that were in flight at the time it was requested), disconnect due to
|
|
|
|
// timeout. We compensate for in-flight blocks to prevent killing off peers due to our own downstream link
|
|
|
|
// timeout. We compensate for in-flight blocks to prevent killing off peers due to our own downstream link
|
|
|
|
// being saturated. We only count validated in-flight blocks so peers can't advertize nonexisting block hashes
|
|
|
|
// being saturated. We only count validated in-flight blocks so peers can't advertize nonexisting block hashes
|
|
|
|
// to unreasonably increase our timeout.
|
|
|
|
// to unreasonably increase our timeout.
|
|
|
|
if (!pto->fDisconnect && state.vBlocksInFlight.size() > 0 && state.vBlocksInFlight.front().nTime < nNow - 500000 * Params().TargetSpacing() * (2 + state.vBlocksInFlight.front().nValidatedQueuedBefore)) { |
|
|
|
if (!pto->fDisconnect && state.vBlocksInFlight.size() > 0 && state.vBlocksInFlight.front().nTime < nNow - 500000 * Params().TargetSpacing() * (4 + state.vBlocksInFlight.front().nValidatedQueuedBefore)) { |
|
|
|
LogPrintf("Timeout downloading block %s from peer=%d, disconnecting\n", state.vBlocksInFlight.front().hash.ToString(), pto->id); |
|
|
|
LogPrintf("Timeout downloading block %s from peer=%d, disconnecting\n", state.vBlocksInFlight.front().hash.ToString(), pto->id); |
|
|
|
pto->fDisconnect = true; |
|
|
|
pto->fDisconnect = true; |
|
|
|
} |
|
|
|
} |
|
|
|