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

Build block header from pre pow data and proof #3178

Merged
merged 6 commits into from
Jan 23, 2020

Conversation

austinabell
Copy link
Contributor

Couple notes about the changes:

  • I could add another function which takes a vector of pre pow bytes including the serialized nonce and the proof (or replace if you want a specific function signature)
  • I made some changes to the signature mentioned in the issue since it just seemed cleaner and more usable
  • I kept the pre_pow parameter a String although there is no need for it to be mutable in this function.
    • I am happy to change the from_hex function you have to instead take a &str since that does not need to be mutable either as it is just reading (that function is the main reason I kept as String, because it would just be converted back to a String anyway)

Copy link
Member

@quentinlesceller quentinlesceller left a comment

Choose a reason for hiding this comment

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

Thank you very much @austinabell! Looking good to me 👍

Copy link
Member

@antiochp antiochp left a comment

Choose a reason for hiding this comment

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

This looks great!

One comment related to the automatic From error conversion.

core/src/core/block.rs Outdated Show resolved Hide resolved
@austinabell austinabell requested a review from antiochp January 22, 2020 17:37
) -> Result<Self, Error> {
// Convert hex pre pow string
let mut header_bytes = from_hex(pre_pow)
.map_err(|e| Error::Serialization(ser::Error::HexError(e.to_string())))?;
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@antiochp antiochp left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@antiochp antiochp merged commit 4152d9f into mimblewimble:master Jan 23, 2020
@antiochp antiochp mentioned this pull request Feb 24, 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.

Please add function for building block header to grin-core
3 participants