Skip to content

Source-built binaries fail to sync past block 450,947 (Fork #1) #140

@melvincarvalho

Description

@melvincarvalho

Summary

Binaries compiled from source (master branch) fail to sync past block 450,947 with PoW validation errors, while the official v0.9.7.2 release binary syncs successfully.

Environment

  • OS: Ubuntu 22.04 / 24.04
  • Compiler: GCC 11+
  • OpenSSL: 3.0.x
  • Boost: 1.74+

Reproduction Steps

  1. Build from master branch (with PR Fix build on Ubuntu 22.04 and 24.04 (GCC 11+, Boost 1.74+) #138 fixes for Blake2 alignment and Boost placeholders)
  2. Start bitmarkd and let it sync
  3. Observe failure at block 450,947

Error Details

UpdateTip: new best=d4b12e844971df57d6e1017e1c0c191f2e2c31175ee0d63313142754393a8956  height=450946  log2_work=72.842976  tx=1090252  date=1528347329 progress=0.031011 nbits=453792464 algo=0
ProcessBlock: ACCEPTED
ERROR: CheckProofOfWork() : hash doesn't match nBits (hash is dd64d857462cf74a732c555b70f36efb82691956d9cb600b8f81df73760fa267, nbits is 0000003e7fc10000...
ERROR: CheckBlock() : proof of work failed
  • Block 450,946 (algo=0, Scrypt) validates successfully
  • Block 450,947 (should be algo=5, Lyra2REv2) fails
  • The computed hash has no leading zeros - suggesting wrong hash algorithm

Investigation Findings

Official Binary Works

The official v0.9.7.2 binary (Ubuntu 18.04, OpenSSL 1.0.2n) syncs past Fork #1:

height=450947  nbits=490635201 algo=5  ✓
height=450948  nbits=490635201 algo=5  ✓
...continuing to 668,000+

Code Comparison

Compared v0.9.7.2 tag with current master:

  • BLOCK_VERSION_ALGO mask: identical (7 << 9)
  • GetAlgo() function: identical
  • GetPoWHash() function: identical
  • CheckProofOfWork(): identical

The only consensus-related changes are:

  • Fork2 functions commented out (March 2021)
  • VARIANT flags added to block version (bits 13-14)
  • Neither should affect blocks before 511,111

Related Issues

Potential Causes

  1. OpenSSL 1.1+ incompatibility - BIGNUM became opaque structure
  2. Compiler optimization differences - GCC 11+ vs GCC 7.x
  3. Undefined behavior - code that worked on older compilers
  4. Hash function library differences - sphlib, Lyra2, etc.

Proposed Solutions

  1. Add debug logging to trace algo detection and hash computation
  2. Build in Ubuntu 16.04/18.04 Docker with OpenSSL 1.0
  3. Identify specific code causing different behavior
  4. Create compatibility layer for OpenSSL 1.1+

Questions

  1. Was the official v0.9.7.2 binary built from exactly commit 79262c2?
  2. Are there any unpublished patches in the release binaries?
  3. Has anyone successfully built from source on modern systems?

/cc @dbkeys @piratelinux

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