[#2079] cli: Do not panic in object hash

Sign RPC requests with the provided key.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-11-22 20:21:10 +03:00 committed by fyrchik
parent 28ad4c6ebc
commit db981e9c99
2 changed files with 3 additions and 2 deletions

View file

@ -37,6 +37,7 @@ Changelog for NeoFS Node
- Write-cache flush duplication (#2074) - Write-cache flush duplication (#2074)
- Ignore error if a transaction already exists in a morph client (#2075) - Ignore error if a transaction already exists in a morph client (#2075)
- Pack arguments of `setPrice` invocation during contract update (#2078) - Pack arguments of `setPrice` invocation during contract update (#2078)
- `neofs-cli object hash` panic (#2079)
### Removed ### Removed
### Updated ### Updated

View file

@ -64,11 +64,13 @@ func getObjectHash(cmd *cobra.Command, _ []string) {
common.ExitOnErr(cmd, "could not decode salt: %w", err) common.ExitOnErr(cmd, "could not decode salt: %w", err)
pk := key.GetOrGenerate(cmd) pk := key.GetOrGenerate(cmd)
cli := internalclient.GetSDKClientByFlag(cmd, pk, commonflags.RPC)
tz := typ == hashTz tz := typ == hashTz
fullHash := len(ranges) == 0 fullHash := len(ranges) == 0
if fullHash { if fullHash {
var headPrm internalclient.HeadObjectPrm var headPrm internalclient.HeadObjectPrm
headPrm.SetClient(cli)
Prepare(cmd, &headPrm) Prepare(cmd, &headPrm)
headPrm.SetAddress(objAddr) headPrm.SetAddress(objAddr)
@ -94,8 +96,6 @@ func getObjectHash(cmd *cobra.Command, _ []string) {
return return
} }
cli := internalclient.GetSDKClientByFlag(cmd, pk, commonflags.RPC)
var hashPrm internalclient.HashPayloadRangesPrm var hashPrm internalclient.HashPayloadRangesPrm
hashPrm.SetClient(cli) hashPrm.SetClient(cli)
Prepare(cmd, &hashPrm) Prepare(cmd, &hashPrm)