Skip to content

eth/protocols/eth/handlers_pow.go — Version Comparison

v1.16.8 v1.17.3
Branch etc/v1.16.8-full-node etc/v1.17.3-full-node
Delta +63 -0 +82 -0

Diff between branches

diff --git a/eth/protocols/eth/handlers_pow.go b/eth/protocols/eth/handlers_pow.go
index 9cccfa5f9..340e4d7cb 100644
--- a/eth/protocols/eth/handlers_pow.go
+++ b/eth/protocols/eth/handlers_pow.go
@@ -17,11 +17,30 @@
 package eth

 import (
+   "time"
+
    "github.com/ethereum/go-ethereum/core/types"
    "github.com/ethereum/go-ethereum/log"
    "github.com/ethereum/go-ethereum/trie"
 )

+func init() {
+   versionHandlers[ETH68] = map[uint64]msgHandler{
+       NewBlockHashesMsg:             handleNewBlockhashesPow,
+       NewBlockMsg:                   handleNewBlockPow,
+       TransactionsMsg:               handleTransactions,
+       NewPooledTransactionHashesMsg: handleNewPooledTransactionHashes,
+       GetBlockHeadersMsg:            handleGetBlockHeaders,
+       BlockHeadersMsg:               handleBlockHeaders,
+       GetBlockBodiesMsg:             handleGetBlockBodies,
+       BlockBodiesMsg:                handleBlockBodies,
+       GetReceiptsMsg:                handleGetReceipts69,
+       ReceiptsMsg:                   handleReceipts69,
+       GetPooledTransactionsMsg:      handleGetPooledTransactions,
+       PooledTransactionsMsg:         handlePooledTransactions,
+   }
+}
+
 func handleNewBlockhashesPow(backend Backend, msg Decoder, peer *Peer) error {
    // A batch of new block announcements just arrived
    ann := new(NewBlockHashesPacket)
@@ -53,7 +72,7 @@ func handleNewBlockPow(backend Backend, msg Decoder, peer *Peer) error {
        log.Warn("Propagated block has invalid body", "have", hash, "exp", ann.Block.TxHash())
        return nil // TODO(karalabe): return error eventually, but wait a few releases
    }
-   ann.Block.ReceivedAt = msg.Time()
+   ann.Block.ReceivedAt = time.Now()
    ann.Block.ReceivedFrom = peer

    // Mark the peer as owning the block
← Back to Version Comparison