upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f4e6ce2..c77448d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2883,7 +2883,25 @@ bool BitcoinMiner(int nThreadId)
2883 CTransaction txNew; 2883 CTransaction txNew;
2884 txNew.vin.resize(1); 2884 txNew.vin.resize(1);
2885 txNew.vin[0].prevout.SetNull(); 2885 txNew.vin[0].prevout.SetNull();
2886 txNew.vin[0].scriptSig << nBits << ++bnExtraNonce; 2886 // The height comes first and is what makes this transaction unique.
2887 //
2888 // Without it nothing in the coinbase belongs to the block: it is a
2889 // function of the difficulty, a counter, and the payout key. nBits
2890 // holds still for long stretches and bnExtraNonce is a local that
2891 // restarts at zero whenever the miner does, so the same combination
2892 // comes round again and produces a byte-identical transaction with the
2893 // same txid. Two blocks then name the same transaction and the index
2894 // keeps whichever arrived last, which silently destroys the outputs of
2895 // the first. It has already happened twice on this chain, at heights
2896 // 859 and 860 (#58).
2897 //
2898 // Two coinbases at different heights can now never be identical, no
2899 // matter what the counter or the key do.
2900 //
2901 // Nothing validates coinbase content, so this changes only what we
2902 // produce -- nodes that do not upgrade accept these blocks unchanged.
2903 // Requiring the height is a separate, coordinated step.
2904 txNew.vin[0].scriptSig << (pindexPrev ? pindexPrev->nHeight + 1 : 0) << nBits << ++bnExtraNonce;
2887 txNew.vout.resize(1); 2905 txNew.vout.resize(1);
2888 // Always pay coinbase to own wallet key. In operator mode, the pool 2906 // Always pay coinbase to own wallet key. In operator mode, the pool
2889 // server distributes shares to miners via SendMoney() after each block. 2907 // server distributes shares to miners via SendMoney() after each block.