Test
This commit is contained in:
@@ -3541,6 +3541,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
|
|||||||
// Check for duplicate
|
// Check for duplicate
|
||||||
uint256 hash = block.GetHash();
|
uint256 hash = block.GetHash();
|
||||||
BlockMap::iterator it = mapBlockIndex.find(hash);
|
BlockMap::iterator it = mapBlockIndex.find(hash);
|
||||||
|
BlockMap::iterator miPrev = mapBlockIndex.find(block.hashPrevBlock);
|
||||||
if (it != mapBlockIndex.end())
|
if (it != mapBlockIndex.end())
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_STAKED == 0 || it->second != 0 ) // change behavior to allow komodo_ensure to work
|
if ( ASSETCHAINS_STAKED == 0 || it->second != 0 ) // change behavior to allow komodo_ensure to work
|
||||||
@@ -3549,6 +3550,11 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
|
|||||||
//fprintf(stderr,"addtoblockindex already there %p\n",it->second);
|
//fprintf(stderr,"addtoblockindex already there %p\n",it->second);
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
if ( miPrev != mapBlockIndex.end() && (*miPrev).second == 0 )
|
||||||
|
{
|
||||||
|
fprintf(stderr,"edge case of both block and prevblock in the strange state\n")
|
||||||
|
return(0); // return here to avoid the state of pindex->nHeight not set and pprev NULL
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Construct new block index object
|
// Construct new block index object
|
||||||
CBlockIndex* pindexNew = new CBlockIndex(block);
|
CBlockIndex* pindexNew = new CBlockIndex(block);
|
||||||
@@ -3559,7 +3565,6 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
|
|||||||
pindexNew->nSequenceId = 0;
|
pindexNew->nSequenceId = 0;
|
||||||
BlockMap::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
|
BlockMap::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
|
||||||
pindexNew->phashBlock = &((*mi).first);
|
pindexNew->phashBlock = &((*mi).first);
|
||||||
BlockMap::iterator miPrev = mapBlockIndex.find(block.hashPrevBlock);
|
|
||||||
if (miPrev != mapBlockIndex.end())
|
if (miPrev != mapBlockIndex.end())
|
||||||
{
|
{
|
||||||
if ( (pindexNew->pprev= (*miPrev).second) != 0 )
|
if ( (pindexNew->pprev= (*miPrev).second) != 0 )
|
||||||
|
|||||||
Reference in New Issue
Block a user