Skip to content

Commit

Permalink
fix request query
Browse files Browse the repository at this point in the history
  • Loading branch information
avery committed Jan 10, 2025
1 parent b199c2b commit 9d6e772
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/service/client/utils/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func QueryRequestContextByTxQuery(

// findMsgIndex will find the message index in the txInfo.
func findMsgIndex(txInfo *sdk.TxResponse, params types.QueryRequestContextRequest) (int, error) {
const errUnknownContext = "unknown request context: %s"
msgIndex := -1
var found bool
if txInfo.Logs == nil {
Expand All @@ -127,7 +128,7 @@ func findMsgIndex(txInfo *sdk.TxResponse, params types.QueryRequestContextReques
}
}

return -1, fmt.Errorf("unknown request context: %s", params.RequestContextId)
return msgIndex, fmt.Errorf(errUnknownContext, params.RequestContextId)
}

// Compatible with older versions.
Expand All @@ -145,7 +146,7 @@ func findMsgIndex(txInfo *sdk.TxResponse, params types.QueryRequestContextReques
}
}

return -1, fmt.Errorf("unknown request context: %s", params.RequestContextId)
return msgIndex, fmt.Errorf(errUnknownContext, params.RequestContextId)
}

// QueryRequestByTxQuery will query for a single request via a direct txs tags query.
Expand Down

0 comments on commit 9d6e772

Please # to comment.