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

Handle prefork hash correctly #3

Closed
h4x3rotab opened this issue Apr 20, 2018 · 1 comment
Closed

Handle prefork hash correctly #3

h4x3rotab opened this issue Apr 20, 2018 · 1 comment

Comments

@h4x3rotab
Copy link
Member

block100.getHash().reverse().toString('hex');

It produces the wrong hash for block 100: 7644500d651d8db203d8dfdb7053da2cffe8dffcb9a1bc115da63e047dfb7c17

The reason is that it tries to serialize a prefork Bitcoin block in the BTG block header manner. It will produce wrong hash and thus can't pass the target check as well.

Note that explorer.bitcoingold.org also has the same problem (so don't see it as the ground truth).

Solution: check the block height before doing serialization just like how BTG Core handles it.

Test vector: block 100
Hash: 000000007bc154e0fa7ea32218a72fe2c1bb9f86cf8c9ebf9a715ed27fdb229a
Height: 100
Hex:

0100000095194b8567fe2e8bbda931afd01a7acd399b9325cb54683e64129bcd00000000660802c98f18fd34fd16d61c63cf447568370124ac5f3be626c2e1c3c9f0052d000000000000000000000000000000000000000000000000000000000000000019a76949ffff001d33f3c25d00000000000000000000000000000000000000000000000000000000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d014dffffffff0100f2052a01000000434104e70a02f5af48a1989bf630d92523c9d14c45c75f7d1b998e962bff6ff9995fc5bdb44f1793b37495d80324acba7c8f537caaf8432b8d47987313060cc82d8a93ac00000000
@Vutov
Copy link

Vutov commented Apr 21, 2018

#5

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

2 participants