This commit is contained in:
jl777
2018-04-25 00:20:58 +03:00
parent 223fbb65cb
commit 6b619d6edf

View File

@@ -3977,14 +3977,14 @@ void komodo_currentheight_set(int32_t height);
CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash) CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash)
{ {
CBlockIndex *pindex=0,*previndex=0; CBlockIndex *pindex=0,*previndex=0;
if ( (pindex= mapBlockIndex[hash]) == 0 )
pindex = InsertBlockIndex(hash);
BlockMap::iterator miSelf = mapBlockIndex.find(hash); BlockMap::iterator miSelf = mapBlockIndex.find(hash);
if ( miSelf == mapBlockIndex.end() ) if ( miSelf == mapBlockIndex.end() )
{ {
pindex = InsertBlockIndex(hash); LogPrintf("komodo_ensure unexpected missing hash %s\n",hash.ToString().c_str());
LogPrintf("autocreate pindex %s\n",hash.ToString().c_str()); return(0);
} }
if ( (miSelf= mapBlockIndex.find(hash)) != mapBlockIndex.end() )
{
if ( miSelf->second == 0 ) // create pindex so first Accept block doesnt fail if ( miSelf->second == 0 ) // create pindex so first Accept block doesnt fail
{ {
if ( pindex == 0 ) if ( pindex == 0 )
@@ -3995,7 +3995,7 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash)
LogPrintf("Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second); 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"); } else LogPrintf("komodo_ensure unexpected null pindex\n");
} }
if ( hash != Params().GetConsensus().hashGenesisBlock ) /*if ( hash != Params().GetConsensus().hashGenesisBlock )
{ {
miSelf = mapBlockIndex.find(pblock->hashPrevBlock); miSelf = mapBlockIndex.find(pblock->hashPrevBlock);
if ( miSelf == mapBlockIndex.end() ) if ( miSelf == mapBlockIndex.end() )
@@ -4014,7 +4014,8 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash)
} }
} else LogPrintf("komodo_ensure unexpected null miprev\n"); } else LogPrintf("komodo_ensure unexpected null miprev\n");
} }
} else LogPrintf("komodo_ensure unexpected error creating pindex %s\n",hash.ToString().c_str()); }*/
return(pindex);
} }
bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNode* pfrom, CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp) bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNode* pfrom, CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp)