@ -708,6 +708,11 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
memset ( pubkey33 , 0 , 33 ) ;
if ( pindex ! = 0 )
{
if ( pindex - > pubkey33 [ 0 ] = = 2 | | pindex - > pubkey33 [ 0 ] = = 3 )
{
memcpy ( pubkey33 , pindex - > pubkey33 , 33 ) ;
return ;
}
if ( komodo_blockload ( block , pindex ) = = 0 )
{
komodo_block2pubkey33 ( pubkey33 , block ) ;
@ -747,7 +752,7 @@ void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
int8_t komodo_minerid ( int32_t height , uint8_t * pubkey33 )
{
int32_t num , i , numnotaries ; CBlockIndex * pindex ; uint32_t timestamp = 0 ; uint8_t _pubkey33 [ 33 ] , pubkeys [ 64 ] [ 33 ] ;
if ( pubkey33 = = 0 & & ( pindex = chainActive [ height ] ) ! = 0 )
if ( ( pindex = chainActive [ height ] ) ! = 0 )
{
timestamp = pindex - > GetBlockTime ( ) ;
if ( pubkey33 = = 0 )
@ -755,6 +760,8 @@ int8_t komodo_minerid(int32_t height,uint8_t *pubkey33)
pubkey33 = _pubkey33 ;
komodo_index2pubkey33 ( pubkey33 , pindex , height ) ;
}
if ( pindex - > pubkey33 [ 0 ] = = 2 | | pindex - > pubkey33 [ 0 ] = = 3 )
return ( pindex - > notaryid ) ;
if ( ( num = komodo_notaries ( pubkeys , height , timestamp ) ) > 0 )
{
for ( i = 0 ; i < num ; i + + )
@ -807,9 +814,9 @@ int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width)
int32_t komodo_is_special ( int32_t height , uint8_t pubkey33 [ 33 ] , uint32_t timestamp )
{
int32_t i , notaryid = 0 , minerid , limit , nid ; uint8_t _pubkey33 [ 33 ] ;
int32_t i , notaryid = 0 , minerid , limit , nid ; //uint8_t _pubkey33[33];
if ( height > = 225000 )
komodo_chosennotary ( & notaryid , height , _ pubkey33, timestamp ) ;
komodo_chosennotary ( & notaryid , height , pubkey33 , timestamp ) ;
if ( height > = 34000 & & notaryid > = 0 )
{
if ( height < 79693 )
@ -819,7 +826,7 @@ int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33],uint32_t timestamp
else limit = 66 ;
for ( i = 1 ; i < limit ; i + + )
{
komodo_chosennotary ( & nid , height - i , _ pubkey33, timestamp ) ;
komodo_chosennotary ( & nid , height - i , pubkey33 , timestamp ) ;
if ( nid = = notaryid ) //komodo_minerid(height-i,_pubkey33)
{
if ( ( 0 ) & & notaryid > 0 )