fix(server/v2/cometbft): add tx result for failed tx (#21200)
This commit is contained in:
parent
72e77c3580
commit
90fd6320a6
@ -325,13 +325,6 @@ func (s *CometBFTServer[T]) QueryBlockResultsCmd() *cobra.Command {
|
||||
Long: "Query for a specific committed block's results using the CometBFT RPC `block_results` method",
|
||||
Args: cobra.RangeArgs(0, 1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
// clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
|
||||
// TODO: we should be able to do this without using client context
|
||||
|
||||
node, err := s.rpcClient(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@ -102,18 +102,24 @@ func intoABCIValidatorUpdates(updates []appmodulev2.ValidatorUpdate) []abci.Vali
|
||||
func intoABCITxResults(results []appmanager.TxResult, indexSet map[string]struct{}) []*abci.ExecTxResult {
|
||||
res := make([]*abci.ExecTxResult, len(results))
|
||||
for i := range results {
|
||||
if results[i].Error == nil {
|
||||
res[i] = responseExecTxResultWithEvents(
|
||||
results[i].Error,
|
||||
results[i].GasWanted,
|
||||
results[i].GasUsed,
|
||||
intoABCIEvents(results[i].Events, indexSet),
|
||||
false,
|
||||
)
|
||||
if results[i].Error != nil {
|
||||
space, code, log := errorsmod.ABCIInfo(results[i].Error, true)
|
||||
res[i] = &abci.ExecTxResult{
|
||||
Codespace: space,
|
||||
Code: code,
|
||||
Log: log,
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// TODO: handle properly once the we decide on the type of TxResult.Resp
|
||||
res[i] = responseExecTxResultWithEvents(
|
||||
results[i].Error,
|
||||
results[i].GasWanted,
|
||||
results[i].GasUsed,
|
||||
intoABCIEvents(results[i].Events, indexSet),
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
Loading…
Reference in New Issue
Block a user