Skip to content

Missing loop in Block.cs #1

Open

Description

@pekatete

Hi thanks for this project, just a few questions.

  1. Are you still maintaining this project?
  2. In the Blocks.cs file, there is a missing loop, it therefore always returns one block (whereas there can be / are multiple blocks in a blk*.dat file).
  3. Again with the Blocks.cs, the return value is a Block() whereas the calling ParseAll returns an IEnumerable(Of Block), thus the blocks read should be added to an IEnumerable (list?) before returning at the end of the (missing) loop mentioned in 2 above.

I've converted your code to VB and it works very well with the above additions but still have to polish off some things, like getting block height and identifying orphaned blocks.

Activity

  1. manly commented on Aug 13, 2017

    @manly
    Owner
  2. pekatete commented on Aug 13, 2017

    @pekatete
    Author

    Your guess is spot on, it was during the conversion that I lost the Yield, I added some more logic to my code that optimises reading the block-chain files ahead thus the loop in the Parse function.

    Any insight into getting block height and identifying orphaned blocks?

    Anyway, good project that I am sure has / will help many not into C++ et al, it's actually inspired me to try writing my own SPV wallet ....

  3. manly commented on Aug 13, 2017

    @manly
    Owner
  4. pekatete commented on Aug 13, 2017

    @pekatete
    Author

    Thanks for the heads-up, FYI it is BIP34 - https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki
    Should be trivial to decode that, and it does seem all v2 blocks must have it.

    The format of the height is "serialized CScript" -- first byte is number of bytes in the number (will be 0x03 on main net for the next 150 or so years with 223-1 blocks), following bytes are little-endian representation of the number (including a sign bit). Height is the height of the mined block in the block chain, where the genesis block is height zero (0).

  5. manly commented on Aug 14, 2017

    @manly
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions