aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-10-19 19:55:13 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-10-19 19:55:13 +0800
commit4f46bd19d0b123327596785dc3975d5e4008d761 (patch)
tree669ad5ec53b1408885465c5c3affb38e99f82b5e /core
parentca49510e6dd40e78e3e6827c6c4d7b2a3ec8ef5b (diff)
downloaddexon-4f46bd19d0b123327596785dc3975d5e4008d761.tar
dexon-4f46bd19d0b123327596785dc3975d5e4008d761.tar.gz
dexon-4f46bd19d0b123327596785dc3975d5e4008d761.tar.bz2
dexon-4f46bd19d0b123327596785dc3975d5e4008d761.tar.lz
dexon-4f46bd19d0b123327596785dc3975d5e4008d761.tar.xz
dexon-4f46bd19d0b123327596785dc3975d5e4008d761.tar.zst
dexon-4f46bd19d0b123327596785dc3975d5e4008d761.zip
cmd, core/state: allow configurable trie cache generations
Diffstat (limited to 'core')
-rw-r--r--core/state/statedb.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/state/statedb.go b/core/state/statedb.go
index 0e46e5e2c..6a24d2865 100644
--- a/core/state/statedb.go
+++ b/core/state/statedb.go
@@ -38,14 +38,14 @@ import (
// created.
var StartingNonce uint64
+// Trie cache generation limit after which to evic trie nodes from memory.
+var MaxTrieCacheGen = uint16(120)
+
const (
// Number of past tries to keep. This value is chosen such that
// reasonable chain reorg depths will hit an existing trie.
maxPastTries = 12
- // Trie cache generation limit.
- maxTrieCacheGen = 120
-
// Number of codehash->size associations to keep.
codeSizeCacheSize = 100000
)
@@ -89,7 +89,7 @@ type StateDB struct {
// Create a new state from a given trie
func New(root common.Hash, db ethdb.Database) (*StateDB, error) {
- tr, err := trie.NewSecure(root, db, maxTrieCacheGen)
+ tr, err := trie.NewSecure(root, db, MaxTrieCacheGen)
if err != nil {
return nil, err
}
@@ -158,7 +158,7 @@ func (self *StateDB) openTrie(root common.Hash) (*trie.SecureTrie, error) {
return &tr, nil
}
}
- return trie.NewSecure(root, self.db, maxTrieCacheGen)
+ return trie.NewSecure(root, self.db, MaxTrieCacheGen)
}
func (self *StateDB) pushTrie(t *trie.SecureTrie) {