Skip to content

Peer.Head

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

3-way merge — purge → getc ← upstream

pre-purge≈ adapted (origin inferred by similarity)
// Head retrieves the current head hash and total difficulty of the peer.
func (p *Peer) Head() (hash common.Hash, td *big.Int) {
p.powExt.lock.RLock()
defer p.powExt.lock.RUnlock()
copy(hash[:], p.powExt.head[:])
return hash, new(big.Int).Set(p.powExt.td)
core-geth validation — +5 -5 | | | |---|---| | File | [`peer.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/eth/protocols/eth/peer.go) | | Symbol | `Peer.Head` | | Ref | `v1.12.20` |
--- a/core-geth/eth/protocols/eth/peer.go
+++ b/etc/eth/protocols/eth/peer_pow.go
@@ -1,8 +1,8 @@
 // Head retrieves the current head hash and total difficulty of the peer.
-func (p *Peer) Head() (hash common.Hash, td, blockDifficulty *big.Int) {
-   p.lock.RLock()
-   defer p.lock.RUnlock()
+func (p *Peer) Head() (hash common.Hash, td *big.Int) {
+   p.powExt.lock.RLock()
+   defer p.powExt.lock.RUnlock()

-   copy(hash[:], p.head[:])
-   return hash, new(big.Int).Set(p.td), new(big.Int).Set(p.blockDifficulty)
+   copy(hash[:], p.powExt.head[:])
+   return hash, new(big.Int).Set(p.powExt.td)
 }

← eth Protocol