Skip to content

Commit acaa86a

Browse files
committed
core/state: fix bug about getting stable LogsHash result ethereum#33082
1 parent 4bb9252 commit acaa86a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/state/statedb.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"maps"
2323
"math/big"
24+
"slices"
2425
"sort"
2526
"time"
2627

@@ -199,6 +200,9 @@ func (s *StateDB) Logs() []*types.Log {
199200
for _, lgs := range s.logs {
200201
logs = append(logs, lgs...)
201202
}
203+
slices.SortFunc(logs, func(a, b *types.Log) int {
204+
return int(a.Index) - int(b.Index)
205+
})
202206
return logs
203207
}
204208

0 commit comments

Comments
 (0)