aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2011-09-06 16:39:05 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2011-09-06 16:43:40 -0400
commit83f4cd156e9d52bd7c4351336dfa4806a43ee4e4 (patch)
treef4e2cd9e0f8be15977e3e2e9a224719fd195f8f1 /src/main.cpp
parent49c8e53ee2c2705fd0a8731458cb776dad7e1f6e (diff)
downloadbitcoin-83f4cd156e9d52bd7c4351336dfa4806a43ee4e4.tar.xz
Bugfix: Use timestamp in coinbase rather than "bits", needed to ensure coinbase txn is unique even if address is the same
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 480d2d8bbf..10308bc9dd 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -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());