From 50b0a91b5dddd38f3094b9e97db77773d8299442 Mon Sep 17 00:00:00 2001 From: Bitflash Date: Thu, 30 Jul 2026 18:31:27 -0300 Subject: pool: put the height in the job builder's coinbase too (#60) #59 changed BitcoinMiner and stopped there. RebuildJob in rpc.cpp builds its own coinbase for the pool operator's job template, and that template is mined and submitted like any other block, so it had the same hole: nothing in the transaction belonged to the block, and a repeated combination of difficulty, counter and key produces a byte-identical coinbase. The claim in #59 that two coinbases at different heights can no longer be identical only becomes true with this. --- src/rpc.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/rpc.cpp') diff --git a/src/rpc.cpp b/src/rpc.cpp index 9cd0ed6..285f11b 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -153,7 +153,12 @@ static bool RebuildJob() CTransaction txNew; txNew.vin.resize(1); txNew.vin[0].prevout.SetNull(); - txNew.vin[0].scriptSig << nBits << (CBigNum)extraNonce; + // Height first, for the reason given at the matching line in + // BitcoinMiner: it is what keeps two coinbases at different heights + // from ever being byte-identical. This builder was missed when that + // went in, and it produces real blocks -- a pool operator's template + // is mined and submitted like any other. #58. + txNew.vin[0].scriptSig << (pindexPrev ? pindexPrev->nHeight + 1 : 0) << nBits << (CBigNum)extraNonce; txNew.vout.resize(1); txNew.vout[0].scriptPubKey << key.GetPubKey() << OP_CHECKSIG; -- cgit v1.2.3