aboutsummaryrefslogtreecommitdiffstats
path: root/light
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-10-06 22:14:22 +0800
committerGitHub <noreply@github.com>2016-10-06 22:14:22 +0800
commit7335a70a020517cc9cebe7ae82c0e49ba133abf1 (patch)
treecc63625fa07bf3fb28326a01d5c8255a83a83bd1 /light
parent07caa3fccdfe11bbee084c043ac11e7cfae9a6b7 (diff)
parent3c836dd71b192de24774b1848173a4eb0ca9a63b (diff)
downloaddexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.gz
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.bz2
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.lz
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.xz
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.zst
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.zip
Merge pull request #3092 from fjl/state-journal
core/state: implement reverts by journaling all changes
Diffstat (limited to 'light')
-rw-r--r--light/state_test.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/light/state_test.go b/light/state_test.go
index d4fe95022..a6b115786 100644
--- a/light/state_test.go
+++ b/light/state_test.go
@@ -23,7 +23,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
- "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/trie"
"golang.org/x/net/context"
@@ -54,16 +53,13 @@ func makeTestState() (common.Hash, ethdb.Database) {
sdb, _ := ethdb.NewMemDatabase()
st, _ := state.New(common.Hash{}, sdb)
for i := byte(0); i < 100; i++ {
- so := st.GetOrNewStateObject(common.Address{i})
+ addr := common.Address{i}
for j := byte(0); j < 100; j++ {
- val := common.Hash{i, j}
- so.SetState(common.Hash{j}, val)
- so.SetNonce(100)
+ st.SetState(addr, common.Hash{j}, common.Hash{i, j})
}
- so.AddBalance(big.NewInt(int64(i)))
- so.SetCode(crypto.Keccak256Hash([]byte{i, i, i}), []byte{i, i, i})
- so.UpdateRoot(sdb)
- st.UpdateStateObject(so)
+ st.SetNonce(addr, 100)
+ st.AddBalance(addr, big.NewInt(int64(i)))
+ st.SetCode(addr, []byte{i, i, i})
}
root, _ := st.Commit()
return root, sdb