Merge pull request #4169
0655fac
miner: indentation fixes, remove for (;;) (Philip Kaufmann)
This commit is contained in:
commit
5dd0bfefcb
1 changed files with 105 additions and 102 deletions
|
@ -49,7 +49,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
uint64_t nLastBlockTx = 0;
|
||||
uint64_t nLastBlockSize = 0;
|
||||
|
||||
|
@ -58,8 +57,10 @@ typedef boost::tuple<double, CFeeRate, const CTransaction*> TxPriority;
|
|||
class TxPriorityCompare
|
||||
{
|
||||
bool byFee;
|
||||
|
||||
public:
|
||||
TxPriorityCompare(bool _byFee) : byFee(_byFee) { }
|
||||
|
||||
bool operator()(const TxPriority& a, const TxPriority& b)
|
||||
{
|
||||
if (byFee)
|
||||
|
@ -114,6 +115,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||
|
||||
// Collect memory pool transactions into the block
|
||||
int64_t nFees = 0;
|
||||
|
||||
{
|
||||
LOCK2(cs_main, mempool.cs);
|
||||
CBlockIndex* pindexPrev = chainActive.Tip();
|
||||
|
@ -338,7 +340,6 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
|
|||
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -353,7 +354,8 @@ int64_t nHPSTimerStart = 0;
|
|||
// nonce is 0xffff0000 or above, the block is rebuilt and nNonce starts over at
|
||||
// zero.
|
||||
//
|
||||
bool static ScanHash(const CBlockHeader *pblock, uint32_t& nNonce, uint256 *phash) {
|
||||
bool static ScanHash(const CBlockHeader *pblock, uint32_t& nNonce, uint256 *phash)
|
||||
{
|
||||
// Write the first 76 bytes of the block header to a double-SHA256 state.
|
||||
CHash256 hasher;
|
||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||
|
@ -361,7 +363,7 @@ bool static ScanHash(const CBlockHeader *pblock, uint32_t& nNonce, uint256 *phas
|
|||
assert(ss.size() == 80);
|
||||
hasher.Write((unsigned char*)&ss[0], 76);
|
||||
|
||||
for (;;) {
|
||||
while (true) {
|
||||
nNonce++;
|
||||
|
||||
// Write the last 4 bytes of the block header (the nonce) to a copy of
|
||||
|
@ -439,7 +441,8 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||
CReserveKey reservekey(pwallet);
|
||||
unsigned int nExtraNonce = 0;
|
||||
|
||||
try { while (true) {
|
||||
try {
|
||||
while (true) {
|
||||
if (Params().MiningRequiresPeers()) {
|
||||
// Busy-wait for the network to come online so we don't waste time mining
|
||||
// on an obsolete chain. In regtest mode we expect to fly solo.
|
||||
|
@ -470,8 +473,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||
uint256 hash;
|
||||
uint32_t nNonce = 0;
|
||||
uint32_t nOldNonce = 0;
|
||||
while (true)
|
||||
{
|
||||
while (true) {
|
||||
bool fFound = ScanHash(pblock, nNonce, &hash);
|
||||
uint32_t nHashesDone = nNonce - nOldNonce;
|
||||
nOldNonce = nNonce;
|
||||
|
@ -546,7 +548,8 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||
hashTarget.SetCompact(pblock->nBits);
|
||||
}
|
||||
}
|
||||
} }
|
||||
}
|
||||
}
|
||||
catch (boost::thread_interrupted)
|
||||
{
|
||||
LogPrintf("BitcoinMiner terminated\n");
|
||||
|
@ -581,4 +584,4 @@ void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads)
|
|||
minerThreads->create_thread(boost::bind(&BitcoinMiner, pwallet));
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // ENABLE_WALLET
|
||||
|
|
Loading…
Add table
Reference in a new issue