aboutsummaryrefslogtreecommitdiffstats
path: root/tests/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/util.go')
-rw-r--r--tests/util.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/util.go b/tests/util.go
index 79c3bfad1..08fac2dd1 100644
--- a/tests/util.go
+++ b/tests/util.go
@@ -103,16 +103,17 @@ func (self Log) Topics() [][]byte {
return t
}
-func StateObjectFromAccount(db ethdb.Database, addr string, account Account) *state.StateObject {
- obj := state.NewStateObject(common.HexToAddress(addr), db)
- obj.SetBalance(common.Big(account.Balance))
-
+func StateObjectFromAccount(db ethdb.Database, addr string, account Account, onDirty func(common.Address)) *state.StateObject {
if common.IsHex(account.Code) {
account.Code = account.Code[2:]
}
- obj.SetCode(common.Hex2Bytes(account.Code))
- obj.SetNonce(common.Big(account.Nonce).Uint64())
-
+ code := common.Hex2Bytes(account.Code)
+ obj := state.NewObject(common.HexToAddress(addr), state.Account{
+ Balance: common.Big(account.Balance),
+ CodeHash: crypto.Keccak256(code),
+ Nonce: common.Big(account.Nonce).Uint64(),
+ }, onDirty)
+ obj.SetCode(code)
return obj
}