Skip to content

cmd/devp2p/internal/ethtest/chain.go — Version Comparison

v1.16.8 v1.17.3
Branch etc/v1.16.8-full-node etc/v1.17.3-full-node
Delta +5 -1 +5 -1
ETC delta on v1.16.8 (+5 -1)
diff --git a/cmd/devp2p/internal/ethtest/chain.go b/cmd/devp2p/internal/ethtest/chain.go
index 689667a56..f695d158b 100644
--- a/cmd/devp2p/internal/ethtest/chain.go
+++ b/cmd/devp2p/internal/ethtest/chain.go
@@ -143,7 +143,11 @@ func (c *Chain) ForkID() forkid.ID {
 // TD calculates the total difficulty of the chain at the
 // chain head.
 func (c *Chain) TD() *big.Int {
-   return new(big.Int)
+   sum := new(big.Int)
+   for _, block := range c.blocks[:c.Len()] {
+       sum.Add(sum, block.Difficulty())
+   }
+   return sum
 }

 // GetBlock returns the block at the specified number.
ETC delta on v1.17.3 (+5 -1)
diff --git a/cmd/devp2p/internal/ethtest/chain.go b/cmd/devp2p/internal/ethtest/chain.go
index b44e6aa36..5a65a810b 100644
--- a/cmd/devp2p/internal/ethtest/chain.go
+++ b/cmd/devp2p/internal/ethtest/chain.go
@@ -157,7 +157,11 @@ func (c *Chain) ForkID() forkid.ID {
 // TD calculates the total difficulty of the chain at the
 // chain head.
 func (c *Chain) TD() *big.Int {
-   return new(big.Int)
+   sum := new(big.Int)
+   for _, block := range c.blocks[:c.Len()] {
+       sum.Add(sum, block.Difficulty())
+   }
+   return sum
 }

 // GetBlock returns the block at the specified number.

← Back to Version Comparison