less debug

This commit is contained in:
Duke Leto
2022-07-08 09:42:54 -04:00
parent 8ca330dc68
commit 66e9bd835a
3 changed files with 14 additions and 14 deletions

View File

@@ -1654,7 +1654,9 @@ uint64_t hush_sc_block_subsidy(int nHeight)
if ( subsidy || (curEra != ASSETCHAINS_LASTERA && ASSETCHAINS_REWARD[curEra + 1] != 0) ) if ( subsidy || (curEra != ASSETCHAINS_LASTERA && ASSETCHAINS_REWARD[curEra + 1] != 0) )
{ {
fprintf(stderr,"%s: subsidy=%ld at height=%d with ASSETCHAINS_HALVING[curEra]=%lu\n",__func__,subsidy,nHeight, ASSETCHAINS_HALVING[curEra]); if(fDebug) {
fprintf(stderr,"%s: subsidy=%ld at height=%d with ASSETCHAINS_HALVING[curEra]=%lu\n",__func__,subsidy,nHeight, ASSETCHAINS_HALVING[curEra]);
}
if ( ASSETCHAINS_HALVING[curEra] != 0 ) if ( ASSETCHAINS_HALVING[curEra] != 0 )
{ {
if (ishush3) { if (ishush3) {
@@ -1681,7 +1683,7 @@ uint64_t hush_sc_block_subsidy(int nHeight)
} }
denominator = ASSETCHAINS_ENDSUBSIDY[curEra] - nStart; denominator = ASSETCHAINS_ENDSUBSIDY[curEra] - nStart;
numerator = denominator - ((ASSETCHAINS_ENDSUBSIDY[curEra] - nHeight) + ((nHeight - nStart) % ASSETCHAINS_HALVING[curEra])); numerator = denominator - ((ASSETCHAINS_ENDSUBSIDY[curEra] - nHeight) + ((nHeight - nStart) % ASSETCHAINS_HALVING[curEra]));
fprintf(stderr,"%s: numerator=%ld , denominator=%ld at height=%d\n",__func__,numerator, denominator,nHeight); // fprintf(stderr,"%s: numerator=%ld , denominator=%ld at height=%d\n",__func__,numerator, denominator,nHeight);
if( denominator ) { if( denominator ) {
subsidy = subsidy - sign * ((subsidyDifference * numerator) / denominator); subsidy = subsidy - sign * ((subsidyDifference * numerator) / denominator);
} else { } else {

View File

@@ -2359,7 +2359,7 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW)
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{ {
fprintf(stderr,"%s: nHeight=%d\n", __func__, nHeight); // fprintf(stderr,"%s: nHeight=%d\n", __func__, nHeight);
return hush_sc_block_subsidy(nHeight); return hush_sc_block_subsidy(nHeight);
} }

View File

@@ -411,7 +411,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
Notarizations++; Notarizations++;
if ( Notarizations > 1 ) if ( Notarizations > 1 )
{ {
fprintf(stderr, "skipping notarization.%d\n",Notarizations); fprintf(stderr, "%s: skipping notarization.%d\n",__func__, Notarizations);
// Any attempted notarization needs to be in its own block! // Any attempted notarization needs to be in its own block!
continue; continue;
} }
@@ -604,7 +604,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetTime()); blocktime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetTime());
else blocktime = 1 + std::max((int64_t)(pindexPrev->nTime+1), GetTime()); else blocktime = 1 + std::max((int64_t)(pindexPrev->nTime+1), GetTime());
//pblock->nTime = blocktime + 1; //pblock->nTime = blocktime + 1;
fprintf(stderr,"%s: calling GetNextWorkRequired\n", __func__); // fprintf(stderr,"%s: calling GetNextWorkRequired\n", __func__);
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus()); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
LogPrintf("CreateNewBlock(): total size %u blocktime.%u nBits.%08x\n", nBlockSize,blocktime,pblock->nBits); LogPrintf("CreateNewBlock(): total size %u blocktime.%u nBits.%08x\n", nBlockSize,blocktime,pblock->nBits);
@@ -618,7 +618,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
txNew.vout.resize(1); txNew.vout.resize(1);
txNew.vout[0].scriptPubKey = scriptPubKeyIn; txNew.vout[0].scriptPubKey = scriptPubKeyIn;
txNew.vout[0].nValue = GetBlockSubsidy(nHeight,consensusParams) + nFees; txNew.vout[0].nValue = GetBlockSubsidy(nHeight,consensusParams) + nFees;
fprintf(stderr,"%s: mine ht.%d with %.8f\n",__func__,nHeight,(double)txNew.vout[0].nValue/COIN); // fprintf(stderr,"%s: mine ht.%d with %.8f\n",__func__,nHeight,(double)txNew.vout[0].nValue/COIN);
txNew.nExpiryHeight = 0; txNew.nExpiryHeight = 0;
if ( ASSETCHAINS_ADAPTIVEPOW <= 0 ) if ( ASSETCHAINS_ADAPTIVEPOW <= 0 )
txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetTime()); txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetTime());
@@ -701,7 +701,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
// if not staking, setup nonce, otherwise, leave it alone // if not staking, setup nonce, otherwise, leave it alone
if (!isStake || ASSETCHAINS_LWMAPOS == 0) if (!isStake || ASSETCHAINS_LWMAPOS == 0)
{ {
// Randomise nonce // Randomize nonce
arith_uint256 nonce = UintToArith256(GetRandHash()); arith_uint256 nonce = UintToArith256(GetRandHash());
// Clear the top 16 and bottom 16 or 24 bits (for local use as thread flags and counters) // Clear the top 16 and bottom 16 or 24 bits (for local use as thread flags and counters)
@@ -749,9 +749,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
pblocktemplate->vTxFees[0] = -nFees; pblocktemplate->vTxFees[0] = -nFees;
//*(uint64_t *)(&pblock->vtx[0].vout[0].nValue) += txfees; //*(uint64_t *)(&pblock->vtx[0].vout[0].nValue) += txfees;
//fprintf(stderr,"added notaryvin\n"); //fprintf(stderr,"added notaryvin\n");
} } else {
else
{
fprintf(stderr,"error adding notaryvin, need to create 0.0001 utxos\n"); fprintf(stderr,"error adding notaryvin, need to create 0.0001 utxos\n");
if ( SMART_CHAIN_SYMBOL[0] == 0 || (SMART_CHAIN_SYMBOL[0] != 0 && !isStake) ) if ( SMART_CHAIN_SYMBOL[0] == 0 || (SMART_CHAIN_SYMBOL[0] != 0 && !isStake) )
{ {
@@ -764,7 +762,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (SMART_CHAIN_SYMBOL[0] != 0 || IS_HUSH_NOTARY == 0 || My_notaryid < 0) ) else if ( ASSETCHAINS_CC == 0 && pindexPrev != 0 && ASSETCHAINS_STAKED == 0 && (SMART_CHAIN_SYMBOL[0] != 0 || IS_HUSH_NOTARY == 0 || My_notaryid < 0) )
{ {
CValidationState state; CValidationState state;
fprintf(stderr,"%s: check validity\n", __func__); //fprintf(stderr,"%s: check validity\n", __func__);
if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) // invokes CC checks if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) // invokes CC checks
{ {
if ( SMART_CHAIN_SYMBOL[0] == 0 || (SMART_CHAIN_SYMBOL[0] != 0 && !isStake) ) if ( SMART_CHAIN_SYMBOL[0] == 0 || (SMART_CHAIN_SYMBOL[0] != 0 && !isStake) )
@@ -819,14 +817,14 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight, int32_t gpucount, bool isStake) CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight, int32_t gpucount, bool isStake)
{ {
CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i,len; CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i,len;
fprintf(stderr,"%s: with nHeight=%d\n", __func__, nHeight); // fprintf(stderr,"%s: with nHeight=%d\n", __func__, nHeight);
if ( nHeight == 1 && ASSETCHAINS_COMMISSION != 0 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()] != 49 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()-1] != 51 ) if ( nHeight == 1 && ASSETCHAINS_COMMISSION != 0 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()] != 49 && ASSETCHAINS_SCRIPTPUB[ASSETCHAINS_SCRIPTPUB.back()-1] != 51 )
{ {
if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 ) if ( ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
{ {
pubkey = ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY); pubkey = ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY);
scriptPubKey = CScript() << ParseHex(HexStr(pubkey)) << OP_CHECKSIG; scriptPubKey = CScript() << ParseHex(HexStr(pubkey)) << OP_CHECKSIG;
fprintf(stderr,"%s: with pubkey=%s\n", __func__, HexStr(pubkey).c_str() ); // fprintf(stderr,"%s: with pubkey=%s\n", __func__, HexStr(pubkey).c_str() );
} else { } else {
len = strlen(ASSETCHAINS_SCRIPTPUB.c_str()); len = strlen(ASSETCHAINS_SCRIPTPUB.c_str());
len >>= 1; len >>= 1;
@@ -863,7 +861,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
} }
} }
} }
fprintf(stderr,"%s: calling CreateNewBlock\n", __func__); // fprintf(stderr,"%s: calling CreateNewBlock\n", __func__);
return CreateNewBlock(pubkey, scriptPubKey, gpucount, isStake); return CreateNewBlock(pubkey, scriptPubKey, gpucount, isStake);
} }