Skip to content

queueWithHeaders

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

Header fields extracted from pre-purge queue struct into a wrapper that embeds *queue — avoids patching upstream queue.go directly

3-way merge — purge → getc ← upstream

pre-purgecommonfork-only
type queueWithHeaders struct {
*queue // embedding - allows access to q.lock, q.mode, etc.
// Headers are "special", they download in batches, supported by a skeleton chain
headerHead common.Hash // Hash of the last queued header to verify order
headerTaskPool map[uint64]*types.Header // Pending header retrieval tasks, mapping starting indexes to skeleton headers
headerTaskQueue *prque.Prque[int64, uint64] // Priority queue of the skeleton indexes to fetch the filling headers for
headerPeerMiss map[string]map[uint64]struct{} // Set of per-peer header batches known to be unavailable
headerPendPool map[string]*fetchRequest // Currently pending header retrieval operations
headerResults []*types.Header // Result cache accumulating the completed headers
headerHashes []common.Hash // Result cache accumulating the completed header hashes
headerProced int // Number of headers already processed from the results
headerOffset uint64 // Number of the first header in the result cache
headerContCh chan bool // Channel to notify when header download finishes
}
core-geth validation — +2 -23 | | | |---|---| | File | [`queue.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/eth/downloader/queue.go) | | Symbol | `queue` | | Ref | `v1.12.20` |
--- a/core-geth/eth/downloader/queue.go
+++ b/etc/eth/downloader/queue_pow.go
@@ -1,6 +1,5 @@
-// queue represents hashes that are either need fetching or are being fetched
-type queue struct {
-   mode SyncMode // Synchronisation mode to decide on the block parts to schedule for fetching
+type queueWithHeaders struct {
+   *queue // embedding - allows access to q.lock, q.mode, etc.

    // Headers are "special", they download in batches, supported by a skeleton chain
    headerHead      common.Hash                    // Hash of the last queued header to verify order
@@ -13,24 +12,4 @@
    headerProced    int                            // Number of headers already processed from the results
    headerOffset    uint64                         // Number of the first header in the result cache
    headerContCh    chan bool                      // Channel to notify when header download finishes
-
-   // All data retrievals below are based on an already assembles header chain
-   blockTaskPool  map[common.Hash]*types.Header      // Pending block (body) retrieval tasks, mapping hashes to headers
-   blockTaskQueue *prque.Prque[int64, *types.Header] // Priority queue of the headers to fetch the blocks (bodies) for
-   blockPendPool  map[string]*fetchRequest           // Currently pending block (body) retrieval operations
-   blockWakeCh    chan bool                          // Channel to notify the block fetcher of new tasks
-
-   receiptTaskPool  map[common.Hash]*types.Header      // Pending receipt retrieval tasks, mapping hashes to headers
-   receiptTaskQueue *prque.Prque[int64, *types.Header] // Priority queue of the headers to fetch the receipts for
-   receiptPendPool  map[string]*fetchRequest           // Currently pending receipt retrieval operations
-   receiptWakeCh    chan bool                          // Channel to notify when receipt fetcher of new tasks
-
-   resultCache *resultStore       // Downloaded but not yet delivered fetch results
-   resultSize  common.StorageSize // Approximate size of a block (exponential moving average)
-
-   lock   *sync.RWMutex
-   active *sync.Cond
-   closed bool
-
-   logTime time.Time // Time instance when status was last reported
 }

← Sync & Downloader