Test
This commit is contained in:
@@ -722,7 +722,7 @@ uint32_t komodo_heightstamp(int32_t height)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void komodo_pindex_init(CBlockIndex *pindex)
|
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;
|
||||||
pindex->notaryid = -1;
|
pindex->notaryid = -1;
|
||||||
@@ -730,9 +730,8 @@ void komodo_pindex_init(CBlockIndex *pindex)
|
|||||||
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) && (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 )
|
||||||
{
|
{
|
||||||
pindex->notaryid = -1;
|
|
||||||
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 )
|
||||||
@@ -742,6 +741,7 @@ void komodo_pindex_init(CBlockIndex *pindex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printf("pindex.%d initialized notary.%d from height.%d\n",pindex->nHeight,pindex->notaryid,height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -749,14 +749,14 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
|
|||||||
{
|
{
|
||||||
CBlock block; int32_t num,i;
|
CBlock block; int32_t num,i;
|
||||||
memset(pubkey33,0,33);
|
memset(pubkey33,0,33);
|
||||||
if ( pindex != 0 && pindex->nHeight == height )
|
if ( pindex != 0 )
|
||||||
{
|
{
|
||||||
if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 )
|
if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 )
|
||||||
{
|
{
|
||||||
memcpy(pubkey33,pindex->pubkey33,33);
|
memcpy(pubkey33,pindex->pubkey33,33);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
komodo_pindex_init(pindex);
|
komodo_pindex_init(pindex,height);
|
||||||
memcpy(pubkey33,pindex->pubkey33,33);
|
memcpy(pubkey33,pindex->pubkey33,33);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4091,7 +4091,7 @@ CBlockIndex * InsertBlockIndex(uint256 hash)
|
|||||||
return pindexNew;
|
return pindexNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
void komodo_pindex_init(CBlockIndex *pindex);
|
void komodo_pindex_init(CBlockIndex *pindex,int32_t height);
|
||||||
|
|
||||||
bool static LoadBlockIndexDB()
|
bool static LoadBlockIndexDB()
|
||||||
{
|
{
|
||||||
@@ -4108,9 +4108,7 @@ bool static LoadBlockIndexDB()
|
|||||||
{
|
{
|
||||||
CBlockIndex* pindex = item.second;
|
CBlockIndex* pindex = item.second;
|
||||||
vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex));
|
vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex));
|
||||||
if ( pindex->nHeight >= 0 )
|
komodo_pindex_init(pindex,(int32_t)pindex->nHeight);
|
||||||
komodo_pindex_init(pindex);
|
|
||||||
else pindex->notaryid = -1;
|
|
||||||
}
|
}
|
||||||
sort(vSortedByHeight.begin(), vSortedByHeight.end());
|
sort(vSortedByHeight.begin(), vSortedByHeight.end());
|
||||||
BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
|
BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
|
||||||
|
|||||||
Reference in New Issue
Block a user