Skip to content

Commit

Permalink
fix: update maindb txIndex after merge slotDB
Browse files Browse the repository at this point in the history
otherwise there can be issue that txIndex is load before the change in
mergeSlotDB.
  • Loading branch information
sunny2022da committed Aug 3, 2024
1 parent c64f253 commit 6b547af
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -2627,8 +2627,6 @@ func (s *StateDB) AddrPrefetch(slotDb *ParallelStateDB) {
// merged back to the main StateDB.
func (s *StateDB) MergeSlotDB(slotDb *ParallelStateDB, slotReceipt *types.Receipt, txIndex int, fees *DelayedGasFee) *StateDB {

s.SetTxContext(slotDb.thash, slotDb.txIndex)

for s.nextRevisionId < slotDb.nextRevisionId {
if len(slotDb.validRevisions) > 0 {
r := slotDb.validRevisions[s.nextRevisionId]
Expand Down Expand Up @@ -2830,7 +2828,7 @@ func (s *StateDB) MergeSlotDB(slotDb *ParallelStateDB, slotReceipt *types.Receip
s.snapParallelLock.Unlock()
}
}

s.SetTxContext(slotDb.thash, slotDb.txIndex)
return s
}

Expand Down

0 comments on commit 6b547af

Please sign in to comment.