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

[Bug Report] Block header hash value is not the same though the header is the same #4132

Open
jackzhhuang opened this issue Jun 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jackzhhuang
Copy link
Collaborator

jackzhhuang commented Jun 7, 2024

pub fn random() -> Self {
        let body = BlockBody::sample();
        let mut header = BlockHeader::random();
        header.body_hash = body.hash();

        Self { header, body }
    }

In struct Block, body hash is involved with the header id calculation but it is set after the calculation resulting in mismatch

@jackzhhuang jackzhhuang added the bug Something isn't working label Jun 7, 2024
@nkysg
Copy link
Collaborator

nkysg commented Jun 7, 2024

I don't understand it. Could you provide more information?

@jackzhhuang
Copy link
Collaborator Author

jackzhhuang commented Jun 7, 2024

pseudo code:

header.body_hash = random()
header.id = hash(header)
header.body_hash = body.sample().hash

header.id is not consistent with header value after the line: header.body_hash = body.sample().hash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants