Skip to content

Commit c809781

Browse files
committed
Add the GetStateAndCommittedState method on StateDB type
1 parent 7628e7e commit c809781

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

fvm/evm/emulator/state/stateDB.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,17 @@ func (db *StateDB) GetCommittedState(addr gethCommon.Address, key gethCommon.Has
256256
return value
257257
}
258258

259+
// GetStateAndCommittedState returns the current value and the original value.
260+
func (db *StateDB) GetStateAndCommittedState(
261+
addr gethCommon.Address,
262+
key gethCommon.Hash,
263+
) (gethCommon.Hash, gethCommon.Hash) {
264+
origin := db.GetCommittedState(addr, key)
265+
value := db.GetState(addr, key)
266+
267+
return value, origin
268+
}
269+
259270
// GetState returns the value for the given storage slot
260271
func (db *StateDB) GetState(addr gethCommon.Address, key gethCommon.Hash) gethCommon.Hash {
261272
state, err := db.latestView().GetState(types.SlotAddress{Address: addr, Key: key})

0 commit comments

Comments
 (0)