3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-30 23:02:15 +00:00

Fix bug that could cause huge slowdowns during initial header sync: peers were not checking if they were still download peers after receiving header messages.

This commit is contained in:
Mike Hearn 2013-02-27 13:45:50 +01:00
parent a700b97f75
commit e14e7a228c

View File

@ -364,6 +364,11 @@ public class Peer {
for (int i = 0; i < m.getBlockHeaders().size(); i++) {
Block header = m.getBlockHeaders().get(i);
if (header.getTimeSeconds() < fastCatchupTimeSecs) {
if (!downloadData.get()) {
// Not download peer anymore, some other peer probably became better.
log.info("Lost download peer status, throwing away downloaded headers.");
return;
}
if (blockChain.add(header)) {
// The block was successfully linked into the chain. Notify the user of our progress.
invokeOnBlocksDownloaded(header);