forked from TrueCloudLab/neoneo-go
query: display zeroes for unknown addresses
This: Voted: null Amount : 0 Block: 0 is better than this: failed to convert account state from stackitem: invalid stackitem length
This commit is contained in:
parent
fde3cce93d
commit
a8a6c8c13d
1 changed files with 6 additions and 3 deletions
|
@ -20,6 +20,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
@ -238,10 +239,12 @@ func queryVoter(ctx *cli.Context) error {
|
|||
return cli.NewExitError("result stack is empty", 1)
|
||||
}
|
||||
st := new(state.NEOBalance)
|
||||
if _, ok := res.Stack[0].(stackitem.Null); !ok {
|
||||
err = st.FromStackItem(res.Stack[0])
|
||||
if err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("failed to convert account state from stackitem: %w", err), 1)
|
||||
}
|
||||
}
|
||||
dec, err := c.NEP17Decimals(neoHash)
|
||||
if err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("failed to get decimals: %w", err), 1)
|
||||
|
|
Loading…
Reference in a new issue