mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-11 07:17:53 +00:00
Save coinbase, not just extraNonce
This commit is contained in:
parent
b760e25458
commit
49c8e53ee2
@ -1581,7 +1581,8 @@ Value getwork(const Array& params, bool fHelp)
|
|||||||
if (IsInitialBlockDownload())
|
if (IsInitialBlockDownload())
|
||||||
throw JSONRPCError(-10, "Bitcoin is downloading blocks...");
|
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 vector<CBlock*> vNewBlock;
|
||||||
static CReserveKey reservekey(pwalletMain);
|
static CReserveKey reservekey(pwalletMain);
|
||||||
|
|
||||||
@ -1624,7 +1625,7 @@ Value getwork(const Array& params, bool fHelp)
|
|||||||
pblock->nNonce = 0;
|
pblock->nNonce = 0;
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, nExtraNonce);
|
mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig);
|
||||||
|
|
||||||
// Prebuild hash buffers
|
// Prebuild hash buffers
|
||||||
char pmidstate[32];
|
char pmidstate[32];
|
||||||
@ -1657,11 +1658,10 @@ Value getwork(const Array& params, bool fHelp)
|
|||||||
if (!mapNewBlock.count(pdata->hashMerkleRoot))
|
if (!mapNewBlock.count(pdata->hashMerkleRoot))
|
||||||
return false;
|
return false;
|
||||||
CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first;
|
CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first;
|
||||||
unsigned int nExtraNonce = mapNewBlock[pdata->hashMerkleRoot].second;
|
|
||||||
|
|
||||||
pblock->nTime = pdata->nTime;
|
pblock->nTime = pdata->nTime;
|
||||||
pblock->nNonce = pdata->nNonce;
|
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();
|
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
|
||||||
|
|
||||||
return CheckWork(pblock, *pwalletMain, reservekey);
|
return CheckWork(pblock, *pwalletMain, reservekey);
|
||||||
|
Loading…
Reference in New Issue
Block a user