Skip to content

Commit

Permalink
Fix reconnect (#78)
Browse files Browse the repository at this point in the history
* update chain

* update workflows
  • Loading branch information
AstaFrode authored Jun 15, 2023
1 parent 983e95b commit 78702cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build&test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,3 @@ jobs:

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
13 changes: 7 additions & 6 deletions chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ func NewChainSDK(name string, rpcs []string, mnemonic string, t time.Duration) (

func (c *ChainSDK) Reconnect() error {
var err error
if c.api.Client != nil {
c.api.Client.Close()
if c.api != nil {
if c.api.Client != nil {
c.api.Client.Close()
c.api.Client = nil
}
c.api = nil
}
c.api = nil
c.metadata = nil
c.runtimeVersion = nil
c.keyEvents = nil

c.api, c.metadata, c.runtimeVersion, c.keyEvents, c.genesisHash, err = reconnectChainSDK(c.rpcAddr)
if err != nil {
return err
Expand Down

0 comments on commit 78702cd

Please sign in to comment.