Test
This commit is contained in:
@@ -725,23 +725,26 @@ uint32_t komodo_heightstamp(int32_t height)
|
||||
void komodo_pindex_init(CBlockIndex *pindex,int32_t height)
|
||||
{
|
||||
int32_t i,num; uint8_t pubkeys[64][33]; CBlock block;
|
||||
printf("pindex.%d komodo_pindex_init notary.%d from height.%d\n",pindex->nHeight,pindex->notaryid,height);
|
||||
if ( pindex->notaryid >= 0 )
|
||||
return;
|
||||
pindex->notaryid = -1;
|
||||
memset(pindex->pubkey33,0,33);
|
||||
if ( komodo_blockload(block,pindex) == 0 )
|
||||
if ( pindex->pubkey33[0] != 2 && pindex->pubkey33[0] != 3 )
|
||||
{
|
||||
komodo_block2pubkey33(pindex->pubkey33,block);
|
||||
if ( (pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3) && pindex->nHeight >= 0 && (num= komodo_notaries(pubkeys,(int32_t)pindex->nHeight,(uint32_t)pindex->nTime)) > 0 )
|
||||
memset(pindex->pubkey33,0,33);
|
||||
if ( komodo_blockload(block,pindex) == 0 )
|
||||
komodo_block2pubkey33(pindex->pubkey33,block);
|
||||
}
|
||||
if ( (pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3) && pindex->nHeight >= 0 && (num= komodo_notaries(pubkeys,(int32_t)pindex->nHeight,(uint32_t)pindex->nTime)) > 0 )
|
||||
{
|
||||
for (i=0; i<num; i++)
|
||||
{
|
||||
for (i=0; i<num; i++)
|
||||
if ( memcmp(pubkeys[i],pindex->pubkey33,33) == 0 )
|
||||
{
|
||||
if ( memcmp(pubkeys[i],pindex->pubkey33,33) == 0 )
|
||||
{
|
||||
pindex->notaryid = i;
|
||||
break;
|
||||
}
|
||||
pindex->notaryid = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("pindex.%d initialized notary.%d from height.%d\n",pindex->nHeight,pindex->notaryid,height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4157,6 +4157,7 @@ bool static LoadBlockIndexDB()
|
||||
pindex->BuildSkip();
|
||||
if (pindex->IsValid(BLOCK_VALID_TREE) && (pindexBestHeader == NULL || CBlockIndexWorkComparator()(pindexBestHeader, pindex)))
|
||||
pindexBestHeader = pindex;
|
||||
komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
|
||||
}
|
||||
|
||||
// Load block file info
|
||||
@@ -4185,6 +4186,7 @@ bool static LoadBlockIndexDB()
|
||||
if (pindex->nStatus & BLOCK_HAVE_DATA) {
|
||||
setBlkDataFiles.insert(pindex->nFile);
|
||||
}
|
||||
komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
|
||||
}
|
||||
for (std::set<int>::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++)
|
||||
{
|
||||
@@ -4220,6 +4222,7 @@ bool static LoadBlockIndexDB()
|
||||
if (pindex->pprev) {
|
||||
pindex->pprev->hashAnchorEnd = pindex->hashAnchor;
|
||||
}
|
||||
komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
|
||||
}
|
||||
|
||||
// Load pointer to end of best chain
|
||||
|
||||
Reference in New Issue
Block a user