forked from TrueCloudLab/neoneo-go
a1c4d7ce26
We need to compact our in-memory MPT from time to time, otherwise it quickly fills up all available memory. This raises two obvious quesions --- when to do that and to what level do that. As for 'when', I think it's quite easy to use our regular persistence interval as an anchor (and it also frees up some memory), but we can't do that in the persistence routine itself because of synchronization issues (adding some synchronization primitives would add some cost that I'd also like to avoid), so do it indirectly by comparing persisted and current height in `storeBlock`. Choosing proper level is another problem, but if we're to roughly estimate one full branch node to use 1K of memory (usually it's way less than that) then we can easily store 1K of these nodes and that gives us a depth of 10 for our trie. |
||
---|---|---|
.. | ||
block | ||
dao | ||
mempool | ||
mpt | ||
state | ||
storage | ||
test_data | ||
transaction | ||
blockchain.go | ||
blockchain_test.go | ||
blockchainer.go | ||
doc.go | ||
gas_price.go | ||
gas_price_test.go | ||
header_hash_list.go | ||
helper_test.go | ||
interop_neo.go | ||
interop_neo_test.go | ||
interop_system.go | ||
interops.go | ||
interops_test.go | ||
prometheus.go | ||
spent_coin.go | ||
storage_find.go | ||
util.go | ||
util_test.go |