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

refactor apply_inputs and support converting block for v2 compatibility #3409

Merged
merged 6 commits into from
Jul 31, 2020

Conversation

antiochp
Copy link
Member

@antiochp antiochp commented Jul 29, 2020

Refactor apply_inputs() and validate_inputs() to reduce duplicated code and simplify block conversion for future compatibility and v2 peer support.

Extracted some relatively isolated changes from #3385.

  • utxo_view is now "source of truth" for identifying outputs being spent by inputs
  • we now convert a block to v2 compatibility when processing new blocks
    • uses utxo_view.validate_inputs() to identify outputs being spent
  • apply_inputs() now uses utxo_view.validate_inputs() internally
    • removed duplicate lookup code in apply_inputs()

We need to hook block conversion into the block processing pipeline early on, but after orphan block identification.
This required some refactoring of chain.process_block_single().
Checking for orphan block is simplified with an explicit check for "previous block in db".

This is a relatively large PR but mainly refactoring with the addition of the "v2 block conversion" step (lookup features for each output being spent).

We have good test coverage of the block processing pipeline.
Testing this on mainnet also to ensure the node syncs and stays in sync.

@antiochp
Copy link
Member Author

Merging this - tested thoroughly on floonet and mainnet (and mining on usertesting).

@antiochp antiochp merged commit 04c8713 into mimblewimble:master Jul 31, 2020
@antiochp antiochp deleted the inputs_lookup_outputs branch July 31, 2020 13:36
@antiochp antiochp mentioned this pull request Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant