forked from TrueCloudLab/frostfs-node
[#905] morph/client: Fetch NNS hash once on init
NNS contract hash is taken from the contract with ID=1. Because morph client is expected to work with the same chain, and because contract hash doesn't change on update, there is no need to fetch it from each new endpoint. Change-Id: Ic6dc18283789da076d6a0b3701139b97037714cc Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
30099194ba
commit
a4da1da767
3 changed files with 10 additions and 54 deletions
|
@ -145,6 +145,11 @@ func New(ctx context.Context, key *keys.PrivateKey, opts ...Option) (*Client, er
|
|||
if cli.client == nil {
|
||||
return nil, ErrNoHealthyEndpoint
|
||||
}
|
||||
cs, err := cli.client.GetContractStateByID(nnsContractID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("resolve nns hash: %w", err)
|
||||
}
|
||||
cli.nnsHash = cs.Hash
|
||||
cli.setActor(act)
|
||||
|
||||
go cli.closeWaiter(ctx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue