From e5618976827450d158aa18119537dc9ec5b7b9e8 Mon Sep 17 00:00:00 2001 From: aljo242 Date: Mon, 26 Aug 2024 18:46:03 -0400 Subject: [PATCH] remove interface --- providers/apis/defi/types/block_age.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/providers/apis/defi/types/block_age.go b/providers/apis/defi/types/block_age.go index 815eaca51..f998fdc94 100644 --- a/providers/apis/defi/types/block_age.go +++ b/providers/apis/defi/types/block_age.go @@ -5,16 +5,7 @@ import "time" // BlockAgeChecker is a utility type to check if incoming block heights are validly updating. // If the block heights are not increasing and the time since the last update has exceeded // a configurable duration, this type will report that the updates are invalid. -// -//go:generate mockery --name BlockAgeChecker --output ./mocks/ --case underscore -type BlockAgeChecker interface { - IsHeightValid(newHeight uint64) bool -} - -var _ BlockAgeChecker = &BlockAgeCheckerImpl{} - -// BlockAgeCheckerImpl is an implementation of the BlockAgeChecker interface. -type BlockAgeCheckerImpl struct { +type BlockAgeChecker struct { lastHeight uint64 lastTimeStamp time.Time maxAge time.Duration @@ -22,7 +13,7 @@ type BlockAgeCheckerImpl struct { // NewBlockAgeChecker returns a zeroed BlockAgeChecker using the provided maxAge. func NewBlockAgeChecker(maxAge time.Duration) BlockAgeChecker { - return &BlockAgeCheckerImpl{ + return BlockAgeChecker{ lastHeight: 0, lastTimeStamp: time.Now(), maxAge: maxAge, @@ -34,7 +25,7 @@ func NewBlockAgeChecker(maxAge time.Duration) BlockAgeChecker { // - the time past the last block height update is less than the configured max age // returns false if: // - the time is past the configured max age. -func (bc *BlockAgeCheckerImpl) IsHeightValid(newHeight uint64) bool { +func (bc *BlockAgeChecker) IsHeightValid(newHeight uint64) bool { now := time.Now() if newHeight > bc.lastHeight {