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

introduce rewindable_kernel_view (readonly but rewindable kernel MMR view) #1587

Merged
merged 4 commits into from
Sep 26, 2018

Conversation

antiochp
Copy link
Member

@antiochp antiochp commented Sep 25, 2018

  • introduce rewindable_kernel_view
  • break txhashset out into a module to keep files clean
  • set a header on a txhashset extension
    • no need to pass one in on various calls to the ext now
    • update it on rewind() as necessary

We can now validate the full history of kernel roots via -

		let mut current = header.clone();
		txhashset::rewindable_kernel_view(&txhashset, |view| {
			while current.height > 0 {
				view.rewind(&current)?;
				view.validate_root()?;
				current = view.batch().get_block_header(&current.previous)?;
			}
			Ok(())
		})?;

All of this is to explore a kernel specific view rather than starting a new full txhashset extension. We only need the kernels when we validate the kernel roots back through history (and it needs to be rewindable, but does not need to be writeable).

There is limited value here when just thinking about the kernel MMR, but we are considering putting PoW in an MMR to implement Flyclient (see #1555) and it would be nice to have some flexibility in terms of how we access txhashset and the underlying MMRs.

I imagine something similar to this rewindable, readonly kernel view for the (yet to exist)
"BlockHeader MMR".

@antiochp antiochp merged commit acec59e into mimblewimble:master Sep 26, 2018
@antiochp antiochp deleted the rewindable_kernel_view branch September 26, 2018 08:59
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