Skip to content

Deserializing block header has one byte left #17

@RdeWilde

Description

@RdeWilde

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions