Skip to content

unwrap.js: cryptonight+auxpow blocks mis-decode (variable-length parent header) #6

Description

@melvincarvalho

Block 468,977 (algo CRYPTONIGHT, auxpow=yes) fails codec.decode('Block') after unwrap.js — "unexpected end of data". unwrap produced an 80-byte standard block with no transactions (it consumed the whole 463-byte raw block as header+auxpow, leaving no tx bytes), so decode runs off the end.

Likely cause: the auxpow parent header for cryptonight is a variable-length vector (vector_format / keccak_hash per the CBlockHeader serialization), and unwrap's skipAuxpow / readPureHeader offset math for that case is wrong. More generally, some headers are longer than 80 bytes (equihash = 1487; cryptonight parent = variable), so the fixed assumptions break on this combination.

Workaround (in place): proof/sync.mjs now falls back to bitmarkd's parsed transactions for any block the codec can't decode (counts a unwrap-decode (→ bitmarkd fallback) warning), so the sync no longer halts. But those blocks' scripts aren't verified.

Proper fix: handle the cryptonight+auxpow serialization in unwrap.js (and audit the >80-byte / vector_format header cases) so these blocks decode natively.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions