Skip to content

eth/handler_eth.go

Type MOD
Upstream Lines 121
Changed +8 -0

Route PoW messages to block fetcher

diff --git a/eth/handler_eth.go b/eth/handler_eth.go
index 8704a86af..0e90bfec4 100644
--- a/eth/handler_eth.go
+++ b/eth/handler_eth.go
@@ -58,6 +58,14 @@ func (h *ethHandler) AcceptTxs() bool {
 func (h *ethHandler) Handle(peer *eth.Peer, packet eth.Packet) error {
    // Consume any broadcasts and announces, forwarding the rest to the downloader
    switch packet := packet.(type) {
+   // PoW block announcements and broadcasts (only arrive here if peer.powExt != nil)
+   case *eth.NewBlockHashesPacket:
+       hashes, numbers := packet.Unpack()
+       return h.handleBlockAnnounces(peer, hashes, numbers)
+
+   case *eth.NewBlockPacket:
+       return h.handleBlockBroadcast(peer, packet.Block, packet.TD)
+
    case *eth.NewPooledTransactionHashesPacket:
        return h.txFetcher.Notify(peer.ID(), packet.Types, packet.Sizes, packet.Hashes)

← Back to Eth Service