upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/rpc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc.cpp')
-rw-r--r--src/rpc.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp
index 3db8b94..97d8429 100644
--- a/src/rpc.cpp
+++ b/src/rpc.cpp
@@ -146,7 +146,9 @@ static bool RebuildJob()
146 CBlockIndex* pindexPrev = pindexBest; 146 CBlockIndex* pindexPrev = pindexBest;
147 unsigned int nBits = GetNextWorkRequired(pindexPrev); 147 unsigned int nBits = GetNextWorkRequired(pindexPrev);
148 148
149 CKey key; key.MakeNewKey(); 149 // From the pool, so the template's payout key is in wallet.dat before
150 // any miner is handed work against it.
151 vector<unsigned char> vchPubKey = GetKeyFromPool();
150 static std::atomic<uint32_t> sExtra{0}; 152 static std::atomic<uint32_t> sExtra{0};
151 uint32_t extraNonce = ++sExtra; 153 uint32_t extraNonce = ++sExtra;
152 154
@@ -160,7 +162,7 @@ static bool RebuildJob()
160 // is mined and submitted like any other. #58. 162 // is mined and submitted like any other. #58.
161 txNew.vin[0].scriptSig << (pindexPrev ? pindexPrev->nHeight + 1 : 0) << nBits << (CBigNum)extraNonce; 163 txNew.vin[0].scriptSig << (pindexPrev ? pindexPrev->nHeight + 1 : 0) << nBits << (CBigNum)extraNonce;
162 txNew.vout.resize(1); 164 txNew.vout.resize(1);
163 txNew.vout[0].scriptPubKey << key.GetPubKey() << OP_CHECKSIG; 165 txNew.vout[0].scriptPubKey << vchPubKey << OP_CHECKSIG;
164 166
165 CBlock block; 167 CBlock block;
166 block.vtx.push_back(txNew); 168 block.vtx.push_back(txNew);
@@ -194,7 +196,8 @@ static bool RebuildJob()
194 (unsigned int)GetAdjustedTime()); 196 (unsigned int)GetAdjustedTime());
195 block.nBits = nBits; 197 block.nBits = nBits;
196 block.nNonce = 1; 198 block.nNonce = 1;
197 AddKey(key); 199 // No AddKey here: the pool wrote this key to wallet.dat before it was
200 // handed out.
198 201
199 StratumJob job; 202 StratumJob job;
200 job.jobId = ToHex(&extraNonce, 4); 203 job.jobId = ToHex(&extraNonce, 4);