mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Merge branch 'unique_coinbase' of git://gitorious.org/~Luke-Jr/bitcoin/luke-jr-bitcoin into unique_coinbase
This commit is contained in:
commit
5a3dea451d
3 changed files with 14 additions and 15 deletions
16
src/main.cpp
16
src/main.cpp
|
|
@ -2798,16 +2798,17 @@ CBlock* CreateNewBlock(CReserveKey& reservekey)
|
|||
}
|
||||
|
||||
|
||||
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce, int64& nPrevTime)
|
||||
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce)
|
||||
{
|
||||
// Update nExtraNonce
|
||||
int64 nNow = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||
if (++nExtraNonce >= 0x7f && nNow > nPrevTime+1)
|
||||
static uint256 hashPrevBlock;
|
||||
if (hashPrevBlock != pblock->hashPrevBlock)
|
||||
{
|
||||
nExtraNonce = 1;
|
||||
nPrevTime = nNow;
|
||||
nExtraNonce = 0;
|
||||
hashPrevBlock = pblock->hashPrevBlock;
|
||||
}
|
||||
pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nBits << CBigNum(nExtraNonce);
|
||||
++nExtraNonce;
|
||||
pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nTime << CBigNum(nExtraNonce);
|
||||
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
|
||||
}
|
||||
|
||||
|
|
@ -2905,7 +2906,6 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||
// Each thread has its own key and counter
|
||||
CReserveKey reservekey(pwallet);
|
||||
unsigned int nExtraNonce = 0;
|
||||
int64 nPrevTime = 0;
|
||||
|
||||
while (fGenerateBitcoins)
|
||||
{
|
||||
|
|
@ -2932,7 +2932,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||
auto_ptr<CBlock> pblock(CreateNewBlock(reservekey));
|
||||
if (!pblock.get())
|
||||
return;
|
||||
IncrementExtraNonce(pblock.get(), pindexPrev, nExtraNonce, nPrevTime);
|
||||
IncrementExtraNonce(pblock.get(), pindexPrev, nExtraNonce);
|
||||
|
||||
printf("Running BitcoinMiner with %d transactions in block\n", pblock->vtx.size());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue