openethereum/ethcore/sync/src
Andrew Jones 4b6ebcbb61 Fix ancient blocks sync (#9531)
* Log block set in block_sync for easier debugging

* logging macros

* Match no args in sync logging macros

* Add QueueFull error

* Only allow importing headers if the first matches requested

* WIP

* Test for chain head gaps and log

* Calc distance even with 2 heads

* Revert previous commits, preparing simple fix

This reverts commit 5f38aa885b22ebb0e3a1d60120cea69f9f322628.

* Reject headers with no gaps when ChainHead

* Reset block sync download when queue full

* Simplify check for subchain heads

* Add comment to explain subchain heads filter

* Fix is_subchain_heads check and comment

* Prevent premature round completion after restart

This is a problem on mainnet where multiple stale peer requests will
force many rounds to complete quickly, forcing the retraction.

* Reset stale old blocks request after queue full

* Revert "Reject headers with no gaps when ChainHead"

This reverts commit 0eb865539e5dee37ab34f168f5fb643300de5ace.

* Add BlockSet to BlockDownloader logging

Currently it is difficult to debug this because there are two instances,
one for OldBlocks and one for NewBlocks. This adds the BlockSet to all
log messages for easy log filtering.

* Reset OldBlocks download from last enqueued

Previously when the ancient block queue was full it would restart the
download from the last imported block, so the ones still in the queue would be
redownloaded. Keeping the existing downloader instance and just
resetting it will start again from the last enqueued block.:wq

* Ignore expired Body and Receipt requests

* Log when ancient block download being restarted

* Only request old blocks from peers with >= difficulty

https://github.com/paritytech/parity-ethereum/pull/9226 might be too
permissive and causing the behaviour of the retraction soon after the
fork block. With this change the peer difficulty has to be greater than
or euqal to our syncing difficulty, so should still fix
https://github.com/paritytech/parity-ethereum/issues/9225

* Some logging and clear stalled blocks head

* Revert "Some logging and clear stalled blocks head"

This reverts commit 757641d9b817ae8b63fec684759b0815af9c4d0e.

* Reset stalled header if useless more than once

* Store useless headers in HashSet

* Add sync target to logging macro

* Don't disable useless peer and fix log macro

* Clear useless headers on reset and comments

* Use custom error for collecting blocks

Previously we resued BlockImportError, however only the Invalid case and
this made little sense with the QueueFull error.

* Remove blank line

* Test for reset sync after consecutive useless headers

* Don't reset after consecutive headers when chain head

* Delete commented out imports

* Return DownloadAction from collect_blocks instead of error

* Don't reset after round complete, was causing test hangs

* Add comment explaining reset after useless

* Replace HashSet with counter for useless headers

* Refactor sync reset on bad block/queue full

* Add missing target for log message

* Fix compiler errors and test after merge

* ethcore: revert ethereum tests submodule update
2018-10-09 15:31:40 +02:00
..
chain Fix ancient blocks sync (#9531) 2018-10-09 15:31:40 +02:00
light_sync simplify ethcore errors by removing BlockImportError (#9593) 2018-09-24 11:28:54 +01:00
res Support millisecond timestamp for instant seal engine (#9469) 2018-09-06 11:38:00 +02:00
tests Verify block syncing responses against requests (#9670) 2018-10-03 18:35:10 +08:00
api.rs Light clippy(fy) (#9473) 2018-09-06 15:44:40 +02:00
block_sync.rs Fix ancient blocks sync (#9531) 2018-10-09 15:31:40 +02:00
blocks.rs Fix ancient blocks sync (#9531) 2018-10-09 15:31:40 +02:00
lib.rs Remove unused dependencies (#9589) 2018-09-25 15:27:27 +02:00
private_tx.rs Private packets verification and queue refactoring (#8715) 2018-08-29 20:31:04 +08:00
snapshot.rs Don't fetch snapshot chunks at random (#9088) 2018-07-11 13:04:31 +02:00
sync_io.rs Update license header and scripts (#8666) 2018-06-04 10:19:50 +02:00
transactions_stats.rs Move ethereum-specific H256FastMap type to own crate (#9307) 2018-08-09 09:51:48 +02:00