[#607] network: Do not work with Address pointers

`network.Address` structure in most cases created once and used read-only.

Replace `AddressFromString` function with `Address.FromString` method with
the same purpose and implementation. Make all libraries to work with value.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-18 09:00:21 +03:00 committed by Leonard Lyubich
parent 5de074f24c
commit adbbad0beb
35 changed files with 128 additions and 97 deletions

View file

@ -238,15 +238,15 @@ func getKeyFromWallet(w *wallet.Wallet, addrStr string) (*ecdsa.PrivateKey, erro
// getEndpointAddress returns network address structure that stores multiaddr
// inside, parsed from global arguments.
func getEndpointAddress() (*network.Address, error) {
func getEndpointAddress() (addr network.Address, err error) {
endpoint := viper.GetString("rpc")
addr, err := network.AddressFromString(endpoint)
err = addr.FromString(endpoint)
if err != nil {
return nil, errInvalidEndpoint
err = errInvalidEndpoint
}
return addr, nil
return
}
// getSDKClient returns default neofs-api-go sdk client. Consider using