From ff86cacc4422c65d76b3c7c940df77f03ab5dae3 Mon Sep 17 00:00:00 2001 From: Shahbaz Nazir Date: Fri, 1 Dec 2023 14:30:24 +0100 Subject: [PATCH] fix: context again --- pkg/chain/chain.go | 4 ++-- pkg/config/config.go | 2 +- pkg/ibc/ibc.go | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/chain/chain.go b/pkg/chain/chain.go index 82c9906..c7977ec 100644 --- a/pkg/chain/chain.go +++ b/pkg/chain/chain.go @@ -21,7 +21,7 @@ type Info struct { Timeout string } -func PrepChain(info Info) (*relayer.Chain, error) { +func PrepChain(ctx context.Context, info Info) (*relayer.Chain, error) { timeout := rpcTimeout if info.Timeout != "" { timeout = info.Timeout @@ -39,7 +39,7 @@ func PrepChain(info Info) (*relayer.Chain, error) { return nil, err } - err = provider.Init(context.Background()) + err = provider.Init(ctx) if err != nil { return nil, err } diff --git a/pkg/config/config.go b/pkg/config/config.go index e1c527c..b0c58a6 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -100,7 +100,7 @@ type Discord struct { } func (a *Account) GetBalance(ctx context.Context, rpcs *map[string]RPC) error { - chain, err := chain.PrepChain(chain.Info{ + chain, err := chain.PrepChain(ctx, chain.Info{ ChainID: (*rpcs)[a.ChainName].ChainID, RPCAddr: (*rpcs)[a.ChainName].URL, Timeout: (*rpcs)[a.ChainName].Timeout, diff --git a/pkg/ibc/ibc.go b/pkg/ibc/ibc.go index c42ea46..972c7b4 100644 --- a/pkg/ibc/ibc.go +++ b/pkg/ibc/ibc.go @@ -49,7 +49,7 @@ func GetClientsInfo(ctx context.Context, ibc *config.IBCData, rpcs *map[string]c ClientID: ibc.Chain1.ClientID, } - chainA, err := chain.PrepChain(cdA) + chainA, err := chain.PrepChain(ctx, cdA) if err != nil { return ClientsInfo{}, fmt.Errorf("%w for %v", err, cdA) } @@ -63,7 +63,7 @@ func GetClientsInfo(ctx context.Context, ibc *config.IBCData, rpcs *map[string]c ClientID: ibc.Chain2.ClientID, } - chainB, err := chain.PrepChain(cdB) + chainB, err := chain.PrepChain(ctx, cdB) if err != nil { return ClientsInfo{}, fmt.Errorf("%w for %v", err, cdB) } @@ -119,7 +119,7 @@ func GetChannelsInfo(ctx context.Context, ibc *config.IBCData, rpcs *map[string] ClientID: ibc.Chain1.ClientID, } - chainA, err := chain.PrepChain(cdA) + chainA, err := chain.PrepChain(ctx, cdA) if err != nil { return ChannelsInfo{}, fmt.Errorf("Error: %w for %v", err, cdA) } @@ -131,7 +131,7 @@ func GetChannelsInfo(ctx context.Context, ibc *config.IBCData, rpcs *map[string] ClientID: ibc.Chain2.ClientID, } - chainB, err := chain.PrepChain(cdB) + chainB, err := chain.PrepChain(ctx, cdB) if err != nil { return ChannelsInfo{}, fmt.Errorf("Error: %w for %v", err, cdB) }