diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index c438a7398..41c75b77d 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -635,8 +635,16 @@ void basilisk_respond_ping(struct supernet_info *myinfo,struct iguana_peer *addr printf("(%s %d).%p ",symbol,height,addr); if ( myinfo->numrelays > 0 && addr != 0 && (virt= iguana_coinfind(symbol)) != 0 ) { - if ( virt->blocks.hwmchain.height > height && (height % myinfo->numrelays) == myinfo->RELAYID ) - basilisk_blocksend(myinfo,btcd,virt,addr,height+1); + if ( height > virt->longestchain ) + virt->longestchain = height; + if ( myinfo->numrelays > 0 && virt->blocks.hwmchain.height > height ) + { + diff = ((height % myinfo->numrelays) - myinfo->RELAYID); + diff *= diff; + diff++; + if ( (rand() % diff) == 0 ) + basilisk_blocksend(myinfo,btcd,virt,addr,height+1); + } } } for (i=0; isymbol,virt->chain->hashalgo,serialized,datalen); if ( bits256_cmp(threshold,hash2) > 0 ) { - printf("nonce worked crc.%x\n",calc_crc32(0,serialized,datalen)); + //printf("nonce worked crc.%x\n",calc_crc32(0,serialized,datalen)); return(1); } else @@ -232,13 +232,13 @@ char *gecko_blockconstruct(struct supernet_info *myinfo,struct iguana_info *virt hash2 = iguana_calcblockhash(virt->symbol,virt->chain->hashalgo,serialized,len); if ( bits256_cmp(threshold,hash2) > 0 ) { - printf("FOUND NONCE %d iterations\n",i+1); + //printf("FOUND NONCE %d iterations\n",i+1); newblock->RO.hash2 = hash2; break; } if ( newblock->height != 0 && OS_milliseconds() > expiration ) { - printf("time limit exceeded %u %d iterations\n",virt->blocks.hwmchain.RO.timestamp,i+1); + //printf("time limit exceeded %u %d iterations\n",virt->blocks.hwmchain.RO.timestamp,i+1); free(coinbasestr); if ( txids != txspace ) free(txids); @@ -365,11 +365,13 @@ void gecko_miner(struct supernet_info *myinfo,struct iguana_info *btcd,struct ig //printf("skip non-virtual chain.%s\n",virt->symbol); return; } + if ( virt->blocks.hwmchain.height < virt->longestchain-1 ) + return; if ( (virt->blocks.hwmchain.height % myinfo->numrelays) != myinfo->RELAYID ) { //if ( myinfo->numrelays < 3 ) - return; - gap = (int32_t)(time(NULL) - virt->blocks.hwmchain.RO.timestamp) / 10;//virt->chain->estblocktime; + // return; + gap = (int32_t)(time(NULL) - virt->blocks.hwmchain.RO.timestamp) / 60;//virt->chain->estblocktime; for (i=0; iblocks.hwmchain.height+i) % myinfo->numrelays) == myinfo->RELAYID )