@ -537,8 +537,6 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
return ( 0 ) ;
iguana_blocksizecheck ( " chainlink new " , coin - > chain - > zcash , newblock ) ;
hwmchain = ( struct iguana_block * ) & coin - > blocks . hwmchain ;
if ( 0 & & hwmchain - > height > 0 & & ( ( bp = coin - > current ) = = 0 | | hwmchain - > height / coin - > chain - > bundlesize > bp - > hdrsi + 0 * bp - > isRT ) )
return ( 0 ) ;
if ( ( block = iguana_blockfind ( " chainlink " , coin , newblock - > RO . hash2 ) ) ! = 0 )
{
if ( block - > RO . timestamp = = 0 )
@ -550,6 +548,11 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
{
if ( memcmp ( prev - > RO . hash2 . bytes , coin - > blocks . hwmchain . RO . hash2 . bytes , sizeof ( bits256 ) ) = = 0 )
prev - > mainchain = 1 ;
if ( prev - > valid = = 0 & & iguana_blockvalidate ( coin , & valid , prev , 0 ) < 0 )
{
char str [ 65 ] ; printf ( " (%s) notready v.%d m.%d h.%d \n " , bits256_str ( str , prev - > RO . hash2 ) , prev - > valid , prev - > mainchain , prev - > height ) ;
return ( 0 ) ;
} else prev - > valid = 1 ;
if ( prev - > valid ! = 0 & & prev - > mainchain ! = 0 & & prev - > height > = 0 )
{
prevPoW = prev - > PoW ;
@ -563,23 +566,18 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl
} */
height = prev - > height + 1 ;
}
else
{
//char str[65]; printf("(%s) notready v.%d m.%d h.%d\n",bits256_str(str,prev->RO.hash2),prev->valid,prev->mainchain,prev->height);
return ( 0 ) ;
}
}
else
{
char str [ 65 ] ;
if ( 0 & & bits256_nonz ( block - > RO . prev_block ) ! = 0 )
//if ( 0 && bits256_nonz(block->RO.prev_block) != 0 )
printf ( " chainlink error: cant find prev.(%s) \n " , bits256_str ( str , block - > RO . prev_block ) ) ;
iguana_blockunmark ( coin , block , 0 , - 1 , 0 ) ;
//memset(&block->RO.prev_block.bytes,0,sizeof(block->RO.prev_block));
//getchar();
return ( 0 ) ;
}
//char str[65]; printf("extend? %s.h%d: %.15f vs %.15f ht.%d vs %d\n",bits256_str(str,block->RO.hash2),height,block->PoW,coin->blocks.hwmchain.PoW,height,coin->blocks.hwmchain.height);
char str [ 65 ] ; printf ( " extend? %s.h%d: %.15f vs %.15f ht.%d vs %d \n " , bits256_str ( str , block - > RO . hash2 ) , height , block - > PoW , coin - > blocks . hwmchain . PoW , height , coin - > blocks . hwmchain . height ) ;
if ( iguana_blockvalidate ( coin , & valid , newblock , 0 ) < 0 | | valid = = 0 )
return ( 0 ) ;
block - > height = height ;