diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index b1870b7c1..2ee07b6cd 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1298,13 +1298,14 @@ uint64_t hush_commission(int height) fprintf(stderr,"%s: HUSH block reward has gone to zero at height %d!!! It was a good run folks\n", __func__, height); commission = 0; } - fprintf(stderr,"%s: commission=%lu,interval=%d at height %d\n", __func__, commission, INTERVAL, height); + if(fDebug) + fprintf(stderr,"%s: commission=%lu,interval=%d at height %d\n", __func__, commission, INTERVAL, height); return commission; } uint64_t komodo_commission(const CBlock *pblock,int32_t height) { - fprintf(stderr,"%s at height=%d\n",__func__,height); + //fprintf(stderr,"%s at height=%d\n",__func__,height); static bool didinit = false, ishush3 = false; if (!didinit) { @@ -1317,7 +1318,8 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) if ( ASSETCHAINS_FOUNDERS != 0 ) { nSubsidy = GetBlockSubsidy(height,Params().GetConsensus()); - fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION)); + if(fDebug) + fprintf(stderr,"ht.%d nSubsidy %.8f prod %llu\n",height,(double)nSubsidy/COIN,(long long)(nSubsidy * ASSETCHAINS_COMMISSION)); commission = ((nSubsidy * ASSETCHAINS_COMMISSION) / COIN); if (ishush3) { @@ -1333,7 +1335,8 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) } else { commission = ASSETCHAINS_FOUNDERS_REWARD; } - fprintf(stderr,"%s: set commission=%lu at height %d with\n",__func__,commission, height); + if(fDebug) + fprintf(stderr,"%s: set commission=%lu at height %d with\n",__func__,commission, height); } else { commission = 0; } @@ -1362,7 +1365,8 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) } if ( commission < 10000 ) commission = 0; - fprintf(stderr,"%s: commission=%.8f at height=%d\n",__func__, (double)commission/COIN, height); + if(fDebug) + fprintf(stderr,"%s: commission=%.8f at height=%d\n",__func__, (double)commission/COIN, height); return(commission); } @@ -2010,21 +2014,22 @@ void GetKomodoEarlytxidScriptPub() int64_t komodo_checkcommission(CBlock *pblock,int32_t height) { - fprintf(stderr,"%s at height=%d\n",__func__,height); + if(fDebug) + fprintf(stderr,"%s at height=%d\n",__func__,height); int64_t checktoshis=0; uint8_t *script,scripthex[8192]; int32_t scriptlen,matched = 0; static bool didinit = false; if ( ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_FOUNDERS_REWARD != 0 ) { checktoshis = komodo_commission(pblock,height); if ( checktoshis >= 10000 && pblock->vtx[0].vout.size() < 2 ) { - fprintf(stderr,"komodo_checkcommission vsize.%d height.%d commission %.8f\n",(int32_t)pblock->vtx[0].vout.size(),height,(double)checktoshis/COIN); + fprintf(stderr,"ERROR: komodo_checkcommission vsize.%d height.%d commission %.8f has checktoshis <10000 or not enough vouts\n",(int32_t)pblock->vtx[0].vout.size(),height,(double)checktoshis/COIN); return(-1); } else if ( checktoshis != 0 ) { script = (uint8_t *)&pblock->vtx[0].vout[1].scriptPubKey[0]; scriptlen = (int32_t)pblock->vtx[0].vout[1].scriptPubKey.size(); - if ( 1 ) + if ( fDebug ) { int32_t i; for (i=0; ivtx[0].vout[1].nValue != checktoshis ) { - fprintf(stderr,"ht.%d checktoshis %.8f vs actual vout[1] %.8f\n",height,dstr(checktoshis),dstr(pblock->vtx[0].vout[1].nValue)); + fprintf(stderr,"ERROR: ht.%d checktoshis %.8f vs actual vout[1] %.8f !!!\n",height,dstr(checktoshis),dstr(pblock->vtx[0].vout[1].nValue)); return(-1); } } } + if(fDebug) + fprintf(stderr,"%s checktoshis=%li at height=%d\n",__func__,checktoshis, height); return(checktoshis); } diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 4f4f45229..e1449c170 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1563,7 +1563,7 @@ uint64_t hush_block_subsidy(int nHeight) // wrapper for more general supply curves of Hush Smart Chains uint64_t komodo_ac_block_subsidy(int nHeight) { - fprintf(stderr,"%s: ht.%d\n", __func__, nHeight); + //fprintf(stderr,"%s: ht.%d\n", __func__, nHeight); // Find current era, start from beginning reward, and determine current subsidy int64_t numerator, denominator, subsidy = 0; int64_t subsidyDifference; @@ -1590,7 +1590,8 @@ uint64_t komodo_ac_block_subsidy(int nHeight) { int64_t nStart = curEra ? ASSETCHAINS_ENDSUBSIDY[curEra - 1] : 0; subsidy = (int64_t)ASSETCHAINS_REWARD[curEra]; - fprintf(stderr,"%s: nStart.%ld subsidy.%ld curEra.%d\n",__func__,nStart,subsidy,curEra); + if(fDebug) + fprintf(stderr,"%s: nStart.%ld subsidy.%ld curEra.%d\n",__func__,nStart,subsidy,curEra); if ( subsidy || (curEra != ASSETCHAINS_LASTERA && ASSETCHAINS_REWARD[curEra + 1] != 0) ) { @@ -1598,7 +1599,8 @@ uint64_t komodo_ac_block_subsidy(int nHeight) { if (ishush3) { subsidy = hush_block_subsidy(nHeight); - fprintf(stderr,"%s: HUSH3 subsidy=%ld at height=%d\n",__func__,subsidy,nHeight); + if(fDebug) + fprintf(stderr,"%s: HUSH3 subsidy=%ld at height=%d\n",__func__,subsidy,nHeight); } else if ( (numhalvings = ((nHeight - nStart) / ASSETCHAINS_HALVING[curEra])) > 0 ) { // The code below is not compatible with HUSH3 mainnet if ( ASSETCHAINS_DECAY[curEra] == 0 ) { @@ -1654,7 +1656,8 @@ uint64_t komodo_ac_block_subsidy(int nHeight) else subsidy += ASSETCHAINS_SUPPLY * SATOSHIDEN + magicExtra; } - fprintf(stderr,"%s: ht.%d curEra.%d lastEra.%lu subsidy.%ld magicExtra.%u\n",__func__,nHeight,curEra,ASSETCHAINS_LASTERA,subsidy,magicExtra); + if(fDebug) + fprintf(stderr,"%s: ht.%d curEra.%d lastEra.%lu subsidy.%ld magicExtra.%u\n",__func__,nHeight,curEra,ASSETCHAINS_LASTERA,subsidy,magicExtra); return(subsidy); } @@ -1822,7 +1825,8 @@ void komodo_args(char *argv0) printf("ASSETCHAINS_LASTERA, if specified, must be between 1 and %u. ASSETCHAINS_LASTERA set to %lu\n", ASSETCHAINS_MAX_ERAS, ASSETCHAINS_LASTERA); } ASSETCHAINS_LASTERA -= 1; - fprintf(stderr,"%s: lastEra=%lu maxEras=%d\n", __func__, ASSETCHAINS_LASTERA, ASSETCHAINS_MAX_ERAS); + if(fDebug) + fprintf(stderr,"%s: lastEra=%lu maxEras=%d\n", __func__, ASSETCHAINS_LASTERA, ASSETCHAINS_MAX_ERAS); ASSETCHAINS_TIMELOCKGTE = (uint64_t)GetArg("-ac_timelockgte", _ASSETCHAINS_TIMELOCKOFF); ASSETCHAINS_TIMEUNLOCKFROM = GetArg("-ac_timeunlockfrom", 0); @@ -1841,7 +1845,7 @@ void komodo_args(char *argv0) bool ishush3 = strncmp(ASSETCHAINS_SYMBOL, "HUSH3",5) == 0 ? true : false; if(ishush3) { - fprintf(stderr,"Setting custom HUSH3 chain values...\n"); + fprintf(stderr,"%s: Setting custom HUSH3 reward,halving,subsidy chain values...\n",__func__); // Over-ride HUSH3 values from CLI params. Changing our blocktime to 75s changes things ASSETCHAINS_REWARD[0] = 0; ASSETCHAINS_REWARD[1] = 1125000000; diff --git a/src/main.cpp b/src/main.cpp index 2b332593c..1e13c8ff1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1750,7 +1750,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa // and edge cases. This empty mempool assures there will be no transactions involving taddrs // stuck in the mempool, when the z2z rule takes effect. // Thanks to jl777 for helping design this - fprintf(stderr,"%s: rejecting all tx's during z2z transition window at height=%d\n", __func__,nHeight); + fprintf(stderr,"%s: rejecting all tx's during z2z transition window. Please retry after Block %d !!!\n", __func__,nHeight); return false; } }