core/state: fix bug about getting stable LogsHash result #33082 (#1768)

This commit is contained in:
wit liu 2025-11-14 22:37:32 +08:00 committed by GitHub
parent 0fe8742241
commit a9db265d4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,6 +21,7 @@ import (
"fmt"
"maps"
"math/big"
"slices"
"sort"
"time"
@ -205,6 +206,9 @@ func (s *StateDB) Logs() []*types.Log {
for _, lgs := range s.logs {
logs = append(logs, lgs...)
}
slices.SortFunc(logs, func(a, b *types.Log) int {
return int(a.Index) - int(b.Index)
})
return logs
}