Skip to content

Peer.SetHead

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

3-way merge — purge → getc ← upstream

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

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

← eth Protocol