diff options
author | Felix Lange <fjl@twurst.com> | 2015-08-18 20:14:45 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-09-23 04:57:37 +0800 |
commit | a2d5a60418e70ce56112381dffdd121cc678a1b6 (patch) | |
tree | c9733cb16b7ca5bac98d6ae11254def5a48aafb8 /tests/block_test_util.go | |
parent | 565d9f2306d19f63be6a6e1b8fc480af8dca9617 (diff) | |
download | go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar.gz go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar.bz2 go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar.lz go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar.xz go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.tar.zst go-tangerine-a2d5a60418e70ce56112381dffdd121cc678a1b6.zip |
core, core/state: batch-based state sync
Diffstat (limited to 'tests/block_test_util.go')
-rw-r--r-- | tests/block_test_util.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 3ca00bae8..33577cf55 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -253,13 +253,13 @@ func (t *BlockTest) InsertPreState(ethereum *eth.Ethereum) (*state.StateDB, erro statedb.SetState(common.HexToAddress(addrString), common.HexToHash(k), common.HexToHash(v)) } } - // sync objects to trie - statedb.SyncObjects() - // sync trie to disk - statedb.Sync() - if !bytes.Equal(t.Genesis.Root().Bytes(), statedb.Root().Bytes()) { - return nil, fmt.Errorf("computed state root does not match genesis block %x %x", t.Genesis.Root().Bytes()[:4], statedb.Root().Bytes()[:4]) + root, err := statedb.Commit() + if err != nil { + return nil, fmt.Errorf("error writing state: %v", err) + } + if t.Genesis.Root() != root { + return nil, fmt.Errorf("computed state root does not match genesis block: genesis=%x computed=%x", t.Genesis.Root().Bytes()[:4], root.Bytes()[:4]) } return statedb, nil } |