Browse Source

fir mining properly. Revert all proclimits to 1 or -1, as they are in zcash. also on shutdown, the pos64 was starting a new thread and then seg faulting, this stops that.

pull/4/head
blackjok3r 6 years ago
parent
commit
a2d19feeba
  1. 4
      src/miner.cpp
  2. 11
      src/rpc/mining.cpp
  3. 4
      src/wallet/asyncrpcoperation_sendmany.cpp
  4. 4
      src/wallet/asyncrpcoperation_shieldcoinbase.cpp
  5. 2
      src/zcbenchmarks.cpp

4
src/miner.cpp

@ -1441,7 +1441,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
@ -1831,7 +1831,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;

11
src/rpc/mining.cpp

@ -339,14 +339,12 @@ UniValue setgenerate(const UniValue& params, bool fHelp)
//if (nGenProcLimit == 0)
// fGenerate = false;
}
if ( ASSETCHAINS_LWMAPOS != 0 )
{
if (fGenerate && !nGenProcLimit)
{
VERUS_MINTBLOCKS = 1;
fGenerate = GetBoolArg("-gen", false);
if ( ASSETCHAINS_STAKED == 0 )
nGenProcLimit = KOMODO_MININGTHREADS;
else
KOMODO_MININGTHREADS = nGenProcLimit;
}
else if (!fGenerate)
@ -355,6 +353,11 @@ UniValue setgenerate(const UniValue& params, bool fHelp)
KOMODO_MININGTHREADS = 0;
}
else KOMODO_MININGTHREADS = (int32_t)nGenProcLimit;
}
else
{
KOMODO_MININGTHREADS = (int32_t)nGenProcLimit;
}
mapArgs["-gen"] = (fGenerate ? "1" : "0");
mapArgs ["-genproclimit"] = itostr(KOMODO_MININGTHREADS);

4
src/wallet/asyncrpcoperation_sendmany.cpp

@ -169,9 +169,9 @@ void AsyncRPCOperation_sendmany::main() {
#ifdef ENABLE_MINING
#ifdef ENABLE_WALLET
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

4
src/wallet/asyncrpcoperation_shieldcoinbase.cpp

@ -141,9 +141,9 @@ void AsyncRPCOperation_shieldcoinbase::main() {
#ifdef ENABLE_MINING
#ifdef ENABLE_WALLET
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

2
src/zcbenchmarks.cpp

@ -63,7 +63,7 @@ void post_wallet_load(){
#ifdef ENABLE_MINING
// Generate coins in the background
if (pwalletMain || !GetArg("-mineraddress", "").empty())
GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 0));
GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 1));
#endif
}

Loading…
Cancel
Save