Fix sendtx to not panic on error

This commit is contained in:
Ethan Frey 2017-01-30 19:11:44 +01:00
parent 23dad6d0e3
commit 6e3a199f09
3 changed files with 6 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.swp
vendor
merkleeyes.db

View File

@ -41,7 +41,6 @@ var StartCmd = cli.Command{
InProcTMFlag,
ChainIDFlag,
IbcPluginFlag,
// CounterPluginFlag,
},
}

View File

@ -183,6 +183,11 @@ func broadcastTx(c *cli.Context, tx types.Tx) ([]byte, error) {
return nil, errors.New(cmn.Fmt("Error on broadcast tx: %v", err))
}
res := (*tmResult).(*ctypes.ResultBroadcastTxCommit)
// if it fails check, we don't even get a delivertx back!
if !res.CheckTx.Code.IsOK() {
r := res.CheckTx
return nil, errors.New(cmn.Fmt("BroadcastTxCommit got non-zero exit code: %v. %X; %s", r.Code, r.Data, r.Log))
}
if !res.DeliverTx.Code.IsOK() {
r := res.DeliverTx
return nil, errors.New(cmn.Fmt("BroadcastTxCommit got non-zero exit code: %v. %X; %s", r.Code, r.Data, r.Log))