aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoinrpc.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-09-16 06:55:47 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-09-16 06:55:47 +0200
commit5dd7318db75db580d602c72a2322df97d8712233 (patch)
treee15a3c55d610d8c9e26ac2224d746e8b36a0450a /src/bitcoinrpc.cpp
parentc1e667222ad7eac6403cd60aab4d5d09ed0ff02d (diff)
parent217208a36d210e7d51e405d0e531ac2b75a3a087 (diff)
Merge branch 'master' of https://github.com/bitcoin/bitcoin
Diffstat (limited to 'src/bitcoinrpc.cpp')
-rw-r--r--src/bitcoinrpc.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index 5348e9a3fc..f111ad2e17 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -1498,7 +1498,8 @@ Value getwork(const Array& params, bool fHelp)
if (IsInitialBlockDownload())
throw JSONRPCError(-10, "Bitcoin is downloading blocks...");
- static map<uint256, pair<CBlock*, unsigned int> > mapNewBlock;
+ typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t;
+ static mapNewBlock_t mapNewBlock;
static vector<CBlock*> vNewBlock;
static CReserveKey reservekey(pwalletMain);
@@ -1537,11 +1538,10 @@ Value getwork(const Array& params, bool fHelp)
// Update nExtraNonce
static unsigned int nExtraNonce = 0;
- static int64 nPrevTime = 0;
- IncrementExtraNonce(pblock, pindexPrev, nExtraNonce, nPrevTime);
+ IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
// Save
- mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, nExtraNonce);
+ mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig);
// Prebuild hash buffers
char pmidstate[32];
@@ -1574,11 +1574,10 @@ Value getwork(const Array& params, bool fHelp)
if (!mapNewBlock.count(pdata->hashMerkleRoot))
return false;
CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first;
- unsigned int nExtraNonce = mapNewBlock[pdata->hashMerkleRoot].second;
pblock->nTime = pdata->nTime;
pblock->nNonce = pdata->nNonce;
- pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nBits << CBigNum(nExtraNonce);
+ pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second;
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
return CheckWork(pblock, *pwalletMain, reservekey);