Delete dead code and cleaning
This commit is contained in:
64
src/main.cpp
64
src/main.cpp
@@ -5585,59 +5585,6 @@ CBlockIndex *komodo_ensure(CBlock *pblock, uint256 hash)
|
||||
return(pindex);
|
||||
}
|
||||
|
||||
CBlockIndex *oldkomodo_ensure(CBlock *pblock, uint256 hash)
|
||||
{
|
||||
CBlockIndex *pindex=0,*previndex=0;
|
||||
if ( (pindex = komodo_getblockindex(hash)) == 0 )
|
||||
{
|
||||
pindex = new CBlockIndex();
|
||||
if (!pindex)
|
||||
throw runtime_error("komodo_ensure: new CBlockIndex failed");
|
||||
BlockMap::iterator mi = mapBlockIndex.insert(make_pair(hash, pindex)).first;
|
||||
pindex->phashBlock = &((*mi).first);
|
||||
}
|
||||
BlockMap::iterator miSelf = mapBlockIndex.find(hash);
|
||||
if ( miSelf == mapBlockIndex.end() )
|
||||
{
|
||||
LogPrintf("komodo_ensure unexpected missing hash %s\n",hash.ToString().c_str());
|
||||
return(0);
|
||||
}
|
||||
if ( miSelf->second == 0 ) // create pindex so first Accept block doesnt fail
|
||||
{
|
||||
if ( pindex == 0 )
|
||||
{
|
||||
pindex = AddToBlockIndex(*pblock);
|
||||
fprintf(stderr,"ensure call addtoblockindex, got %p\n",pindex);
|
||||
}
|
||||
if ( pindex != 0 )
|
||||
{
|
||||
miSelf->second = pindex;
|
||||
LogPrintf("Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second);
|
||||
} else LogPrintf("komodo_ensure unexpected null pindex\n");
|
||||
}
|
||||
/*if ( hash != Params().GetConsensus().hashGenesisBlock )
|
||||
{
|
||||
miSelf = mapBlockIndex.find(pblock->hashPrevBlock);
|
||||
if ( miSelf == mapBlockIndex.end() )
|
||||
previndex = InsertBlockIndex(pblock->hashPrevBlock);
|
||||
if ( (miSelf= mapBlockIndex.find(pblock->hashPrevBlock)) != mapBlockIndex.end() )
|
||||
{
|
||||
if ( miSelf->second == 0 ) // create pindex so first Accept block doesnt fail
|
||||
{
|
||||
if ( previndex == 0 )
|
||||
previndex = InsertBlockIndex(pblock->hashPrevBlock);
|
||||
if ( previndex != 0 )
|
||||
{
|
||||
miSelf->second = previndex;
|
||||
LogPrintf("autocreate previndex %s\n",pblock->hashPrevBlock.ToString().c_str());
|
||||
} else LogPrintf("komodo_ensure unexpected null previndex\n");
|
||||
}
|
||||
} else LogPrintf("komodo_ensure unexpected null miprev\n");
|
||||
}
|
||||
}*/
|
||||
return(pindex);
|
||||
}
|
||||
|
||||
bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNode* pfrom, CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp)
|
||||
{
|
||||
// Preliminary checks
|
||||
@@ -5673,15 +5620,12 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo
|
||||
}
|
||||
}
|
||||
fRequested |= fForceProcessing;
|
||||
if ( checked != 0 && komodo_checkPOW(0,pblock,height) < 0 ) //from_miner && ASSETCHAINS_STAKED == 0
|
||||
{
|
||||
if ( checked != 0 && komodo_checkPOW(0,pblock,height) < 0 ) {
|
||||
checked = 0;
|
||||
//fprintf(stderr,"passed checkblock but failed checkPOW.%d\n",from_miner && ASSETCHAINS_STAKED == 0);
|
||||
//fprintf(stderr,"passed checkblock but failed checkPOW.%d\n",from_miner);
|
||||
}
|
||||
if (!checked && futureblock == 0)
|
||||
{
|
||||
if ( pfrom != 0 )
|
||||
{
|
||||
if (!checked && futureblock == 0) {
|
||||
if ( pfrom != 0 ) {
|
||||
Misbehaving(pfrom->GetId(), 1);
|
||||
}
|
||||
return error("%s: CheckBlock FAILED", __func__);
|
||||
|
||||
Reference in New Issue
Block a user