chain: add WATTX block-header variant (enables WTX/WATTx header sync + swaps) - #2732
Open
nucash-mining wants to merge 1 commit into
Open
chain: add WATTX block-header variant (enables WTX/WATTx header sync + swaps)#2732nucash-mining wants to merge 1 commit into
nucash-mining wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
WATTXchain variant to the block-header reader so KDF can parse WATTx (WTX) headers. Two files, +49/-2:mm2_bitcoin/serialization/src/reader.rs—ChainVariant::WATTX(+is_wattx(),"WATTX"parse).mm2_bitcoin/chain/src/block_header.rs— WATTX branch inBlockHeaderdeserialization.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 block —
nShift (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
QTUMvariant,blockchain.block.headersbatches 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. TheWATTXvariant: (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_11decodes a real 11-header batch (blockchain.block.headers(3121, 11)from a live WATTx ElectrumX). Passes:Context
Pairs with the coins-repo entry GLEECBTC/coins#1955, which sets
protocol.chain_variant: WATTXfor 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 ontomain.