This commit is contained in:
jl777
2018-04-13 16:22:27 +03:00
parent 071f1be1f6
commit 2b00bd236c
2 changed files with 17 additions and 11 deletions

View File

@@ -725,11 +725,16 @@ uint32_t komodo_heightstamp(int32_t height)
void komodo_pindex_init(CBlockIndex *pindex,int32_t height) void komodo_pindex_init(CBlockIndex *pindex,int32_t height)
{ {
int32_t i,num; uint8_t pubkeys[64][33]; CBlock block; 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; pindex->notaryid = -1;
if ( pindex->pubkey33[0] != 2 && pindex->pubkey33[0] != 3 )
{
memset(pindex->pubkey33,0,33); memset(pindex->pubkey33,0,33);
if ( komodo_blockload(block,pindex) == 0 ) if ( komodo_blockload(block,pindex) == 0 )
{
komodo_block2pubkey33(pindex->pubkey33,block); 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 ) 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++)
@@ -741,8 +746,6 @@ void komodo_pindex_init(CBlockIndex *pindex,int32_t height)
} }
} }
} }
printf("pindex.%d initialized notary.%d from height.%d\n",pindex->nHeight,pindex->notaryid,height);
}
} }
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)

View File

@@ -4157,6 +4157,7 @@ bool static LoadBlockIndexDB()
pindex->BuildSkip(); pindex->BuildSkip();
if (pindex->IsValid(BLOCK_VALID_TREE) && (pindexBestHeader == NULL || CBlockIndexWorkComparator()(pindexBestHeader, pindex))) if (pindex->IsValid(BLOCK_VALID_TREE) && (pindexBestHeader == NULL || CBlockIndexWorkComparator()(pindexBestHeader, pindex)))
pindexBestHeader = pindex; pindexBestHeader = pindex;
komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
} }
// Load block file info // Load block file info
@@ -4185,6 +4186,7 @@ bool static LoadBlockIndexDB()
if (pindex->nStatus & BLOCK_HAVE_DATA) { if (pindex->nStatus & BLOCK_HAVE_DATA) {
setBlkDataFiles.insert(pindex->nFile); setBlkDataFiles.insert(pindex->nFile);
} }
komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
} }
for (std::set<int>::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++) for (std::set<int>::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++)
{ {
@@ -4220,6 +4222,7 @@ bool static LoadBlockIndexDB()
if (pindex->pprev) { if (pindex->pprev) {
pindex->pprev->hashAnchorEnd = pindex->hashAnchor; pindex->pprev->hashAnchorEnd = pindex->hashAnchor;
} }
komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
} }
// Load pointer to end of best chain // Load pointer to end of best chain