Browse Source

sort /tx_search results by height by default

Refs #1366
pull/1374/head
Anton Kaliaev 7 years ago
parent
commit
4085c72496
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      state/txindex/kv/kv.go

+ 6
- 0
state/txindex/kv/kv.go View File

@ -4,6 +4,7 @@ import (
"bytes"
"encoding/hex"
"fmt"
"sort"
"strconv"
"strings"
"time"
@ -202,6 +203,11 @@ func (txi *TxIndex) Search(q *query.Query) ([]*types.TxResult, error) {
i++
}
// sort by height by default
sort.Slice(results, func(i, j int) bool {
return results[i].Height < results[j].Height
})
return results, nil
}


Loading…
Cancel
Save