From 5c304ece983c7e1c1049a203f23ae9c5dd2421fe Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 3 Oct 2024 16:31:52 +0200 Subject: [PATCH] fix: lint --- native/blockchain/rpc.go | 13 +++++++------ native/blockchian.go | 6 +++--- native/handlers.go | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/native/blockchain/rpc.go b/native/blockchain/rpc.go index 58ba7e1..1f47a03 100644 --- a/native/blockchain/rpc.go +++ b/native/blockchain/rpc.go @@ -10,11 +10,11 @@ import ( "strings" "sync" + provtypes "github.com/cometbft/cometbft/light/provider" + prov "github.com/cometbft/cometbft/light/provider/http" types "github.com/cometbft/cometbft/rpc/jsonrpc/types" tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" - prov "github.com/cometbft/cometbft/light/provider/http" - provtypes "github.com/cometbft/cometbft/light/provider" "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/x/bank" @@ -160,10 +160,10 @@ func (b *chainRPC) Block(ctx context.Context, height int64) (blk *tmtypes.Block, defer b.mu.Unlock() blkResult, err := b.conn.websocketRPC.Block(ctx, &height) if err != nil { - // usually a node does not have all the blocks, + // usually a node does not have all the blocks, // in this case we could parse the last block that node has available and start from there. - // "error in json rpc client, with http response metadata: - // (Status: 200 OK, Protocol HTTP/1.1). + // "error in json rpc client, with http response metadata: + // (Status: 200 OK, Protocol HTTP/1.1). // RPC error -32603 - Internal error: height 1 is not available, lowest height is 7942001" errString := err.Error() searchStrInErr := fmt.Sprintf("Internal error: height %d is not available, lowest height is ", height) @@ -199,8 +199,9 @@ func (b *chainRPC) CheckTx(ctx context.Context, tx tmtypes.Tx) (err error) { return nil } + // create light provider -func (b *chainRPC) LightProvider() (provtypes.Provider) { +func (b *chainRPC) LightProvider() provtypes.Provider { lightprovider, err := prov.New(b.ChainID(), b.conn.AddrRPC) if err != nil { diff --git a/native/blockchian.go b/native/blockchian.go index 3b4c439..772d5fe 100644 --- a/native/blockchian.go +++ b/native/blockchian.go @@ -3,9 +3,9 @@ package native import ( "context" + provtypes "github.com/cometbft/cometbft/light/provider" tmtypes "github.com/cometbft/cometbft/types" sdktypes "github.com/cosmos/cosmos-sdk/types" - provtypes "github.com/cometbft/cometbft/light/provider" ) // Blockchain is the expected blockchain interface the indexer needs to store data in the database. @@ -18,5 +18,5 @@ type Blockchain interface { SubscribeNewBlock(ctx context.Context) (<-chan *tmtypes.Block, error) Block(ctx context.Context, height int64) (blk *tmtypes.Block, minimumBlkHeight int, err error) CheckTx(ctx context.Context, tx tmtypes.Tx) (err error) - LightProvider() (provtypes.Provider) -} \ No newline at end of file + LightProvider() provtypes.Provider +} diff --git a/native/handlers.go b/native/handlers.go index 7d104c8..f09d3e9 100644 --- a/native/handlers.go +++ b/native/handlers.go @@ -3,7 +3,7 @@ package native import ( "context" "encoding/hex" - + tmtypes "github.com/cometbft/cometbft/types" )