Update core/state/statedb.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
maskpp 2025-11-02 22:36:37 +08:00 committed by GitHub
parent e8731404d0
commit 9b9c13880d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -265,7 +265,7 @@ func (s *StateDB) Logs() []*types.Log {
for _, lgs := range s.logs { for _, lgs := range s.logs {
logs = append(logs, lgs...) logs = append(logs, lgs...)
} }
// Due to the map iteration is not stable, we need to sort the logs by TxIndex, then the LogsHash result is stable. // Because map iteration is not stable, we need to sort the logs by TxIndex, then the LogsHash result is stable.
sort.Slice(logs, func(i, j int) bool { sort.Slice(logs, func(i, j int) bool {
return logs[i].TxIndex < logs[j].TxIndex return logs[i].TxIndex < logs[j].TxIndex
}) })