Skip to content

chain: add WATTX block-header variant (enables WTX/WATTx header sync + swaps) - #2732

Open
nucash-mining wants to merge 1 commit into
GLEECBTC:mainfrom
nucash-mining:add-wattx-header-variant
Open

chain: add WATTX block-header variant (enables WTX/WATTx header sync + swaps)#2732
nucash-mining wants to merge 1 commit into
GLEECBTC:mainfrom
nucash-mining:add-wattx-header-variant

Conversation

@nucash-mining

Copy link
Copy Markdown

What

Adds a WATTX chain variant to the block-header reader so KDF can parse WATTx (WTX) headers. Two files, +49/-2:

  • mm2_bitcoin/serialization/src/reader.rsChainVariant::WATTX (+ is_wattx(), "WATTX" parse).
  • mm2_bitcoin/chain/src/block_header.rs — WATTX branch in BlockHeader deserialization.

Why

WATTx is a Qtum fork, so it uses Qtum's extended header (180-byte base + varbytes block signature + hashStateRoot/hashUTXORoot/prevoutStake). But WATTx additionally appends a 40-byte Gapcoin tail on every blocknShift (4) + nAdder (32) + nGapSize (4) — and the block hash is computed over that full extended header. It also sets the AuxPoW version bit on merged-mined blocks without carrying an AuxPoW payload in the header.

With the stock QTUM variant, blockchain.block.headers batches from a WATTx ElectrumX mis-parse (Transaction has no inputs-style errors as the reader runs past the header), which breaks WTX header sync and therefore WTX atomic swaps. The WATTX variant: (1) reads the Qtum fields, (2) skips the in-header AuxPoW read for WATTx, and (3) consumes the trailing 40 bytes.

Test

chain::block_header::tests::test_wattx_block_headers_batch_11 decodes a real 11-header batch (blockchain.block.headers(3121, 11) from a live WATTx ElectrumX). Passes:

test block_header::tests::test_wattx_block_headers_batch_11 ... ok

Context

Pairs with the coins-repo entry GLEECBTC/coins#1955, which sets protocol.chain_variant: WATTX for WTX and points at a live WSS ElectrumX (electrum-wtx.wattxchange.app:443). Once this variant is in the hosted kdf build and dex.gleec.com is rebuilt, WTX activates and swaps. Single self-contained commit, cherry-picked clean onto main.

…pcoin tail on every block and skips AuxPoW in the header, fixing WTX electrum header-batch parsing (was breaking WTX atomic swaps). Test: real 11-header batch from h=3121.
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

Successfully merging this pull request may close these issues.

1 participant