aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/gitian-win32.yml1
-rw-r--r--contrib/gitian.yml2
-rw-r--r--src/main.cpp16
-rw-r--r--src/main.h2
-rw-r--r--src/rpc.cpp11
5 files changed, 16 insertions, 16 deletions
diff --git a/contrib/gitian-win32.yml b/contrib/gitian-win32.yml
index 963c381393..52b10bc33f 100644
--- a/contrib/gitian-win32.yml
+++ b/contrib/gitian-win32.yml
@@ -10,6 +10,7 @@ packages:
- "unzip"
- "nsis"
- "faketime"
+- "wine"
reference_datetime: "2011-01-30 00:00:00"
remotes:
- "url": "https://github.com/bitcoin/bitcoin.git"
diff --git a/contrib/gitian.yml b/contrib/gitian.yml
index 8d0abf8994..efa9cb8c10 100644
--- a/contrib/gitian.yml
+++ b/contrib/gitian.yml
@@ -34,7 +34,7 @@ script: |
mkdir wxWidgets-2.9.2
cd wxWidgets-2.9.2
unzip ../wxWidgets-2.9.2-x32-gitian.zip
- unzip -f ../wxWidgets-2.9.2-x64-gitian.zip
+ unzip -o ../wxWidgets-2.9.2-x64-gitian.zip
cp -a bin/$GBUILD_BITS/wx/config/gtk2-unicode-static-2.9 $INSTDIR/bin/wx-config
for lib in wx_gtk2u wxregexu wxtiff; do
ar rc $INSTDIR/lib/lib${lib}-2.9.a bin/$GBUILD_BITS/$lib/*.o
diff --git a/src/main.cpp b/src/main.cpp
index dce26d3599..5b159fe415 100644
--- a/src/main.cpp
+++ b/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());
diff --git a/src/main.h b/src/main.h
index 427067bc94..c400145d01 100644
--- a/src/main.h
+++ b/src/main.h
@@ -94,7 +94,7 @@ bool ProcessMessages(CNode* pfrom);
bool SendMessages(CNode* pto, bool fSendTrickle);
void GenerateBitcoins(bool fGenerate, CWallet* pwallet);
CBlock* CreateNewBlock(CReserveKey& reservekey);
-void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce, int64& nPrevTime);
+void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce);
void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1);
bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey);
bool CheckProofOfWork(uint256 hash, unsigned int nBits);
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);