aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2011-07-25 11:59:41 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2011-09-06 16:43:35 -0400
commit49c8e53ee2c2705fd0a8731458cb776dad7e1f6e (patch)
tree7945b36ee89ee31136cb18a0d0385b90877318a7
parentb760e254584a85db7195a4b1a67731a8cc12f9ed (diff)
Save coinbase, not just extraNonce
-rw-r--r--src/rpc.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp
index 9e7cfc5b3c..2a458423ce 100644
--- a/src/rpc.cpp
+++ b/src/rpc.cpp
@@ -1581,7 +1581,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);
@@ -1624,7 +1625,7 @@ Value getwork(const Array& params, bool fHelp)
pblock->nNonce = 0;
// 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];
@@ -1657,11 +1658,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);