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


Loading…
Cancel
Save