aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-05-31 05:07:51 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-05-31 05:07:51 +0800
commit5c39a1bb26813d05244a5408b20fb0b38c10c8b2 (patch)
treeaf9ebf86f6f863f9b23c502cb1699c604938fcd6 /core/blockchain.go
parentab664c7e17009729d1083d8d4f7c37eb387012d3 (diff)
parent748d1c171d74fbf6b6051fd629d3c2204dd930e3 (diff)
downloaddexon-5c39a1bb26813d05244a5408b20fb0b38c10c8b2.tar
dexon-5c39a1bb26813d05244a5408b20fb0b38c10c8b2.tar.gz
dexon-5c39a1bb26813d05244a5408b20fb0b38c10c8b2.tar.bz2
dexon-5c39a1bb26813d05244a5408b20fb0b38c10c8b2.tar.lz
dexon-5c39a1bb26813d05244a5408b20fb0b38c10c8b2.tar.xz
dexon-5c39a1bb26813d05244a5408b20fb0b38c10c8b2.tar.zst
dexon-5c39a1bb26813d05244a5408b20fb0b38c10c8b2.zip
Merge pull request #2585 from karalabe/trie-dirty-tracking
core, core/state, trie: enterprise hand-tuned multi-level caching
Diffstat (limited to 'core/blockchain.go')
-rw-r--r--core/blockchain.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 171a49e53..bd84adfe9 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -819,6 +819,7 @@ func (self *BlockChain) InsertChain(chain types.Blocks) (int, error) {
tstart = time.Now()
nonceChecked = make([]bool, len(chain))
+ statedb *state.StateDB
)
// Start the parallel nonce verifier.
@@ -885,7 +886,11 @@ func (self *BlockChain) InsertChain(chain types.Blocks) (int, error) {
// Create a new statedb using the parent block and report an
// error if it fails.
- statedb, err := state.New(self.GetBlock(block.ParentHash()).Root(), self.chainDb)
+ if statedb == nil {
+ statedb, err = state.New(self.GetBlock(block.ParentHash()).Root(), self.chainDb)
+ } else {
+ err = statedb.Reset(chain[i-1].Root())
+ }
if err != nil {
reportBlock(block, err)
return i, err