[#746] morph/client: Don't cache GAS contract address on NeoFS-side

Caching is performed inside `GetNativeContractHash` method of neo-go client,
so the additional cache level is redundant.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-09-02 09:57:19 +03:00 committed by Alex Vanin
parent 0502abc3e0
commit 81722c373b
4 changed files with 20 additions and 13 deletions

View file

@ -47,8 +47,6 @@ type singleClient struct {
acc *wallet.Account // neo account
gas util.Uint160 // native gas script-hash
waitInterval time.Duration
signer *transaction.Signer
@ -215,7 +213,12 @@ func (c *Client) TransferGas(receiver util.Uint160, amount fixedn.Fixed8) error
})
}
txHash, err := c.client.TransferNEP17(c.acc, receiver, c.gas, int64(amount), 0, nil, nil)
gas, err := c.client.GetNativeContractHash(nativenames.Gas)
if err != nil {
return err
}
txHash, err := c.client.TransferNEP17(c.acc, receiver, gas, int64(amount), 0, nil, nil)
if err != nil {
return err
}
@ -281,7 +284,12 @@ func (c *Client) GasBalance() (res int64, err error) {
})
}
return c.client.NEP17BalanceOf(c.gas, c.acc.PrivateKey().GetScriptHash())
gas, err := c.client.GetNativeContractHash(nativenames.Gas)
if err != nil {
return 0, err
}
return c.client.NEP17BalanceOf(gas, c.acc.PrivateKey().GetScriptHash())
}
// Committee returns keys of chain committee from neo native contract.