Merge PR #4667: Sort events by type
This commit is contained in:
parent
0d3b4ba0d6
commit
ef7e266c6f
@ -2,6 +2,7 @@ package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
@ -173,9 +174,18 @@ func (se StringEvents) Flatten() StringEvents {
|
||||
flatEvents[e.Type] = append(flatEvents[e.Type], e.Attributes...)
|
||||
}
|
||||
|
||||
var res StringEvents
|
||||
for ty, attrs := range flatEvents {
|
||||
res = append(res, StringEvent{Type: ty, Attributes: attrs})
|
||||
var (
|
||||
res StringEvents
|
||||
keys []string
|
||||
)
|
||||
|
||||
for ty := range flatEvents {
|
||||
keys = append(keys, ty)
|
||||
}
|
||||
|
||||
sort.Strings(keys)
|
||||
for _, ty := range keys {
|
||||
res = append(res, StringEvent{Type: ty, Attributes: flatEvents[ty]})
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
Loading…
Reference in New Issue
Block a user