Skip to content

Commit

Permalink
update NewChainSDK (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstaFrode authored Jul 7, 2023
1 parent 4291670 commit ca43d93
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ func NewChainSDK(
var (
ok bool
err error
chainSDK = &ChainSDK{}
chainSDK = &ChainSDK{
lock: new(sync.Mutex),
chainState: new(atomic.Bool),
rpcAddr: rpcs,
name: name,
timeForBlockOut: t,
}
)

log.SetOutput(io.Discard)
Expand All @@ -78,6 +84,8 @@ func NewChainSDK(
return nil, err
}

chainSDK.SetChainState(true)

chainSDK.metadata, err = chainSDK.api.RPC.State.GetMetadataLatest()
if err != nil {
return nil, err
Expand Down Expand Up @@ -109,12 +117,6 @@ func NewChainSDK(
return nil, err
}
chainSDK.tokenSymbol = string(properties.TokenSymbol)
chainSDK.lock = new(sync.Mutex)
chainSDK.chainState = &atomic.Bool{}
chainSDK.timeForBlockOut = t
chainSDK.rpcAddr = rpcs
chainSDK.SetChainState(true)
chainSDK.name = name

if workspace != "" && p2pPort > 0 {
p2p, err := p2pgo.New(
Expand Down

0 comments on commit ca43d93

Please sign in to comment.