aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2010-07-19 01:02:04 +0000
committerGavin Andresen <gavinandresen@gmail.com>2010-07-19 01:02:04 +0000
commit9d2174b6f5f3fac2463c7ebc2dbb9004b3740d23 (patch)
treef378432b78a6cef9c0f9f0260cf549bd560b8bc0 /main.cpp
parent8bd66202c324a6c7a79abc0f1f0558dacbc59460 (diff)
downloadbitcoin-9d2174b6f5f3fac2463c7ebc2dbb9004b3740d23.tar.xz
version 0.3.1 rc1v0.3.1rc1
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index 5f500975ed..8ddcd68890 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2544,13 +2544,13 @@ void BlockSHA256(const void* pin, unsigned int nBlocks, void* pout)
void BitcoinMiner()
{
printf("BitcoinMiner started\n");
+ SetThreadPriority(THREAD_PRIORITY_LOWEST);
CKey key;
key.MakeNewKey();
CBigNum bnExtraNonce = 0;
while (fGenerateBitcoins)
{
- SetThreadPriority(THREAD_PRIORITY_LOWEST);
Sleep(50);
if (fShutdown)
return;
@@ -2610,6 +2610,9 @@ void BitcoinMiner()
CTransaction& tx = (*mi).second;
if (tx.IsCoinBase() || !tx.IsFinal())
continue;
+ unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK);
+ if (nBlockSize + nTxSize >= MAX_BLOCK_SIZE - 10000)
+ continue;
// Transaction fee based on block size
int64 nMinFee = tx.GetMinFee(nBlockSize);
@@ -2620,7 +2623,7 @@ void BitcoinMiner()
swap(mapTestPool, mapTestPoolTmp);
pblock->vtx.push_back(tx);
- nBlockSize += ::GetSerializeSize(tx, SER_NETWORK);
+ nBlockSize += nTxSize;
vfAlreadyAdded[n] = true;
fFoundSomething = true;
}