This commit is contained in:
jl777
2016-11-11 20:15:05 -03:00
parent 6ed911ff39
commit 4a4e912bbe
10 changed files with 87 additions and 43 deletions

View File

@@ -377,6 +377,7 @@ void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
{
//int32_t i; uint256 hash;
komodo_init(pindex->nHeight);
Minerids[pindex->nHeight] = -2;
//hash = block.GetHash();
//for (i=0; i<32; i++)
// printf("%02x",((uint8_t *)&hash)[i]);
@@ -446,6 +447,43 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
}
}
int8_t komodo_minerid(int32_t height)
{
int32_t notaryid; CBlockIndex *pindex; uint8_t pubkey33[33];
if ( height <= chainActive.Tip()->nHeight )
{
if ( (pindex= chainActive[height]) != 0 )
{
komodo_index2pubkey33(pubkey33,pindex,height);
komodo_chosennotary(&notaryid,height,pubkey33);
return(notaryid);
}
}
return(-2);
}
int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33])
{
int32_t notaryid;
komodo_chosennotary(&notaryid,height,pubkey33);
if ( height >= 34000 && notaryid >= 0 )
{
for (i=1; i<64; i++)
{
if ( Minerids[height-i] == -2 )
{
Minerids[height-i] = komodo_minerid(height-i);
if ( Minerids[height - i] == -2 )
fprintf(stderr,"second -2 for Minerids[%d] current.%d\n",height-i,CURRENT_HEIGHT);
}
if ( Minerids[height-i] == notaryid )
return(-1);
}
return(1);
}
return(0);
}
int32_t komodo_checkpoint(int32_t *notarized_heightp,int32_t nHeight,uint256 hash)
{
int32_t notarized_height; uint256 notarized_hash,notarized_desttxid; CBlockIndex *notary;