forked from monero-project/monero
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fcmp++: TreeSync cache garbage collects de-ref'd tree elems
Every block, TreeSync sync_block saves the last chunk in each layer's elems. It needs to do this for 3 reasons: 1) so it can use the tree's last hashes to grow the tree in the next block. 2) in case a registered output appears in the first chunk next block. 3) to trim the tree on reorg using the last children from each chunk. Reasons 1 and 2 are strictly related to the *next* block. The last chunks from block n are needed to sync block n+1, but are no longer needed to sync blocks >= n+2. However, in order to handle reorgs up to m blocks deep, the class keeps the last chunks around for each block, going back m blocks. This commit implements: when syncing block n, purge cached leaves and tree elems that were cached when syncing block n-m, where n>m. It is careful not to purge leaves and cache elems that are tied to regisered output paths.
- Loading branch information
Showing
3 changed files
with
228 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.