Merge PR #4876: Fix BroadcastTxCommit Response
This commit is contained in:
parent
46c98d396d
commit
fee71e72d4
|
@ -0,0 +1,3 @@
|
|||
#4858 Do not return an error in BroadcastTxCommit when the tx broadcasting
|
||||
was successful. This allows the proper REST response to be returned for a
|
||||
failed tx during `block` broadcasting mode.
|
|
@ -30,7 +30,8 @@ func (ctx CLIContext) BroadcastTx(txBytes []byte) (res sdk.TxResponse, err error
|
|||
}
|
||||
|
||||
// BroadcastTxCommit broadcasts transaction bytes to a Tendermint node and
|
||||
// waits for a commit.
|
||||
// waits for a commit. An error is only returned if there is no RPC node
|
||||
// connection or if broadcasting fails.
|
||||
//
|
||||
// NOTE: This should ideally not be used as the request may timeout but the tx
|
||||
// may still be included in a block. Use BroadcastTxAsync or BroadcastTxSync
|
||||
|
@ -47,11 +48,11 @@ func (ctx CLIContext) BroadcastTxCommit(txBytes []byte) (sdk.TxResponse, error)
|
|||
}
|
||||
|
||||
if !res.CheckTx.IsOK() {
|
||||
return sdk.NewResponseFormatBroadcastTxCommit(res), fmt.Errorf(res.CheckTx.Log)
|
||||
return sdk.NewResponseFormatBroadcastTxCommit(res), nil
|
||||
}
|
||||
|
||||
if !res.DeliverTx.IsOK() {
|
||||
return sdk.NewResponseFormatBroadcastTxCommit(res), fmt.Errorf(res.DeliverTx.Log)
|
||||
return sdk.NewResponseFormatBroadcastTxCommit(res), nil
|
||||
}
|
||||
|
||||
return sdk.NewResponseFormatBroadcastTxCommit(res), nil
|
||||
|
|
Loading…
Reference in New Issue