diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2011-09-07 10:51:57 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2011-09-07 10:51:57 -0400 |
commit | 5a3dea451d8a53ec87cbd7a7d1405a970fb1b263 (patch) | |
tree | 84a47b03eb615c8d8a4c3df2f7d0dbb0ad698dc0 /src/rpc.cpp | |
parent | f92f022edaa2f14951b9ce8304a304ff9693ae16 (diff) | |
parent | 83f4cd156e9d52bd7c4351336dfa4806a43ee4e4 (diff) | |
download | bitcoin-5a3dea451d8a53ec87cbd7a7d1405a970fb1b263.tar.xz |
Merge branch 'unique_coinbase' of git://gitorious.org/~Luke-Jr/bitcoin/luke-jr-bitcoin into unique_coinbase
Diffstat (limited to 'src/rpc.cpp')
-rw-r--r-- | src/rpc.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/rpc.cpp b/src/rpc.cpp index 4f4342770c..885ffd1f2b 100644 --- a/src/rpc.cpp +++ b/src/rpc.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); |