From 5642c96c67fb44f79828bc1f9b91b5235277bea9 Mon Sep 17 00:00:00 2001 From: miketout Date: Sun, 6 May 2018 16:09:20 -0700 Subject: [PATCH 1/2] minor miner message change --- src/miner.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index a58b83b1d..0c6493d82 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -725,6 +725,24 @@ extern int32_t KOMODO_LASTMINED; int32_t roundrobin_delay; arith_uint256 HASHTarget,HASHTarget_POW; +// wait for peers to connect +int32_t waitForPeers(CChainParams &chainparams) +{ + if (chainparams.MiningRequiresPeers()) + { + do { + bool fvNodesEmpty; + { + LOCK(cs_vNodes); + fvNodesEmpty = vNodes.empty(); + } + if (!fvNodesEmpty ) + break; + MilliSleep(1000); + } while (true); + } +} + #ifdef ENABLE_WALLET void static BitcoinMiner_noeq(CWallet *pwallet) #else @@ -744,7 +762,6 @@ void static BitcoinMiner_noeq() unsigned int nExtraNonce = 0; std::vector solnPlaceholder = std::vector(); solnPlaceholder.resize(Eh200_9.SolutionWidth); - uint8_t *script; uint64_t total,checktoshis; int32_t i,j; while ( (ASSETCHAIN_INIT == 0 || KOMODO_INITDONE == 0) ) //chainActive.Tip()->nHeight != 235300 && @@ -754,12 +771,14 @@ void static BitcoinMiner_noeq() break; } + // try a nice clean peer connection to start + waitForPeers(chainparams); sleep(5); CBlockIndex* curTip; do { curTip = chainActive.Tip(); printf("Verifying block height %d \n", chainActive.Tip()->nHeight); - sleep(2); + MilliSleep(100 + rand() % 1900); } while (curTip != chainActive.Tip()); SetThreadPriority(THREAD_PRIORITY_LOWEST); @@ -924,7 +943,7 @@ void static BitcoinMiner_noeq() 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; } From b45d65b46c18715bd2ba913c0b6478db91bbcdec Mon Sep 17 00:00:00 2001 From: miketout Date: Sun, 6 May 2018 16:11:57 -0700 Subject: [PATCH 2/2] const build break --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 0c6493d82..7f05d6009 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -726,7 +726,7 @@ int32_t roundrobin_delay; arith_uint256 HASHTarget,HASHTarget_POW; // wait for peers to connect -int32_t waitForPeers(CChainParams &chainparams) +int32_t waitForPeers(const CChainParams &chainparams) { if (chainparams.MiningRequiresPeers()) {