State CLI: fix printMsg to not panic when message isn't found
This commit is contained in:
parent
eede19fb0b
commit
d9dcc7845f
11
cli/state.go
11
cli/state.go
@ -1464,7 +1464,12 @@ func printReceiptReturn(ctx context.Context, api api.FullNode, m *types.Message,
|
||||
}
|
||||
|
||||
func printMsg(ctx context.Context, api api.FullNode, msg cid.Cid, mw *lapi.MsgLookup, m *types.Message) error {
|
||||
if mw != nil {
|
||||
|
||||
if mw == nil {
|
||||
fmt.Println("message was not found on chain")
|
||||
return nil
|
||||
}
|
||||
|
||||
if mw.Message != msg {
|
||||
fmt.Printf("Message was replaced: %s\n", mw.Message)
|
||||
}
|
||||
@ -1473,10 +1478,6 @@ func printMsg(ctx context.Context, api api.FullNode, msg cid.Cid, mw *lapi.MsgLo
|
||||
fmt.Printf("Exit Code: %d\n", mw.Receipt.ExitCode)
|
||||
fmt.Printf("Gas Used: %d\n", mw.Receipt.GasUsed)
|
||||
fmt.Printf("Return: %x\n", mw.Receipt.Return)
|
||||
} else {
|
||||
fmt.Println("message was not found on chain")
|
||||
}
|
||||
|
||||
if err := printReceiptReturn(ctx, api, m, mw.Receipt); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user