diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-01-02 18:38:26 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2018-01-02 18:38:26 +0800 |
commit | 9c42a41ed81c0f138236b4ee6490a63092bea3fa (patch) | |
tree | 7f32f14fb7eaaa8788f9ba7019eb4756995c82a2 /eth | |
parent | 2fe07c203ee7ceae313cedc236d8ef7771768c1c (diff) | |
download | go-tangerine-9c42a41ed81c0f138236b4ee6490a63092bea3fa.tar go-tangerine-9c42a41ed81c0f138236b4ee6490a63092bea3fa.tar.gz go-tangerine-9c42a41ed81c0f138236b4ee6490a63092bea3fa.tar.bz2 go-tangerine-9c42a41ed81c0f138236b4ee6490a63092bea3fa.tar.lz go-tangerine-9c42a41ed81c0f138236b4ee6490a63092bea3fa.tar.xz go-tangerine-9c42a41ed81c0f138236b4ee6490a63092bea3fa.tar.zst go-tangerine-9c42a41ed81c0f138236b4ee6490a63092bea3fa.zip |
eth/downloader: avoid hidden reference to finished statesync request (#15545)
Diffstat (limited to 'eth')
-rw-r--r-- | eth/downloader/statesync.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/eth/downloader/statesync.go b/eth/downloader/statesync.go index a0b05c9be..937828b94 100644 --- a/eth/downloader/statesync.go +++ b/eth/downloader/statesync.go @@ -132,7 +132,10 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync { // Send the next finished request to the current sync: case deliverReqCh <- deliverReq: - finished = append(finished[:0], finished[1:]...) + // Shift out the first request, but also set the emptied slot to nil for GC + copy(finished, finished[1:]) + finished[len(finished)-1] = nil + finished = finished[:len(finished)-1] // Handle incoming state packs: case pack := <-d.stateCh: |