mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 06:43:45 +01:00
Bugfix: Use timestamp in coinbase rather than "bits", needed to ensure coinbase txn is unique even if address is the same
This commit is contained in:
@@ -2794,7 +2794,7 @@ 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
|
||||
static uint256 hashPrevBlock;
|
||||
@@ -2804,7 +2804,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
|
||||
hashPrevBlock = pblock->hashPrevBlock;
|
||||
}
|
||||
++nExtraNonce;
|
||||
pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nBits << CBigNum(nExtraNonce);
|
||||
pblock->vtx[0].vin[0].scriptSig = CScript() << pblock->nTime << CBigNum(nExtraNonce);
|
||||
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
|
||||
}
|
||||
|
||||
@@ -2902,7 +2902,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)
|
||||
{
|
||||
@@ -2929,7 +2928,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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user