trie: ensure resolved nodes stay loaded

Commit 40cdcf1183 broke the optimisation which kept nodes resolved
during Get in the trie. The decoder assigned cache generation 0
unconditionally, causing resolved nodes to get flushed on Commit.

This commit fixes it and adds two tests.
This commit is contained in:
Felix Lange
2016-10-17 16:13:50 +02:00
parent 187d6a66a5
commit 177cab5fe7
6 changed files with 95 additions and 43 deletions

View File

@ -58,7 +58,7 @@ func (h *hasher) hash(n node, db DatabaseWriter, force bool) (node, node, error)
return hash, n, nil
}
if n.canUnload(h.cachegen, h.cachelimit) {
// Evict the node from cache. All of its subnodes will have a lower or equal
// Unload the node from cache. All of its subnodes will have a lower or equal
// cache generation number.
return hash, hash, nil
}