[#1607] adm/ape: Fix parsing policy-hash flag
All checks were successful
DCO action / DCO (pull_request) Successful in 35s
Vulncheck / Vulncheck (pull_request) Successful in 1m0s
Build / Build Components (pull_request) Successful in 1m25s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m25s
Tests and linters / Run gofumpt (pull_request) Successful in 2m31s
Tests and linters / Lint (pull_request) Successful in 2m52s
Tests and linters / Staticcheck (pull_request) Successful in 2m47s
Tests and linters / Tests (pull_request) Successful in 3m7s
Tests and linters / Tests with -race (pull_request) Successful in 3m8s
Tests and linters / gopls check (pull_request) Successful in 3m44s
All checks were successful
DCO action / DCO (pull_request) Successful in 35s
Vulncheck / Vulncheck (pull_request) Successful in 1m0s
Build / Build Components (pull_request) Successful in 1m25s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m25s
Tests and linters / Run gofumpt (pull_request) Successful in 2m31s
Tests and linters / Lint (pull_request) Successful in 2m52s
Tests and linters / Staticcheck (pull_request) Successful in 2m47s
Tests and linters / Tests (pull_request) Successful in 3m7s
Tests and linters / Tests with -race (pull_request) Successful in 3m8s
Tests and linters / gopls check (pull_request) Successful in 3m44s
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
01b19e72fa
commit
05517ae305
1 changed files with 6 additions and 1 deletions
|
@ -84,10 +84,15 @@ func initPolicyReader(cmd *cobra.Command) (*invoker.Invoker, util.Uint160) {
|
|||
commonCmd.ExitOnErr(cmd, "can't init rpc client: %w", err)
|
||||
|
||||
inv := invoker.New(rpcCli, nil)
|
||||
|
||||
policyHashStr, _ := cmd.Flags().GetString(policyHashFlag)
|
||||
if policyHash, err := util.Uint160DecodeStringLE(policyHashStr); err == nil {
|
||||
return inv, policyHash
|
||||
}
|
||||
|
||||
nnsCs, err := helper.GetContractByID(management.NewReader(inv), 1)
|
||||
commonCmd.ExitOnErr(cmd, "can't get NNS contract state: %w", err)
|
||||
|
||||
policyHashStr, _ := cmd.Flags().GetString(policyHashFlag)
|
||||
policyHash, err := helper.NNSResolveHash(inv, nnsCs.Hash, policyHashStr)
|
||||
commonCmd.ExitOnErr(cmd, "can't resolve NNS policy contract: %w", err)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue