eth/downloader: remove stale beacon headers as backfilling progresses (#24670)

* eth/downloader: remove stale beacon headers as backfilling progresses

* eth/downloader: remove leftover from a previous design

* eth/downloader: do partial beacon cleanups if chain is large

* eth/downloader: linter != heart
This commit is contained in:
Péter Szilágyi
2022-04-13 20:31:08 +03:00
committed by GitHub
parent ca298a2821
commit 86216189a5
3 changed files with 147 additions and 16 deletions

View File

@ -55,10 +55,11 @@ func newHookedBackfiller() backfiller {
// based on the skeleton chain as it might be invalid. The backfiller should
// gracefully handle multiple consecutive suspends without a resume, even
// on initial sartup.
func (hf *hookedBackfiller) suspend() {
func (hf *hookedBackfiller) suspend() *types.Header {
if hf.suspendHook != nil {
hf.suspendHook()
}
return nil // we don't really care about header cleanups for now
}
// resume requests the backfiller to start running fill or snap sync based on
@ -426,7 +427,6 @@ func TestSkeletonSyncExtend(t *testing.T) {
newstate: []*subchain{
{Head: 49, Tail: 49},
},
err: errReorgDenied,
},
// Initialize a sync and try to extend it with a sibling block.
{
@ -489,7 +489,7 @@ func TestSkeletonSyncExtend(t *testing.T) {
<-wait
if err := skeleton.Sync(tt.extend, false); err != tt.err {
t.Errorf("extension failure mismatch: have %v, want %v", err, tt.err)
t.Errorf("test %d: extension failure mismatch: have %v, want %v", i, err, tt.err)
}
skeleton.Terminate()