Revert "Add debug prints"

This reverts commit 88169fac22.
This commit is contained in:
jl777
2018-04-15 23:31:05 +03:00
parent dbd87e657c
commit 828ceb3293
2 changed files with 10 additions and 12 deletions

View File

@@ -2234,6 +2234,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
const CChainParams& chainparams = Params(); const CChainParams& chainparams = Params();
//fprintf(stderr,"connectblock ht.%d\n",(int32_t)pindex->nHeight); //fprintf(stderr,"connectblock ht.%d\n",(int32_t)pindex->nHeight);
AssertLockHeld(cs_main); AssertLockHeld(cs_main);
/*<<<<<<< HEA
// Check it again in case a previous version let a bad block in
bool fExpensiveChecks = (!fCheckpointsEnabled || pindex->nHeight >= Checkpoints::GetTotalBlocksEstimate(chainparams.Checkpoints()));
=======
*/
bool fExpensiveChecks = true; bool fExpensiveChecks = true;
if (fCheckpointsEnabled) { if (fCheckpointsEnabled) {
CBlockIndex *pindexLastCheckpoint = Checkpoints::GetLastCheckpoint(chainparams.Checkpoints()); CBlockIndex *pindexLastCheckpoint = Checkpoints::GetLastCheckpoint(chainparams.Checkpoints());
@@ -3327,7 +3332,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
CBlockIndex *heightblock = chainActive[nHeight]; CBlockIndex *heightblock = chainActive[nHeight];
if ( heightblock != 0 && heightblock->GetBlockHash() == hash ) if ( heightblock != 0 && heightblock->GetBlockHash() == hash )
{ {
fprintf(stderr,"got a pre notarization block that matches height.%d\n",(int32_t)nHeight); //fprintf(stderr,"got a pre notarization block that matches height.%d\n",(int32_t)nHeight);
return true; return true;
} return state.DoS(100, error("%s: rejected by checkpoint lock-in at %d", __func__, nHeight),REJECT_CHECKPOINT, "checkpoint mismatch"); } return state.DoS(100, error("%s: rejected by checkpoint lock-in at %d", __func__, nHeight),REJECT_CHECKPOINT, "checkpoint mismatch");
} }
@@ -3341,7 +3346,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
CBlockIndex *heightblock = chainActive[nHeight]; CBlockIndex *heightblock = chainActive[nHeight];
if ( heightblock != 0 && heightblock->GetBlockHash() == hash ) if ( heightblock != 0 && heightblock->GetBlockHash() == hash )
{ {
fprintf(stderr,"got a pre notarization block that matches height.%d\n",(int32_t)nHeight); //fprintf(stderr,"got a pre notarization block that matches height.%d\n",(int32_t)nHeight);
return true; return true;
} else return state.DoS(100, error("%s: forked chain %d older than last notarized (height %d) vs %d", __func__,nHeight, notarized_height)); } else return state.DoS(100, error("%s: forked chain %d older than last notarized (height %d) vs %d", __func__,nHeight, notarized_height));
} }
@@ -3431,7 +3436,7 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
if (!ContextualCheckBlockHeader(block, state, pindexPrev)) if (!ContextualCheckBlockHeader(block, state, pindexPrev))
{ {
pindex->nStatus |= BLOCK_FAILED_MASK; pindex->nStatus |= BLOCK_FAILED_MASK;
fprintf(stderr,"known block.%d failing ContextualCheckBlockHeader\n",(int32_t)pindex->nHeight); //fprintf(stderr,"known block.%d failing ContextualCheckBlockHeader\n",(int32_t)pindex->nHeight);
return false; return false;
} }
} }
@@ -3439,10 +3444,7 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
} }
if (!CheckBlockHeader(*ppindex!=0?(*ppindex)->nHeight:0,*ppindex, block, state)) if (!CheckBlockHeader(*ppindex!=0?(*ppindex)->nHeight:0,*ppindex, block, state))
{
fprintf(stderr,"AcceptBlock CheckBlockHeader failed\n");
return false; return false;
}
// Get prev block index // Get prev block index
CBlockIndex* pindexPrev = NULL; CBlockIndex* pindexPrev = NULL;
@@ -3455,10 +3457,7 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
return state.DoS(100, error("%s: prev block invalid", __func__), REJECT_INVALID, "bad-prevblk"); return state.DoS(100, error("%s: prev block invalid", __func__), REJECT_INVALID, "bad-prevblk");
} }
if (!ContextualCheckBlockHeader(block, state, pindexPrev)) if (!ContextualCheckBlockHeader(block, state, pindexPrev))
{
fprintf(stderr,"AcceptBlock ContextualCheckBlockHeader failed\n");
return false; return false;
}
if (pindex == NULL) if (pindex == NULL)
pindex = AddToBlockIndex(block); pindex = AddToBlockIndex(block);
if (ppindex) if (ppindex)

View File

@@ -396,7 +396,6 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
// Add fees // Add fees
txNew.vout[0].nValue += nFees; txNew.vout[0].nValue += nFees;
txNew.vin[0].scriptSig = CScript() << nHeight << OP_0; txNew.vin[0].scriptSig = CScript() << nHeight << OP_0;
#ifdef nomore
if ( ASSETCHAINS_SYMBOL[0] == 0 ) if ( ASSETCHAINS_SYMBOL[0] == 0 )
{ {
/*int32_t i,opretlen; uint8_t opret[256],*ptr; /*int32_t i,opretlen; uint8_t opret[256],*ptr;
@@ -420,7 +419,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
if ( txNew.vout.size() > 1 ) if ( txNew.vout.size() > 1 )
fprintf(stderr,"%s txNew numvouts.%d\n",ASSETCHAINS_SYMBOL,(int32_t)txNew.vout.size()); fprintf(stderr,"%s txNew numvouts.%d\n",ASSETCHAINS_SYMBOL,(int32_t)txNew.vout.size());
} }
#endif
pblock->vtx[0] = txNew; pblock->vtx[0] = txNew;
pblocktemplate->vTxFees[0] = -nFees; pblocktemplate->vTxFees[0] = -nFees;
// Randomise nonce // Randomise nonce
@@ -442,7 +441,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false))
{ {
static uint32_t counter; static uint32_t counter;
//if ( counter++ < 100 ) if ( counter++ < 100 )
fprintf(stderr,"warning: testblockvalidity failed\n"); fprintf(stderr,"warning: testblockvalidity failed\n");
return(0); return(0);
} }