mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-15 16:33:47 +00:00
Quit early when read conflict is detected
This commit is contained in:
parent
f9ba824588
commit
81efd63269
1 changed files with 6 additions and 3 deletions
|
|
@ -329,10 +329,13 @@ func MVRead[T any](s *StateDB, k blockstm.Key, defaultV T, readStorage func(s *S
|
||||||
return defaultV
|
return defaultV
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: I assume we don't want to overwrite an existing read because this could - for example - change a storage
|
if prevRd, ok := s.readMap[k]; !ok {
|
||||||
// read to map if the same value is read multiple times.
|
|
||||||
if _, ok := s.readMap[k]; !ok {
|
|
||||||
s.readMap[k] = rd
|
s.readMap[k] = rd
|
||||||
|
} else {
|
||||||
|
if prevRd.Kind != rd.Kind || prevRd.V.TxnIndex != rd.V.TxnIndex || prevRd.V.Incarnation != rd.V.Incarnation {
|
||||||
|
s.dep = rd.V.TxnIndex
|
||||||
|
panic("Read conflict detected")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue