Merge pull request #1095 from blackjok3rtt/FSM
Fix setgenerate and proclimit.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -1657,11 +1657,9 @@ void komodo_args(char *argv0)
|
||||
std::string name,addn; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[8192],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,baseid,len,n,extralen = 0;
|
||||
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
||||
|
||||
if ( GetBoolArg("-gen", false) != 0 )\
|
||||
if ( GetBoolArg("-gen", false) != 0 )
|
||||
{
|
||||
KOMODO_MININGTHREADS = GetArg("-genproclimit",-1);
|
||||
if (KOMODO_MININGTHREADS == 0)
|
||||
mapArgs["-gen"] = "0";
|
||||
}
|
||||
else KOMODO_MININGTHREADS = 0;
|
||||
|
||||
@@ -1679,6 +1677,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);
|
||||
fprintf(stderr,"running as notary.%d %s\n",i,Notaries_elected1[i][0]);
|
||||
break;
|
||||
}
|
||||
@@ -1781,8 +1781,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)
|
||||
{
|
||||
|
||||
@@ -1831,8 +1831,13 @@ void static BitcoinMiner()
|
||||
}
|
||||
|
||||
//fprintf(stderr,"nThreads.%d fGenerate.%d\n",(int32_t)nThreads,fGenerate);
|
||||
if ( nThreads == 0 && ASSETCHAINS_STAKED )
|
||||
nThreads = 1;
|
||||
if ( ASSETCHAINS_STAKED > 0 && nThreads == 0 )
|
||||
{
|
||||
if ( pwallet != NULL )
|
||||
nThreads = 1;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if ((nThreads == 0 || !fGenerate) && (VERUS_MINTBLOCKS == 0 || pwallet == NULL))
|
||||
return;
|
||||
|
||||
@@ -344,7 +344,10 @@ UniValue setgenerate(const UniValue& params, bool fHelp)
|
||||
{
|
||||
VERUS_MINTBLOCKS = 1;
|
||||
fGenerate = GetBoolArg("-gen", false);
|
||||
nGenProcLimit = KOMODO_MININGTHREADS;
|
||||
if ( ASSETCHAINS_STAKED == 0 )
|
||||
nGenProcLimit = KOMODO_MININGTHREADS;
|
||||
else
|
||||
KOMODO_MININGTHREADS = nGenProcLimit;
|
||||
}
|
||||
else if (!fGenerate)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user