diff --git a/src/init.cpp b/src/init.cpp index 013fb1fdf..1fcd87be7 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1874,9 +1874,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) VERUS_MINTBLOCKS = GetBoolArg("-mint", false); if (pwalletMain || !GetArg("-mineraddress", "").empty()) - GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 0)); + GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", -1)); #else - GenerateBitcoins(GetBoolArg("-gen", false), GetArg("-genproclimit", 0)); + GenerateBitcoins(GetBoolArg("-gen", false), GetArg("-genproclimit", -1)); #endif #endif diff --git a/src/komodo_utils.h b/src/komodo_utils.h index c4c26e0c7..41e34bd6a 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1665,8 +1665,9 @@ void komodo_args(char *argv0) MIN_RECV_SATS = GetArg("-mintxvalue",-1); WHITELIST_ADDRESS = GetArg("-whitelistaddress",""); if ( GetBoolArg("-gen", false) != 0 ) - KOMODO_MININGTHREADS = GetArg("-genproclimit",1); - else KOMODO_MININGTHREADS = 0; + { + KOMODO_MININGTHREADS = GetArg("-genproclimit",-1); + } if ( (KOMODO_EXCHANGEWALLET= GetBoolArg("-exchange", false)) != 0 ) fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n"); DONATION_PUBKEY = GetArg("-donation", ""); @@ -1681,6 +1682,8 @@ void komodo_args(char *argv0) if ( strcmp(NOTARY_PUBKEY.c_str(),Notaries_elected1[i][1]) == 0 ) { IS_KOMODO_NOTARY = 1; + KOMODO_MININGTHREADS = 1; + mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS); IS_STAKED_NOTARY = -1; fprintf(stderr,"running as notary.%d %s\n",i,Notaries_elected1[i][0]); break; @@ -1782,8 +1785,9 @@ void komodo_args(char *argv0) // for now, we only support 50% PoS due to other parts of the algorithm needing adjustment for // other values if ( (ASSETCHAINS_LWMAPOS = GetArg("-ac_veruspos",0)) != 0 ) + { ASSETCHAINS_LWMAPOS = 50; - + } ASSETCHAINS_SAPLING = GetArg("-ac_sapling", -1); if (ASSETCHAINS_SAPLING == -1) { diff --git a/src/miner.cpp b/src/miner.cpp index 06d42f63e..bce67d116 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1466,7 +1466,7 @@ void static BitcoinMiner() #ifdef ENABLE_WALLET // notaries always default to staking - CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey, pindexPrev->GetHeight()+1, gpucount, ASSETCHAINS_STAKED != 0 && GetArg("-genproclimit", 0) == 0); + CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey, pindexPrev->GetHeight()+1, gpucount, ASSETCHAINS_STAKED != 0 && GetArg("-genproclimit", -1) == 0); #else CBlockTemplate *ptr = CreateNewBlockWithKey(); #endif @@ -1856,8 +1856,7 @@ void static BitcoinMiner() } //fprintf(stderr,"nThreads.%d fGenerate.%d\n",(int32_t)nThreads,fGenerate); - - if ( ASSETCHAINS_STAKED > 0 && nThreads == 0 ) + if ( ASSETCHAINS_STAKED > 0 && nThreads == 0 && fGenerate ) { if ( pwallet != NULL ) nThreads = 1; diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 52f4afd10..0bd0ff576 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -339,22 +339,25 @@ UniValue setgenerate(const UniValue& params, bool fHelp) //if (nGenProcLimit == 0) // fGenerate = false; } - - if (fGenerate && !nGenProcLimit) + if ( ASSETCHAINS_LWMAPOS != 0 ) { - VERUS_MINTBLOCKS = 1; - fGenerate = GetBoolArg("-gen", false); - if ( ASSETCHAINS_STAKED == 0 ) - nGenProcLimit = KOMODO_MININGTHREADS; - else + if (fGenerate && !nGenProcLimit) + { + VERUS_MINTBLOCKS = 1; + fGenerate = GetBoolArg("-gen", false); KOMODO_MININGTHREADS = nGenProcLimit; + } + else if (!fGenerate) + { + VERUS_MINTBLOCKS = 0; + KOMODO_MININGTHREADS = 0; + } + else KOMODO_MININGTHREADS = (int32_t)nGenProcLimit; } - else if (!fGenerate) + else { - VERUS_MINTBLOCKS = 0; - KOMODO_MININGTHREADS = 0; + KOMODO_MININGTHREADS = (int32_t)nGenProcLimit; } - else KOMODO_MININGTHREADS = (int32_t)nGenProcLimit; mapArgs["-gen"] = (fGenerate ? "1" : "0"); mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS);