From 94f9918f9d085bfdabbcdf1ce60af1115894d096 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 01:18:10 -1100 Subject: [PATCH 01/11] Default genproclimit to 0 --- src/init.cpp | 6 +++--- src/rpcmining.cpp | 4 ++-- src/wallet/asyncrpcoperation_mergetoaddress.cpp | 4 ++-- src/wallet/asyncrpcoperation_sendmany.cpp | 4 ++-- src/wallet/asyncrpcoperation_shieldcoinbase.cpp | 4 ++-- src/zcbenchmarks.cpp | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 52c919421..1b8018b56 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -499,7 +499,7 @@ std::string HelpMessage(HelpMessageMode mode) #ifdef ENABLE_MINING strUsage += HelpMessageGroup(_("Mining options:")); strUsage += HelpMessageOpt("-gen", strprintf(_("Generate coins (default: %u)"), 0)); - strUsage += HelpMessageOpt("-genproclimit=", strprintf(_("Set the number of threads for coin generation if enabled (-1 = all cores, default: %d)"), 1)); + strUsage += HelpMessageOpt("-genproclimit=", strprintf(_("Set the number of threads for coin generation if enabled (-1 = all cores, default: %d)"), 0)); strUsage += HelpMessageOpt("-equihashsolver=", _("Specify the Equihash solver to be used if enabled (default: \"default\")")); strUsage += HelpMessageOpt("-mineraddress=", _("Send mined coins to a specific single address")); strUsage += HelpMessageOpt("-minetolocalwallet", strprintf( @@ -1766,9 +1766,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) // Generate coins in the background #ifdef ENABLE_WALLET if (pwalletMain || !GetArg("-mineraddress", "").empty()) - GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 1)); + GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 0)); #else - GenerateBitcoins(GetBoolArg("-gen", false), GetArg("-genproclimit", 1)); + GenerateBitcoins(GetBoolArg("-gen", false), GetArg("-genproclimit", 0)); #endif #endif diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 7f66f23f6..afe4e5a33 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -319,8 +319,8 @@ UniValue setgenerate(const UniValue& params, bool fHelp) if (params.size() > 1) { nGenProcLimit = params[1].get_int(); - if (nGenProcLimit == 0) - fGenerate = false; + //if (nGenProcLimit == 0) + // fGenerate = false; } mapArgs["-gen"] = (fGenerate ? "1" : "0"); diff --git a/src/wallet/asyncrpcoperation_mergetoaddress.cpp b/src/wallet/asyncrpcoperation_mergetoaddress.cpp index a85f3315c..fa41c87d4 100644 --- a/src/wallet/asyncrpcoperation_mergetoaddress.cpp +++ b/src/wallet/asyncrpcoperation_mergetoaddress.cpp @@ -152,9 +152,9 @@ void AsyncRPCOperation_mergetoaddress::main() #ifdef ENABLE_MINING #ifdef ENABLE_WALLET - GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 1)); + GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 0)); #else - GenerateBitcoins(GetBoolArg("-gen", false), GetArg("-genproclimit", 1)); + GenerateBitcoins(GetBoolArg("-gen", false), GetArg("-genproclimit", 0)); #endif #endif diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index 6f33b514e..3652f7d0d 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -158,9 +158,9 @@ void AsyncRPCOperation_sendmany::main() { #ifdef ENABLE_MINING #ifdef ENABLE_WALLET - GenerateBitcoins(GetBoolArg("-gen",false), pwalletMain, GetArg("-genproclimit", 1)); + GenerateBitcoins(GetBoolArg("-gen",false), pwalletMain, GetArg("-genproclimit", 0)); #else - GenerateBitcoins(GetBoolArg("-gen",false), GetArg("-genproclimit", 1)); + GenerateBitcoins(GetBoolArg("-gen",false), GetArg("-genproclimit", 0)); #endif #endif diff --git a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp index 1bc82fdbe..f48cf8dcd 100644 --- a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp +++ b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp @@ -137,9 +137,9 @@ void AsyncRPCOperation_shieldcoinbase::main() { #ifdef ENABLE_MINING #ifdef ENABLE_WALLET - GenerateBitcoins(GetBoolArg("-gen",false), pwalletMain, GetArg("-genproclimit", 1)); + GenerateBitcoins(GetBoolArg("-gen",false), pwalletMain, GetArg("-genproclimit", 0)); #else - GenerateBitcoins(GetBoolArg("-gen",false), GetArg("-genproclimit", 1)); + GenerateBitcoins(GetBoolArg("-gen",false), GetArg("-genproclimit", 0)); #endif #endif diff --git a/src/zcbenchmarks.cpp b/src/zcbenchmarks.cpp index 2c7e99a67..b3fbddf88 100644 --- a/src/zcbenchmarks.cpp +++ b/src/zcbenchmarks.cpp @@ -61,7 +61,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", 1)); + GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain, GetArg("-genproclimit", 0)); #endif } From 3a446d9f249c706a0cad398b4d69a8955deaa6bb Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 01:26:23 -1100 Subject: [PATCH 02/11] +print --- src/miner.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 4b7d09252..5903dd825 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1187,7 +1187,9 @@ void static BitcoinMiner() delete minerThreads; minerThreads = NULL; } - + fprintf(stderr,"nThreads.%d fGenerate.%d\n",(int32_t)nThreads,fGenerate); + if ( nThreads == 0 ) + nThreads = 1; if (nThreads == 0 || !fGenerate) return; From 8daf7cafe6b495752d24e7540da7ef6d16c6b0f5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 01:33:40 -1100 Subject: [PATCH 03/11] 100 easy PoW blocks for staked=100 --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 0e8d8ddfd..ca02f2a00 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1165,7 +1165,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he { CBlockIndex *pindex; arith_uint256 bnTarget,hashval,sum,ave; bool fNegative,fOverflow; int32_t i,n,ht,percPoS,diff,val; *percPoSp = percPoS = 0; - if ( height <= 10 ) + if ( height <= 10 || (ASSETCHAINS_STAKED == 100 && height <= 100) ) return(target); sum = arith_uint256(0); ave = sum; From db178ad2baa5d1dacafe28d5461f1db42907e0e0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 01:43:36 -1100 Subject: [PATCH 04/11] -print --- src/komodo_bitcoind.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index ca02f2a00..4ff810723 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1136,12 +1136,12 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh } if ( validateflag != 0 ) { - for (i=31; i>=24; i--) + /*for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]); fprintf(stderr," vs target "); for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]); - fprintf(stderr," segid.%d iter.%d winner.%d coinage.%llu %d ht.%d gap.%d %.8f diff.%d\n",segid,iter,winner,(long long)coinage,(int32_t)(blocktime - txtime),nHeight,(int32_t)(blocktime - prevtime),dstr(value),(int32_t)diff); + fprintf(stderr," segid.%d iter.%d winner.%d coinage.%llu %d ht.%d gap.%d %.8f diff.%d\n",segid,iter,winner,(long long)coinage,(int32_t)(blocktime - txtime),nHeight,(int32_t)(blocktime - prevtime),dstr(value),(int32_t)diff);*/ break; } } From 4f02fc40094f8f894072f6379ca279d3b95be569 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 02:52:29 -1100 Subject: [PATCH 05/11] Getbalance64 --- src/rpcserver.cpp | 1 + src/rpcserver.h | 1 + src/wallet/rpcwallet.cpp | 45 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index bc1ba5b37..1cfab13d0 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -383,6 +383,7 @@ static const CRPCCommand vRPCCommands[] = { "wallet", "getaccount", &getaccount, true }, { "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true }, { "wallet", "getbalance", &getbalance, false }, + { "wallet", "getbalance64", &getbalance64, false }, { "wallet", "getnewaddress", &getnewaddress, true }, { "wallet", "getrawchangeaddress", &getrawchangeaddress, true }, { "wallet", "getreceivedbyaccount", &getreceivedbyaccount, false }, diff --git a/src/rpcserver.h b/src/rpcserver.h index 40cb96288..e6edc3949 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -220,6 +220,7 @@ extern UniValue verifymessage(const UniValue& params, bool fHelp); extern UniValue getreceivedbyaddress(const UniValue& params, bool fHelp); extern UniValue getreceivedbyaccount(const UniValue& params, bool fHelp); extern UniValue getbalance(const UniValue& params, bool fHelp); +extern UniValue getbalance64(const UniValue& params, bool fHelp); extern UniValue getunconfirmedbalance(const UniValue& params, bool fHelp); extern UniValue movecmd(const UniValue& params, bool fHelp); extern UniValue sendfrom(const UniValue& params, bool fHelp); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 255f74a19..a25b5f4bb 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4673,3 +4673,48 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt } else fprintf(stderr,"no earliest utxo for staking\n"); return(siglen); } + +UniValue getbalance64(const UniValue& params, bool fHelp) +{ + set setAddress; vector vecOutputs; + UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR),b(UniValue::VARR); + const CKeyStore& keystore = *pwalletMain; + CAmount nValues[64],nValues2[64],nValue,total,total2; int32_t i,segid; + assert(pwalletMain != NULL); + if (fHelp || params.size() > 0) + throw runtime_error("getbalance64\n"); + total = total2 = 0; + memset(nValues,0,sizeof(nValues)); + memset(nValues2,0,sizeof(nValues2)); + LOCK2(cs_main, pwalletMain->cs_wallet); + pwalletMain->AvailableCoins(vecOutputs, false, NULL, true); + BOOST_FOREACH(const COutput& out, vecOutputs) + { + nValue = out.tx->vout[out.i].nValue; + if ( setAddress.size() ) + { + CTxDestination address; + if (!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) + continue; + if (!setAddress.count(address)) + continue; + segid = komodo_segid((char *)CBitcoinAddress(address).ToString().c_str()); + if ( out.nDepth < 100 ) + nValues2[segid] += nValue, total2 += nValue; + else nValues[segid] += nValue, total += nValue; + } + } + ret.push_back(Pair("staking",(double)total/COIN)); + ret.push_back(Pair("immature",(double)total2/COIN)); + for (i=0; i<64; i++) + { + UniValue item(UniValue::VOBJ); + item.push_back(double)nValues[i] / COIN); + a.push_back(item); + item.push_back(double)nValues2[i] / COIN); + b.push_back(item); + } + ret.push_back(Pair("staking", a)); + ret.push_back(Pair("immature", b)); + return ret; +} From 890e708b8749dec60df38a7050f0cfbfbfb18040 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 03:10:41 -1100 Subject: [PATCH 06/11] Test --- src/wallet/rpcwallet.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a25b5f4bb..a16fc77e4 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -44,6 +44,7 @@ using namespace libzcash; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern UniValue TxJoinSplitToJSON(const CTransaction& tx); +uint32_t komodo_segid32(char *coinaddr); int64_t nWalletUnlockTime; static CCriticalSection cs_nWalletUnlockTime; @@ -4709,9 +4710,9 @@ UniValue getbalance64(const UniValue& params, bool fHelp) for (i=0; i<64; i++) { UniValue item(UniValue::VOBJ); - item.push_back(double)nValues[i] / COIN); + item.push_back((double)nValues[i] / COIN); a.push_back(item); - item.push_back(double)nValues2[i] / COIN); + item.push_back((double)nValues2[i] / COIN); b.push_back(item); } ret.push_back(Pair("staking", a)); From ca76a7dfcd7ed4a145e9f7129986e05ad4378ba5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 03:13:18 -1100 Subject: [PATCH 07/11] Test --- src/wallet/rpcwallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a16fc77e4..deb49e94a 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4699,7 +4699,7 @@ UniValue getbalance64(const UniValue& params, bool fHelp) continue; if (!setAddress.count(address)) continue; - segid = komodo_segid((char *)CBitcoinAddress(address).ToString().c_str()); + segid = (komodo_segid32((char *)CBitcoinAddress(address).ToString().c_str()) & 0x3f); if ( out.nDepth < 100 ) nValues2[segid] += nValue, total2 += nValue; else nValues[segid] += nValue, total += nValue; @@ -4710,9 +4710,9 @@ UniValue getbalance64(const UniValue& params, bool fHelp) for (i=0; i<64; i++) { UniValue item(UniValue::VOBJ); - item.push_back((double)nValues[i] / COIN); + item.push_back((uint64_t)nValues[i]); a.push_back(item); - item.push_back((double)nValues2[i] / COIN); + item.push_back((uint64_t)nValues2[i]); b.push_back(item); } ret.push_back(Pair("staking", a)); From 5e0b330de9dd0de4be072e0520481b3f831ec9e6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 03:19:39 -1100 Subject: [PATCH 08/11] Test --- src/wallet/rpcwallet.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index deb49e94a..7c76eb691 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4678,7 +4678,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt UniValue getbalance64(const UniValue& params, bool fHelp) { set setAddress; vector vecOutputs; - UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR),b(UniValue::VARR); + UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR),b(UniValue::VARR); CTxDestination address; const CKeyStore& keystore = *pwalletMain; CAmount nValues[64],nValues2[64],nValue,total,total2; int32_t i,segid; assert(pwalletMain != NULL); @@ -4692,30 +4692,23 @@ UniValue getbalance64(const UniValue& params, bool fHelp) BOOST_FOREACH(const COutput& out, vecOutputs) { nValue = out.tx->vout[out.i].nValue; - if ( setAddress.size() ) + if ( ExtractDestination(out.tx->vout[out.i].scriptPubKey, address) ) { - CTxDestination address; - if (!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) - continue; - if (!setAddress.count(address)) - continue; segid = (komodo_segid32((char *)CBitcoinAddress(address).ToString().c_str()) & 0x3f); if ( out.nDepth < 100 ) nValues2[segid] += nValue, total2 += nValue; else nValues[segid] += nValue, total += nValue; - } + fprintf(stderr,"%s %.8f depth.%d segid.%d\n",(char *)CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,(int32_t)out.nDepth,segid); + } else fprintf(stderr,"no destination\n"); } - ret.push_back(Pair("staking",(double)total/COIN)); + ret.push_back(Pair("mature",(double)total/COIN)); ret.push_back(Pair("immature",(double)total2/COIN)); for (i=0; i<64; i++) { - UniValue item(UniValue::VOBJ); - item.push_back((uint64_t)nValues[i]); - a.push_back(item); - item.push_back((uint64_t)nValues2[i]); - b.push_back(item); + a.push_back((uint64_t)nValues[i]); + b.push_back((uint64_t)nValues2[i]); } ret.push_back(Pair("staking", a)); - ret.push_back(Pair("immature", b)); + ret.push_back(Pair("notstaking", b)); return ret; } From d979952f3a0a73c706d7453d8cdce6017f809a5c Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 03:25:42 -1100 Subject: [PATCH 09/11] -print --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 7c76eb691..22fe7fba1 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4698,7 +4698,7 @@ UniValue getbalance64(const UniValue& params, bool fHelp) if ( out.nDepth < 100 ) nValues2[segid] += nValue, total2 += nValue; else nValues[segid] += nValue, total += nValue; - fprintf(stderr,"%s %.8f depth.%d segid.%d\n",(char *)CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,(int32_t)out.nDepth,segid); + //fprintf(stderr,"%s %.8f depth.%d segid.%d\n",(char *)CBitcoinAddress(address).ToString().c_str(),(double)nValue/COIN,(int32_t)out.nDepth,segid); } else fprintf(stderr,"no destination\n"); } ret.push_back(Pair("mature",(double)total/COIN)); From 2732d384f4b64a414da008aede956c506c8009d1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 03:37:42 -1100 Subject: [PATCH 10/11] Stub getnewaddress64 --- src/rpcserver.cpp | 1 + src/rpcserver.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 1cfab13d0..ed5110114 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -385,6 +385,7 @@ static const CRPCCommand vRPCCommands[] = { "wallet", "getbalance", &getbalance, false }, { "wallet", "getbalance64", &getbalance64, false }, { "wallet", "getnewaddress", &getnewaddress, true }, +// { "wallet", "getnewaddress64", &getnewaddress64, true }, { "wallet", "getrawchangeaddress", &getrawchangeaddress, true }, { "wallet", "getreceivedbyaccount", &getreceivedbyaccount, false }, { "wallet", "getreceivedbyaddress", &getreceivedbyaddress, false }, diff --git a/src/rpcserver.h b/src/rpcserver.h index e6edc3949..5bb949299 100644 --- a/src/rpcserver.h +++ b/src/rpcserver.h @@ -209,6 +209,7 @@ extern UniValue estimatefee(const UniValue& params, bool fHelp); extern UniValue estimatepriority(const UniValue& params, bool fHelp); extern UniValue getnewaddress(const UniValue& params, bool fHelp); // in rpcwallet.cpp +//extern UniValue getnewaddress64(const UniValue& params, bool fHelp); // in rpcwallet.cpp extern UniValue getaccountaddress(const UniValue& params, bool fHelp); extern UniValue getrawchangeaddress(const UniValue& params, bool fHelp); extern UniValue setaccount(const UniValue& params, bool fHelp); From f2c1ac067116dfe6b16413e50a7d72a9afb10117 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 30 Jun 2018 03:40:02 -1100 Subject: [PATCH 11/11] -print --- src/komodo_bitcoind.h | 13 ++++++++----- src/miner.cpp | 9 ++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 4ff810723..5cd88d7de 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1181,22 +1181,25 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he hashval = UintToArith256(pindex->GetBlockHash()); if ( hashval <= bnTarget ) // PoW is never as easy as PoS/16, some PoS will be counted as PoW { - fprintf(stderr,"1"); + if ( ASSETCHAINS_STAKED < 100 ) + fprintf(stderr,"1"); sum += hashval; n++; } else { percPoS++; - fprintf(stderr,"0"); + if ( ASSETCHAINS_STAKED < 100 ) + fprintf(stderr,"0"); } - if ( (i % 10) == 9 ) + if ( ASSETCHAINS_STAKED < 100 && (i % 10) == 9 ) fprintf(stderr," %d, ",percPoS); } } if ( n < 100 ) percPoS = ((percPoS * n) + (goalperc * (100-n))) / 100; - fprintf(stderr," -> %d%% percPoS vs goalperc.%d ht.%d\n",percPoS,goalperc,height); + if ( ASSETCHAINS_STAKED < 100 ) + fprintf(stderr," -> %d%% percPoS vs goalperc.%d ht.%d\n",percPoS,goalperc,height); *percPoSp = percPoS; target = (target / arith_uint256(KOMODO_POWMINMULT)); if ( n > 0 ) @@ -1208,7 +1211,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he if ( percPoS < goalperc ) // increase PoW diff -> lower bnTarget { bnTarget = (ave * arith_uint256(percPoS * percPoS)) / arith_uint256(goalperc * goalperc * goalperc); - if ( 1 ) + if ( ASSETCHAINS_STAKED < 100 ) { for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&ave)[i]); diff --git a/src/miner.cpp b/src/miner.cpp index 5903dd825..5ed1c5af7 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -920,9 +920,12 @@ void static BitcoinMiner() continue; }*/ HASHTarget_POW = komodo_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED); - for (z=31; z>=0; z--) - fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]); - fprintf(stderr," PoW for staked coin PoS %d%% vs target %d%%\n",percPoS,(int32_t)ASSETCHAINS_STAKED); + if ( ASSETCHAINS_STAKED < 100 ) + { + for (z=31; z>=0; z--) + fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]); + fprintf(stderr," PoW for staked coin PoS %d%% vs target %d%%\n",percPoS,(int32_t)ASSETCHAINS_STAKED); + } } while (true) {