Peer.Handshake68PoW¶
| Source (upstream pre-purge) | Current | |
|---|---|---|
| File | eth/protocols/eth/handshake.go |
handshake_pow.go |
| Symbol | Peer.handshake68 |
Peer.Handshake68PoW |
| Ref | 723aae2b4~1 |
etc/v1.17.4-full-node |
Derived from upstream's ETH68 handshake (Peer.handshake68) before #33511 dropped it: exported and renamed, sending and validating TD and calling InitPoWExtension. TD is bounded by BitLen <= 100 in readStatus68, matching core-geth's readStatus. ETH-mainnet peers (which share ETC's genesis hash and network ID) are separated by the fork ID via forkFilter — no TD ceiling is used, since ETC's own perpetual-PoW TD keeps rising and would eventually cross any fixed ETH threshold.
3-way merge — purge → getc ← upstream¶
pre-purge≈ adapted (origin inferred by similarity)fork-only
// Handshake68PoW executes the eth/68 protocol handshake for perpetual PoW networks.
// Unlike the standard ETH68 handshake, this version sends and receives TD (Total Difficulty)
// which is required for proper chain synchronization in PoW networks.
// After a successful handshake, it initializes the PoW extension with the peer's head info.
func (p *Peer) Handshake68PoW(networkID uint64, td *big.Int, head common.Hash, genesis common.Hash, forkID forkid.ID, forkFilter forkid.Filter) error {
↗ errc := make(chan error, 2)
go func() {
pkt := &StatusPacket68{
ProtocolVersion: uint32(p.version),
NetworkID: networkID,
TD: td,
Head: head,
≈ Genesis: genesis,
↗ ForkID: forkID,
}
errc <- p2p.Send(p.rw, StatusMsg, pkt)
}()
↗ var status StatusPacket68 // safe to read after two values have been received from errc
go func() {
≈ errc <- p.readStatus68(networkID, &status, genesis, forkFilter)
↗ }()
if err := waitForHandshake(errc, p); err != nil {
return err
}
// Initialize PoW extension with peer's head info directly
p.InitPoWExtension(status.Head, status.TD)
return nil
↗}