From 478efee0bc3e6f24f02d8858f674b7f335a23b21 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 12 Aug 2020 12:22:16 +0300 Subject: [PATCH] cli: fix inspect command There was an empty byte array while trying to restore .nef from bytes after a34ba92d4. --- cli/smartcontract/smart_contract.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cli/smartcontract/smart_contract.go b/cli/smartcontract/smart_contract.go index 90c325c86..5d5be5f9e 100644 --- a/cli/smartcontract/smart_contract.go +++ b/cli/smartcontract/smart_contract.go @@ -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) }