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

Deserializing block header has one byte left #17

Open
RdeWilde opened this issue Mar 18, 2018 · 1 comment
Open

Deserializing block header has one byte left #17

RdeWilde opened this issue Mar 18, 2018 · 1 comment

Comments

@RdeWilde
Copy link

I tried deserializing the block headers using the provided tests, but there was one byte left per header.
https://github.com/dartcoin/dart-bitcoin/blob/master/lib/src/core/block_header.dart#L105

I'm not sure if the byte left is a 00 byte dividing the headers? Or is is the txs count?
I modified it like this:

  void bitcoinDeserialize(bytes.Reader reader, int pver) {
    version = readUintLE(reader);
    previousBlock = readSHA256(reader);
    merkleRoot = readSHA256(reader);
    timestamp = readUintLE(reader);
    difficultyTarget = readUintLE(reader);
    nonce = readUintLE(reader);
    reader.readByte(); // 00 byte
  }

Is this right, or is there a better place/way to do it?

@RdeWilde
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant