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

Prune list robustness #2976

Merged
merged 2 commits into from
Jul 29, 2019
Merged

Conversation

antiochp
Copy link
Member

We read the "prune list" from external data (via a txhashset download).
So we need to be a little careful with what we expect this to contain.

Specifically we make assumptions about this being 1-indexed and therefore will never contain a 0 value.

This PR adds some robustness around this - we still make the same assumption but we are not a little more defensive in how we deal with it.

  • Use saturating_sub(1) in preference to - 1 to avoid overflows.
  • Filter out 0 from our 1-indexed prune list when initializing the prune list.
  • Add some assert! to make logic errors more visible if/when we misuse the prune list

@antiochp antiochp added this to the 2.x.x milestone Jul 25, 2019
@antiochp antiochp self-assigned this Jul 25, 2019
@antiochp antiochp requested a review from hashmap July 25, 2019 11:34
@antiochp
Copy link
Member Author

We've tested this for a bit in various scenarios.
Going to merge this.

@antiochp antiochp merged commit aa5c428 into mimblewimble:master Jul 29, 2019
@antiochp antiochp deleted the prune_list_robustness branch July 29, 2019 11:42
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