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

Rework orphan block validation (validate_pow_only) #3172

Merged
merged 1 commit into from Dec 17, 2019

Conversation

antiochp
Copy link
Member

We call validate_pow_only() early in the block processing pipeline to prevent invalid blocks being added to the orphan block pool but we can do this earlier and in a cleaner way.
We need less conditional logic around these validation steps.

This PR updates the initial validation steps in process_block so we call validate_pow_only() before hitting the db for chain head and previous header.
Also took the opportunity to clean validate_pow_only() up a little to read better.

Note: We are in the unfortunate position of having tests dependent on headers with invalid pow. We need to return early in validate_pow_only() if the ctx includes SKIP_POW. This is only used in tests.

We should make a note to follow up with some effort to get rid of SKIP_POW entirely.

@antiochp antiochp added this to the 3.0.0 milestone Dec 16, 2019
Copy link
Contributor

@tromp tromp left a comment

Choose a reason for hiding this comment

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

solid improvement

@antiochp antiochp merged commit ea2092a into mimblewimble:master Dec 17, 2019
@antiochp antiochp deleted the cleanup_orphan_handling branch December 17, 2019 15:17
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.

None yet

4 participants