This commit is contained in:
jl777
2018-04-13 16:51:40 +03:00
parent 26190fd177
commit 81323657a2
3 changed files with 10 additions and 8 deletions

View File

@@ -725,13 +725,13 @@ 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 && (pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3) )
return;
printf("pindex.%d komodo_pindex_init notary.%d from height.%d\n",pindex->nHeight,pindex->notaryid,height);
pindex->notaryid = -1;
if ( pindex->pubkey33[0] != 2 && pindex->pubkey33[0] != 3 )
if ( pindex->pubkey33[0] != 2 && pindex->pubkey33[0] != 3 && pindex->pubkey33[0] != 0xff )
{
memset(pindex->pubkey33,0,33);
memset(pindex->pubkey33,0xff,33);
if ( komodo_blockload(block,pindex) == 0 )
{
komodo_block2pubkey33(pindex->pubkey33,block);

View File

@@ -4091,7 +4091,7 @@ CBlockIndex * InsertBlockIndex(uint256 hash)
return pindexNew;
}
void komodo_pindex_init(CBlockIndex *pindex,int32_t height);
//void komodo_pindex_init(CBlockIndex *pindex,int32_t height);
bool static LoadBlockIndexDB()
{
@@ -4108,7 +4108,7 @@ bool static LoadBlockIndexDB()
{
CBlockIndex* pindex = item.second;
vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex));
komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
//komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
}
sort(vSortedByHeight.begin(), vSortedByHeight.end());
BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
@@ -4157,7 +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);
//komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
}
// Load block file info
@@ -4186,7 +4186,7 @@ bool static LoadBlockIndexDB()
if (pindex->nStatus & BLOCK_HAVE_DATA) {
setBlkDataFiles.insert(pindex->nFile);
}
komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
//komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
}
for (std::set<int>::iterator it = setBlkDataFiles.begin(); it != setBlkDataFiles.end(); it++)
{
@@ -4222,7 +4222,7 @@ bool static LoadBlockIndexDB()
if (pindex->pprev) {
pindex->pprev->hashAnchorEnd = pindex->hashAnchor;
}
komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
//komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
}
// Load pointer to end of best chain

View File

@@ -145,6 +145,8 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
}
if ( height > 34000 && ASSETCHAINS_SYMBOL[0] == 0 ) // 0 -> non-special notary
{
if ( (pindex= komodo_chainactive(height)) != 0 )
komodo_pindex_init(pindex,height);
special = komodo_chosennotary(&notaryid,height,pubkey33,timestamp);
for (i=0; i<33; i++)
{