aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/statesync.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/downloader/statesync.go')
-rw-r--r--eth/downloader/statesync.go5
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: