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

Optimize AddBlock logic for pos fee estimator #1218

Open
wants to merge 1 commit into
base: feature/proof-of-stake
Choose a base branch
from

Conversation

lazynina
Copy link
Member

No description provided.

@lazynina lazynina requested a review from a team as a code owner April 12, 2024 21:26
Copy link
Member Author

lazynina commented Apr 12, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

@lazynina lazynina force-pushed the optimize-pos-fee-estimator-add-block branch 3 times, most recently from 20b95c6 to e870bae Compare April 12, 2024 21:35
@lazynina lazynina force-pushed the optimize-pos-fee-estimator-add-block branch from e870bae to 94695d3 Compare April 12, 2024 21:40

// Remove all blocks that were pruned are no longer in the cached blocks.
for _, removedBlock := range removedBlocks {
if err = posFeeEstimator.removeBlockNoLock(removedBlock); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This operation ends up reinitializing the transaction register for every block that's removed. I think it ends up being even less efficient than the original code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removeBlockNoLock was updated to modify the transaction register in place w/o creating a new one.

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