mina-indexer icon indicating copy to clipboard operation
mina-indexer copied to clipboard

Spike: remove `diffs_map` from `IndexerState` and get ledger diffs from the db instead

Open Isaac-DeFrain opened this issue 8 months ago • 0 comments

Currently, for each block in the witness tree, we store a copy of its ledger diff in a hash map called diffs_map: HashMap<BlockHash, LedgerDiff>. This map is maintained with the witness tree to keep it as small as possible. However, the diffs map holds onto all ledger diffs for blocks in any dangling branches.

Additionally, we need to keep a copy of each block's ledger diff in the db to expedite staged ledger calculations in the indexer store, as opposed to deserializing the PCBs just for their ledger diffs.

We should investigate removing the diffs map from IndexerState and getting stored ledger diffs from the db instead.

Isaac-DeFrain avatar Jun 13 '24 20:06 Isaac-DeFrain