diff options
| author | Bitflash <btf01@proton.me> | 2026-07-30 18:31:27 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-30 18:31:27 -0300 |
| commit | 50b0a91b5dddd38f3094b9e97db77773d8299442 (patch) | |
| tree | 3909dbdf7e083a6b385483a1aad893a7e2715132 /src | |
| parent | 86f080cc6deb0464edf3913daa2e1131b5eed7c7 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rpc.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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() | |||
| 153 | CTransaction txNew; | 153 | CTransaction txNew; |
| 154 | txNew.vin.resize(1); | 154 | txNew.vin.resize(1); |
| 155 | txNew.vin[0].prevout.SetNull(); | 155 | txNew.vin[0].prevout.SetNull(); |
| 156 | txNew.vin[0].scriptSig << nBits << (CBigNum)extraNonce; | 156 | // Height first, for the reason given at the matching line in |
| 157 | // BitcoinMiner: it is what keeps two coinbases at different heights | ||
| 158 | // from ever being byte-identical. This builder was missed when that | ||
| 159 | // went in, and it produces real blocks -- a pool operator's template | ||
| 160 | // is mined and submitted like any other. #58. | ||
| 161 | txNew.vin[0].scriptSig << (pindexPrev ? pindexPrev->nHeight + 1 : 0) << nBits << (CBigNum)extraNonce; | ||
| 157 | txNew.vout.resize(1); | 162 | txNew.vout.resize(1); |
| 158 | txNew.vout[0].scriptPubKey << key.GetPubKey() << OP_CHECKSIG; | 163 | txNew.vout[0].scriptPubKey << key.GetPubKey() << OP_CHECKSIG; |
| 159 | 164 | ||