fix: case unauthorized message (#11229)

* fix: case unauthorized message

* changes

* Update x/feegrant/client/testutil/suite.go

* review changes

* Update client/broadcast.go

* udpate changelog

* update changelog

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
This commit is contained in:
atheeshp
2022-02-24 13:28:13 +01:00
committed by GitHub
co-authored by Amaury
parent 6324b5affb
commit ef6fed67de
3 changed files with 29 additions and 23 deletions
+9
View File
@@ -98,6 +98,15 @@ func (ctx Context) BroadcastTxCommit(txBytes []byte) (*sdk.TxResponse, error) {
return sdk.NewResponseFormatBroadcastTxCommit(res), nil
}
// with these changes(https://github.com/tendermint/tendermint/pull/7683)
// in tendermint, we receive both an error and a non-empty res from TM. Here
// we handle the case where both are relevant. Note: without this edge-case handling,
// CLI is breaking (for few transactions ex: executing unathorized messages in feegrant)
// this check is added to tackle the particular case.
if strings.Contains(err.Error(), "transaction encountered error") {
return sdk.NewResponseFormatBroadcastTxCommit(res), nil
}
if errRes := CheckTendermintError(err, txBytes); errRes != nil {
return errRes, nil
}