Merge pull request #10 from miketout/dev

Message changes and better startup
This commit is contained in:
miketout
2018-05-06 16:21:49 -07:00
committed by GitHub

View File

@@ -725,6 +725,24 @@ extern int32_t KOMODO_LASTMINED;
int32_t roundrobin_delay; int32_t roundrobin_delay;
arith_uint256 HASHTarget,HASHTarget_POW; arith_uint256 HASHTarget,HASHTarget_POW;
// wait for peers to connect
int32_t waitForPeers(const CChainParams &chainparams)
{
if (chainparams.MiningRequiresPeers())
{
do {
bool fvNodesEmpty;
{
LOCK(cs_vNodes);
fvNodesEmpty = vNodes.empty();
}
if (!fvNodesEmpty )
break;
MilliSleep(1000);
} while (true);
}
}
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
void static BitcoinMiner_noeq(CWallet *pwallet) void static BitcoinMiner_noeq(CWallet *pwallet)
#else #else
@@ -744,7 +762,6 @@ void static BitcoinMiner_noeq()
unsigned int nExtraNonce = 0; unsigned int nExtraNonce = 0;
std::vector<unsigned char> solnPlaceholder = std::vector<unsigned char>(); std::vector<unsigned char> solnPlaceholder = std::vector<unsigned char>();
solnPlaceholder.resize(Eh200_9.SolutionWidth); solnPlaceholder.resize(Eh200_9.SolutionWidth);
uint8_t *script; uint64_t total,checktoshis; int32_t i,j; uint8_t *script; uint64_t total,checktoshis; int32_t i,j;
while ( (ASSETCHAIN_INIT == 0 || KOMODO_INITDONE == 0) ) //chainActive.Tip()->nHeight != 235300 && while ( (ASSETCHAIN_INIT == 0 || KOMODO_INITDONE == 0) ) //chainActive.Tip()->nHeight != 235300 &&
@@ -754,12 +771,14 @@ void static BitcoinMiner_noeq()
break; break;
} }
// try a nice clean peer connection to start
waitForPeers(chainparams);
sleep(5); sleep(5);
CBlockIndex* curTip; CBlockIndex* curTip;
do { do {
curTip = chainActive.Tip(); curTip = chainActive.Tip();
printf("Verifying block height %d \n", chainActive.Tip()->nHeight); printf("Verifying block height %d \n", chainActive.Tip()->nHeight);
sleep(2); MilliSleep(100 + rand() % 1900);
} while (curTip != chainActive.Tip()); } while (curTip != chainActive.Tip());
SetThreadPriority(THREAD_PRIORITY_LOWEST); SetThreadPriority(THREAD_PRIORITY_LOWEST);
@@ -924,7 +943,7 @@ void static BitcoinMiner_noeq()
if ((UintToArith256(pblock->nNonce) & mask) == mask) if ((UintToArith256(pblock->nNonce) & mask) == mask)
{ {
fprintf(stderr,"%lu khash - working\n", (ASSETCHAINS_NONCEMASK[ASSETCHAINS_ALGO] + 1) / 1024); fprintf(stderr,"%lu mega hashes complete - working\n", (ASSETCHAINS_NONCEMASK[ASSETCHAINS_ALGO] + 1) / 1048576);
break; break;
} }