Merge pull request #1308 from nspcc-dev/cli/inspect_fix

cli: fix `contract inspect` command
This commit is contained in:
Roman Khimov 2020-08-12 16:21:18 +03:00 committed by GitHub
commit fe86439c38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -582,15 +582,21 @@ func inspect(ctx *cli.Context) error {
if len(in) == 0 {
return cli.NewExitError(errNoInput, 1)
}
var b []byte
var err error
var (
b []byte
err error
)
if compile {
b, err = compiler.Compile(in, nil)
if err != nil {
return cli.NewExitError(fmt.Errorf("failed to compile: %w", err), 1)
}
} else {
nefFile, err := nef.FileFromBytes(b)
f, err := ioutil.ReadFile(in)
if err != nil {
return cli.NewExitError(fmt.Errorf("failed to read .nef file: %w", err), 1)
}
nefFile, err := nef.FileFromBytes(f)
if err != nil {
return cli.NewExitError(fmt.Errorf("failed to restore .nef file: %w", err), 1)
}