Skip to content

queueWithHeaders.ResetHeaders

Source (upstream pre-purge) Current
File eth/downloader/queue.go queue_pow.go
Symbol queue.Reset queueWithHeaders.ResetHeaders
Ref 45baf2111~1 etc/v1.17.3-full-node

Adapted: wraps queue.Reset with header-specific reset logic

3-way merge — purge → getc ← upstream

pre-purgecommon≈ adapted (origin inferred by similarity)fork-only
func (q *queueWithHeaders) ResetHeaders() {
q.queue.lock.Lock()
defer q.queue.lock.Unlock()
q.headerHead = common.Hash{}
q.headerPendPool = make(map[string]*fetchRequest)
}
core-geth validation — +3 -18 | | | |---|---| | File | [`queue.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/eth/downloader/queue.go) | | Symbol | `queue.Reset` | | Ref | `v1.12.20` |
--- a/core-geth/eth/downloader/queue.go
+++ b/etc/eth/downloader/queue_pow.go
@@ -1,22 +1,7 @@
-// Reset clears out the queue contents.
-func (q *queue) Reset(blockCacheLimit int, thresholdInitialSize int) {
-   q.lock.Lock()
-   defer q.lock.Unlock()
-
-   q.closed = false
-   q.mode = FullSync
+func (q *queueWithHeaders) ResetHeaders() {
+   q.queue.lock.Lock()
+   defer q.queue.lock.Unlock()

    q.headerHead = common.Hash{}
    q.headerPendPool = make(map[string]*fetchRequest)
-
-   q.blockTaskPool = make(map[common.Hash]*types.Header)
-   q.blockTaskQueue.Reset()
-   q.blockPendPool = make(map[string]*fetchRequest)
-
-   q.receiptTaskPool = make(map[common.Hash]*types.Header)
-   q.receiptTaskQueue.Reset()
-   q.receiptPendPool = make(map[string]*fetchRequest)
-
-   q.resultCache = newResultStore(blockCacheLimit)
-   q.resultCache.SetThrottleThreshold(uint64(thresholdInitialSize))
 }

← Sync & Downloader