From 6b18caf133aa5a8aaac6f3c6d7f2c9fda3c4d4ac Mon Sep 17 00:00:00 2001 From: Lazar Date: Tue, 5 Nov 2024 14:26:51 +0100 Subject: [PATCH] pr comments --- CHANGELOG.md | 1 - btcclient/query.go | 5 +++-- config/submitter.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c930777..54ce638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * [#94](https://github.com/babylonlabs-io/vigilante/pull/94) adds gosec and fixes gosec issues - ## v0.15.0 * [#90](https://github.com/babylonlabs-io/vigilante/pull/90) upgrade babylon to v0.15.0 diff --git a/btcclient/query.go b/btcclient/query.go index e6fb613..5cfa99e 100644 --- a/btcclient/query.go +++ b/btcclient/query.go @@ -2,6 +2,7 @@ package btcclient import ( "fmt" + "math" "github.com/avast/retry-go/v4" "github.com/btcsuite/btcd/btcjson" @@ -19,7 +20,7 @@ func (c *Client) GetBestBlock() (uint32, error) { return 0, err } - if height < 0 || height > int64(^uint32(0)) { + if height < 0 || height > int64(math.MaxUint32) { panic(fmt.Errorf("height (%d) is out of uint32 range", height)) //software bug, panic } @@ -39,7 +40,7 @@ func (c *Client) GetBlockByHash(blockHash *chainhash.Hash) (*types.IndexedBlock, btcTxs := types.GetWrappedTxs(mBlock) height := blockInfo.Height - if height < 0 || height > int64(^uint32(0)) { + if height < 0 || height > int64(math.MaxUint32) { panic(fmt.Errorf("height (%d) is out of uint32 range", height)) //software bug, panic } return types.NewIndexedBlock(uint32(height), &mBlock.Header, btcTxs), mBlock, nil diff --git a/config/submitter.go b/config/submitter.go index 9d0d0ac..6a4986b 100644 --- a/config/submitter.go +++ b/config/submitter.go @@ -40,7 +40,7 @@ func (cfg *SubmitterConfig) Validate() error { } if cfg.PollingIntervalSeconds < 0 { - return errors.New("invalid polling-interval-seconds, should not be less than 0") + return errors.New("invalid polling-interval-seconds, should be positive") } return nil