aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2017-06-27 21:57:06 +0800
committerGitHub <noreply@github.com>2017-06-27 21:57:06 +0800
commit9e5f03b6c487175cc5aa1224e5e12fd573f483a7 (patch)
tree475e573ff6c7e77cd069a2f6238afdb27d4bce43 /core/blockchain_test.go
parentbb366271fe33cf87b462dc5a25ac6c448ac6d2e1 (diff)
downloadgo-tangerine-9e5f03b6c487175cc5aa1224e5e12fd573f483a7.tar
go-tangerine-9e5f03b6c487175cc5aa1224e5e12fd573f483a7.tar.gz
go-tangerine-9e5f03b6c487175cc5aa1224e5e12fd573f483a7.tar.bz2
go-tangerine-9e5f03b6c487175cc5aa1224e5e12fd573f483a7.tar.lz
go-tangerine-9e5f03b6c487175cc5aa1224e5e12fd573f483a7.tar.xz
go-tangerine-9e5f03b6c487175cc5aa1224e5e12fd573f483a7.tar.zst
go-tangerine-9e5f03b6c487175cc5aa1224e5e12fd573f483a7.zip
core/state: access trie through Database interface, track errors (#14589)
With this commit, core/state's access to the underlying key/value database is mediated through an interface. Database errors are tracked in StateDB and returned by CommitTo or the new Error method. Motivation for this change: We can remove the light client's duplicated copy of core/state. The light client now supports node iteration, so tracing and storage enumeration can work with the light client (not implemented in this commit).
Diffstat (limited to 'core/blockchain_test.go')
-rw-r--r--core/blockchain_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/blockchain_test.go b/core/blockchain_test.go
index 7505208e1..371522ab7 100644
--- a/core/blockchain_test.go
+++ b/core/blockchain_test.go
@@ -131,7 +131,7 @@ func testBlockChainImport(chain types.Blocks, blockchain *BlockChain) error {
}
return err
}
- statedb, err := state.New(blockchain.GetBlockByHash(block.ParentHash()).Root(), blockchain.chainDb)
+ statedb, err := state.New(blockchain.GetBlockByHash(block.ParentHash()).Root(), blockchain.stateCache)
if err != nil {
return err
}
@@ -148,7 +148,7 @@ func testBlockChainImport(chain types.Blocks, blockchain *BlockChain) error {
blockchain.mu.Lock()
WriteTd(blockchain.chainDb, block.Hash(), block.NumberU64(), new(big.Int).Add(block.Difficulty(), blockchain.GetTdByHash(block.ParentHash())))
WriteBlock(blockchain.chainDb, block)
- statedb.Commit(false)
+ statedb.CommitTo(blockchain.chainDb, false)
blockchain.mu.Unlock()
}
return nil
@@ -1131,7 +1131,7 @@ func TestEIP161AccountRemoval(t *testing.T) {
if _, err := blockchain.InsertChain(types.Blocks{blocks[0]}); err != nil {
t.Fatal(err)
}
- if !blockchain.stateCache.Exist(theAddr) {
+ if st, _ := blockchain.State(); !st.Exist(theAddr) {
t.Error("expected account to exist")
}
@@ -1139,7 +1139,7 @@ func TestEIP161AccountRemoval(t *testing.T) {
if _, err := blockchain.InsertChain(types.Blocks{blocks[1]}); err != nil {
t.Fatal(err)
}
- if blockchain.stateCache.Exist(theAddr) {
+ if st, _ := blockchain.State(); st.Exist(theAddr) {
t.Error("account should not exist")
}
@@ -1147,7 +1147,7 @@ func TestEIP161AccountRemoval(t *testing.T) {
if _, err := blockchain.InsertChain(types.Blocks{blocks[2]}); err != nil {
t.Fatal(err)
}
- if blockchain.stateCache.Exist(theAddr) {
+ if st, _ := blockchain.State(); st.Exist(theAddr) {
t.Error("account should not exist")
}
}