Skip to content

PoWPeerExtension

Source (upstream pre-purge) Current
File eth/protocols/eth/peer.go peer_pow.go
Symbol Peer (lines 75-80) PoWPeerExtension
Ref f4d53133f~1 etc/v1.17.3-full-node

Extracted from Peer struct fields (head, td, knownBlocks, queuedBlocks, queuedBlockAnns) into a separate struct to avoid patching upstream peer.go

Diff — vs pre-nuke original (reimplemented)

--- a/eth/protocols/eth/peer.go
+++ b/eth/protocols/eth/peer_pow.go
@@ -1,6 +1,10 @@
+type PoWPeerExtension struct {
    head common.Hash // Latest advertised head block hash
    td   *big.Int    // Latest advertised head block total difficulty

    knownBlocks     *knownCache            // Set of block hashes known to be known by this peer
    queuedBlocks    chan *blockPropagation // Queue of blocks to broadcast to the peer
    queuedBlockAnns chan *types.Block      // Queue of blocks to announce to the peer
+
+   lock sync.RWMutex // Mutex protecting the internal fields
+}
core-geth validation — +7 -0 | | | |---|---| | File | [`peer.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/eth/protocols/eth/peer.go) | | Symbol | `Peer` | | Ref | `v1.12.20` |
--- a/core-geth/eth/protocols/eth/peer.go
+++ b/etc/eth/protocols/eth/peer_pow.go
@@ -1,3 +1,10 @@
+type PoWPeerExtension struct {
+   head common.Hash // Latest advertised head block hash
+   td   *big.Int    // Latest advertised head block total difficulty
+
    knownBlocks     *knownCache            // Set of block hashes known to be known by this peer
    queuedBlocks    chan *blockPropagation // Queue of blocks to broadcast to the peer
    queuedBlockAnns chan *types.Block      // Queue of blocks to announce to the peer
+
+   lock sync.RWMutex // Mutex protecting the internal fields
+}

← eth Protocol