aboutsummaryrefslogtreecommitdiffstats
path: root/core/blockchain.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-06-21 17:28:05 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-06-21 17:28:05 +0800
commitd926bf2c7e3182d694c15829a37a0ca7331cd03c (patch)
treec2d3ddd85941a231fb05de46c36703273d11814a /core/blockchain.go
parent8db8d074e2fff547e9d85169018e03f89b5975a1 (diff)
downloaddexon-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar
dexon-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar.gz
dexon-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar.bz2
dexon-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar.lz
dexon-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar.xz
dexon-d926bf2c7e3182d694c15829a37a0ca7331cd03c.tar.zst
dexon-d926bf2c7e3182d694c15829a37a0ca7331cd03c.zip
trie: cache collapsed tries node, not rlp blobs (#16876)
The current trie memory database/cache that we do pruning on stores trie nodes as binary rlp encoded blobs, and also stores the node relationships/references for GC purposes. However, most of the trie nodes (everything apart from a value node) is in essence just a collection of references. This PR switches out the RLP encoded trie blobs with the collapsed-but-not-serialized trie nodes. This permits most of the references to be recovered from within the node data structure, avoiding the need to track them a second time (expensive memory wise).
Diffstat (limited to 'core/blockchain.go')
-rw-r--r--core/blockchain.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/blockchain.go b/core/blockchain.go
index 34832252a..0b50e3f37 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -672,7 +672,7 @@ func (bc *BlockChain) Stop() {
}
}
for !bc.triegc.Empty() {
- triedb.Dereference(bc.triegc.PopItem().(common.Hash), common.Hash{})
+ triedb.Dereference(bc.triegc.PopItem().(common.Hash))
}
if size, _ := triedb.Size(); size != 0 {
log.Error("Dangling trie nodes after full cleanup")
@@ -947,7 +947,7 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.
bc.triegc.Push(root, number)
break
}
- triedb.Dereference(root.(common.Hash), common.Hash{})
+ triedb.Dereference(root.(common.Hash))
}
}
}