You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
haifengxi
changed the title
[p3] Parse keystore JSON file in an incorrect format would cause unfriendly panic output
[p3] Parsing keystore file in an incorrect format causes unfriendly panic
Jun 11, 2019
Describe the bug
Try to recover a key from keystore , parse JSON file and encounter an empty object(like {})would cause panic output.
To Reproduce
panic: interface conversion: interface {} is nil, not string [recovered]
panic: interface conversion: interface {} is nil, not string
goroutine 1 [running]:
main.main.func1()
/Users/sherlock/go/src/github.com/irishub/cmd/iriscli/main.go:45 +0xb3
panic(0x4a753c0, 0xc000a7f830)
/usr/local/Cellar/go/1.12.5/libexec/src/runtime/panic.go:522 +0x1b5
github.com/irisnet/irishub/crypto/keystore.getKDFKey(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/Users/sherlock/go/src/github.com/irishub/crypto/keystore/keystore.go:84 +0x67c
github.com/irisnet/irishub/crypto/keystore.decryptKey(0xc000122630, 0xc0000c2516, 0xa, 0x49e8a00, 0xc000122630, 0x0, 0x0, 0x4aae0e0)
/Users/sherlock/go/src/github.com/irishub/crypto/keystore/keystore.go:62 +0x270
github.com/irisnet/irishub/crypto/keystore.(*keyManager).recoveryFromKeyStore(0xc0009c0000, 0x7ffeefbffc79, 0x17, 0xc0000c2516, 0xa, 0x0, 0x0)
/Users/sherlock/go/src/github.com/irishub/crypto/keystore/keys.go:61 +0x1ce
github.com/irisnet/irishub/crypto/keystore.NewKeyStoreKeyManager(...)
/Users/sherlock/go/src/github.com/irishub/crypto/keystore/keys.go:44
github.com/irisnet/irishub/client/keys/cli.runAddCmd(0xc000b02d80, 0xc00045e750, 0x1, 0x3, 0x0, 0x0)
/Users/sherlock/go/src/github.com/irishub/client/keys/cli/add.go:170 +0xeb6
github.com/spf13/cobra.(*Command).execute(0xc000b02d80, 0xc00045e6c0, 0x3, 0x3, 0xc000b02d80, 0xc00045e6c0)
/Users/sherlock/go/pkg/mod/github.com/spf13/cobra@v0.0.1/command.go:698 +0x431
github.com/spf13/cobra.(*Command).ExecuteC(0x5612a40, 0xc000b0cd20, 0x0, 0x0)
/Users/sherlock/go/pkg/mod/github.com/spf13/cobra@v0.0.1/command.go:783 +0x2ca
github.com/spf13/cobra.(*Command).Execute(...)
/Users/sherlock/go/pkg/mod/github.com/spf13/cobra@v0.0.1/command.go:736
github.com/tendermint/tendermint/libs/cli.Executor.Execute(0x5612a40, 0x4d072e0, 0x0, 0xc00087a980)
/Users/sherlock/go/pkg/mod/github.com/irisnet/tendermint@v0.22.3-0.20190527110704-aff684d6c906/libs/cli/setup.go:89 +0x3c
main.main()
/Users/sherlock/go/src/github.com/irishub/cmd/iriscli/main.go:272 +0x1b15
The text was updated successfully, but these errors were encountered: