Skip to content

queueWithHeaders.ScheduleSkeleton

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

3-way merge — purge → getc ← upstream

pre-purge≈ adapted (origin inferred by similarity)fork-only
// ScheduleSkeleton adds a batch of header retrieval tasks to the queue to fill
// up an already retrieved header skeleton.
func (q *queueWithHeaders) ScheduleSkeleton(from uint64, skeleton []*types.Header) {
q.queue.lock.Lock()
defer q.queue.lock.Unlock()
// No skeleton retrieval can be in progress, fail hard if so (huge implementation bug)
if q.headerResults != nil {
panic("skeleton assembly already in progress")
}
// Schedule all the header retrieval tasks for the skeleton assembly
q.headerTaskPool = make(map[uint64]*types.Header)
q.headerTaskQueue = prque.New[int64, uint64](nil)
q.headerPeerMiss = make(map[string]map[uint64]struct{}) // Reset availability to correct invalid chains
q.headerResults = make([]*types.Header, len(skeleton)*MaxHeaderFetch)
q.headerHashes = make([]common.Hash, len(skeleton)*MaxHeaderFetch)
q.headerProced = 0
q.headerOffset = from
q.headerContCh = make(chan bool, 1)
for i, header := range skeleton {
index := from + uint64(i*MaxHeaderFetch)
q.headerTaskPool[index] = header
q.headerTaskQueue.Push(index, -int64(index))
}
}
core-geth validation — +3 -3 | | | |---|---| | File | [`queue.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/eth/downloader/queue.go) | | Symbol | `queue.ScheduleSkeleton` | | Ref | `v1.12.20` |
--- a/core-geth/eth/downloader/queue.go
+++ b/etc/eth/downloader/queue_pow.go
@@ -1,8 +1,8 @@
 // ScheduleSkeleton adds a batch of header retrieval tasks to the queue to fill
 // up an already retrieved header skeleton.
-func (q *queue) ScheduleSkeleton(from uint64, skeleton []*types.Header) {
-   q.lock.Lock()
-   defer q.lock.Unlock()
+func (q *queueWithHeaders) ScheduleSkeleton(from uint64, skeleton []*types.Header) {
+   q.queue.lock.Lock()
+   defer q.queue.lock.Unlock()

    // No skeleton retrieval can be in progress, fail hard if so (huge implementation bug)
    if q.headerResults != nil {

← Sync & Downloader