Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed PruneOutdatedChains() #3999

Merged
merged 2 commits into from
Nov 29, 2024

Conversation

greymistcube
Copy link
Contributor

@greymistcube greymistcube commented Nov 28, 2024

Notes:

  • The new implementation works only under an assumption that the Stack of chain infos are either sequential or overlapping.
    • This is much weaker assumption than the original where every chain info's index has been managed correctly and is uncorrupted.
  • Some implementation decisions are made assuming that this will be a one-off "script" to prune outdated chains.
    • Internally, int indices are used pretty haphazardly assuming that currently there is no chain with its Tip.Index exceeding the max int value.
    • Again, assuming that there is no chain that is "too long", internal iteration instantiates an entire list of BlockHashes, which should not be a problem in terms of memory usage.
    • Due to using List<BlockHash> for iteration, the method should be safe (will throw an Exception when it fails without writing to IStore).

@greymistcube greymistcube changed the title Fixed PruneOutdatedChains Fixed PruneOutdatedChains() Nov 28, 2024
@greymistcube greymistcube force-pushed the fix/pruneoutdatedchains branch from f74330a to 5775cb8 Compare November 28, 2024 03:27
@greymistcube greymistcube merged commit 7513c9b into planetarium:main Nov 29, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants