mpt: modify refcounted storage scheme to make GC possible
Add "active" flag into the node data and make the remainder modal, for active nodes it's a reference counter, for inactive ones the deactivation height is stored. Technically, refcounted chains storing just one trie don't need a flag, but it's a bit simpler this way.
This commit is contained in:
parent
86cb4ed80f
commit
c4ee310e85
9 changed files with 84 additions and 62 deletions
|
@ -24,7 +24,7 @@ func TestModule_PR2019_discussion_r689629704(t *testing.T) {
|
|||
require.NoError(t, tr.Put([]byte{0x06, 0x03}, []byte("leaf4")))
|
||||
|
||||
sr := tr.StateRoot()
|
||||
tr.Flush()
|
||||
tr.Flush(0)
|
||||
|
||||
// Keep MPT nodes in a map in order not to repeat them. We'll use `nodes` map to ask
|
||||
// state sync module to restore the nodes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue