aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-09-27 18:13:13 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-09-28 16:27:31 +0800
commit710435b51b97b4c688b70bda35ab9d1aa704a988 (patch)
tree154eb1fc771c9d809dc537a5ae45418263ad0770 /core/blockchain.go
parentcd791bd855b55b95afc8a5c8f56b8bf67863d099 (diff)
downloaddexon-710435b51b97b4c688b70bda35ab9d1aa704a988.tar
dexon-710435b51b97b4c688b70bda35ab9d1aa704a988.tar.gz
dexon-710435b51b97b4c688b70bda35ab9d1aa704a988.tar.bz2
dexon-710435b51b97b4c688b70bda35ab9d1aa704a988.tar.lz
dexon-710435b51b97b4c688b70bda35ab9d1aa704a988.tar.xz
dexon-710435b51b97b4c688b70bda35ab9d1aa704a988.tar.zst
dexon-710435b51b97b4c688b70bda35ab9d1aa704a988.zip
core, eth, trie: reuse trie journals in all our code
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 a5f146a2d..1fbcdfc6f 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -357,7 +357,12 @@ func (self *BlockChain) AuxValidator() pow.PoW { return self.pow }
// State returns a new mutable state based on the current HEAD block.
func (self *BlockChain) State() (*state.StateDB, error) {
- return state.New(self.CurrentBlock().Root(), self.chainDb)
+ return self.StateAt(self.CurrentBlock().Root())
+}
+
+// StateAt returns a new mutable state based on a particular point in time.
+func (self *BlockChain) StateAt(root common.Hash) (*state.StateDB, error) {
+ return self.stateCache.New(root)
}
// Reset purges the entire blockchain, restoring it to its genesis state.