From 05ccd282d98151e75a0171be2da3862d55f2fb97 Mon Sep 17 00:00:00 2001 From: Dimitris Grigoriou Date: Tue, 28 Nov 2023 13:51:25 +0200 Subject: [PATCH] Remove FriendlyNumber function (#11376) --- common/headtracker/head_tracker.go | 6 ++---- core/config/presenters.go | 14 -------------- 2 files changed, 2 insertions(+), 18 deletions(-) delete mode 100644 core/config/presenters.go diff --git a/common/headtracker/head_tracker.go b/common/headtracker/head_tracker.go index 34a319e3c1c..6e379776c0f 100644 --- a/common/headtracker/head_tracker.go +++ b/common/headtracker/head_tracker.go @@ -15,7 +15,6 @@ import ( htrktypes "github.com/smartcontractkit/chainlink/v2/common/headtracker/types" "github.com/smartcontractkit/chainlink/v2/common/types" - "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -103,7 +102,7 @@ func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) Start(ctx context.Context) error } if latestChain.IsValid() { ht.log.Debugw( - fmt.Sprintf("HeadTracker: Tracking logs from last block %v with hash %s", config.FriendlyNumber(latestChain.BlockNumber()), latestChain.BlockHash()), + fmt.Sprintf("HeadTracker: Tracking logs from last block %v with hash %s", latestChain.BlockNumber(), latestChain.BlockHash()), "blockNumber", latestChain.BlockNumber(), "blockHash", latestChain.BlockHash(), ) @@ -193,8 +192,7 @@ func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) getInitialHead(ctx context.Contex func (ht *HeadTracker[HTH, S, ID, BLOCK_HASH]) handleNewHead(ctx context.Context, head HTH) error { prevHead := ht.headSaver.LatestChain() - ht.log.Debugw(fmt.Sprintf("Received new head %v", config.FriendlyNumber(head.BlockNumber())), - "blockHeight", head.BlockNumber(), + ht.log.Debugw(fmt.Sprintf("Received new head %v", head.BlockNumber()), "blockHash", head.BlockHash(), "parentHeadHash", head.GetParentHash(), "blockTs", head.GetTimestamp(), diff --git a/core/config/presenters.go b/core/config/presenters.go deleted file mode 100644 index f4da66fd151..00000000000 --- a/core/config/presenters.go +++ /dev/null @@ -1,14 +0,0 @@ -package config - -import ( - "fmt" - "math/big" - - "golang.org/x/exp/constraints" -) - -// FriendlyNumber returns a string printing the integer or big.Int in both -// decimal and hexadecimal formats. -func FriendlyNumber[N constraints.Integer | *big.Int](n N) string { - return fmt.Sprintf("#%[1]v (0x%[1]x)", n) -}