Browse Source

rpc: change default sorting to desc for `/tx_search` results (#6168)

Closes #6155
pull/6170/head
Anton Kaliaev 3 years ago
committed by GitHub
parent
commit
c1ca749afa
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions
  1. +2
    -1
      CHANGELOG_PENDING.md
  2. +2
    -2
      rpc/core/tx.go
  3. +1
    -1
      rpc/openapi/openapi.yaml

+ 2
- 1
CHANGELOG_PENDING.md View File

@ -14,6 +14,7 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
- [cli] \#5772 `gen_node_key` prints JSON-encoded `NodeKey` rather than ID and does not save it to `node_key.json` (@melekes)
- [cli] \#5777 use hyphen-case instead of snake_case for all cli commands and config parameters (@cmwaters)
- [rpc] \#6019 standardise RPC errors and return the correct status code (@bipulprasad & @cmwaters)
- [rpc] \#6168 Change default sorting to desc for `/tx_search` results (@melekes)
- Apps
- [ABCI] \#5447 Remove `SetOption` method from `ABCI.Client` interface
@ -29,7 +30,7 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi
- [proto/p2p] Renamed `DefaultNodeInfo` and `DefaultNodeInfoOther` to `NodeInfo` and `NodeInfoOther` (@erikgrinaker)
- [proto/p2p] Rename `NodeInfo.default_node_id` to `node_id` (@erikgrinaker)
- [libs/os] Kill() and {Must,}{Read,Write}File() functions have been removed. (@alessio)
- [store] \#5848 Remove block store state in favor of using the db iterators directly (@cmwaters)
- [store] \#5848 Remove block store state in favor of using the db iterators directly (@cmwaters)
- [state] \#5864 Use an iterator when pruning state (@cmwaters)
- [types] \#6023 Remove `tm2pb.Header`, `tm2pb.BlockID`, `tm2pb.PartSetHeader` and `tm2pb.NewValidatorUpdate`.
- Each of the above types has a `ToProto` and `FromProto` method or function which replaced this logic.


+ 2
- 2
rpc/core/tx.go View File

@ -73,14 +73,14 @@ func TxSearch(ctx *rpctypes.Context, query string, prove bool, pagePtr, perPageP
// sort results (must be done before pagination)
switch orderBy {
case "desc":
case "desc", "":
sort.Slice(results, func(i, j int) bool {
if results[i].Height == results[j].Height {
return results[i].Index > results[j].Index
}
return results[i].Height > results[j].Height
})
case "asc", "":
case "asc":
sort.Slice(results, func(i, j int) bool {
if results[i].Height == results[j].Height {
return results[i].Index < results[j].Index


+ 1
- 1
rpc/openapi/openapi.yaml View File

@ -1004,7 +1004,7 @@ paths:
required: false
schema:
type: string
default: "asc"
default: "desc"
example: "asc"
tags:
- Info


Loading…
Cancel
Save