Browse Source

% zero is bad

release/v0.1
jl777 8 years ago
parent
commit
286a5ea780
  1. 2
      basilisk/basilisk.c
  2. 2
      basilisk/basilisk_ping.c
  3. 2
      datachain/datachain.c
  4. 4
      gecko/gecko_miner.c

2
basilisk/basilisk.c

@ -228,7 +228,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ
{
s = 0;
valid = (addr->supernet != 0);
if ( basilisk_notarycmd(type) != 0 )
if ( basilisk_notarycmd(type) != 0 && myinfo->IAMNOTARY != 0 )
{
valid = 0;
OS_randombytes((void *)&r2,sizeof(r2));

2
basilisk/basilisk_ping.c

@ -271,7 +271,7 @@ int32_t basilisk_ping_gen(struct supernet_info *myinfo,uint8_t *data,int32_t max
void basilisk_ping_send(struct supernet_info *myinfo,struct iguana_info *btcd)
{
struct iguana_peer *addr; char ipaddr[64]; struct basilisk_relay *rp; uint32_t r; int32_t i,j,incr,datalen=0; uint64_t alreadysent;
if ( btcd == 0 || myinfo->NOTARY.NUMRELAYS <= 0 )
if ( btcd == 0 || myinfo->NOTARY.NUMRELAYS <= 0 || myinfo->IAMNOTARY == 0 )
return;
if ( myinfo->pingbuf == 0 )
myinfo->pingbuf = malloc(IGUANA_MAXPACKETSIZE);

2
datachain/datachain.c

@ -20,7 +20,7 @@ uint32_t datachain_checkpoint(struct supernet_info *myinfo,struct iguana_info *c
{
char str[65],str2[65]; struct iguana_info *btc = iguana_coinfind("BTC");
printf("datachain_checkpoint.%s for %s.%u to %u lastheight.%d %s\n",bits256_str(str,merkle),coin->symbol,lastcheckpoint,timestamp,lastheight,bits256_str(str2,lasthash2));
if ( (lastheight % myinfo->NOTARY.NUMRELAYS) == myinfo->NOTARY.RELAYID )
if ( myinfo->IAMNOTARY != 0 && (lastheight % myinfo->NOTARY.NUMRELAYS) == myinfo->NOTARY.RELAYID )
{
// if designated relay, submit checkpoint -> add ip/relayid to opreturn
//

4
gecko/gecko_miner.c

@ -367,14 +367,14 @@ void gecko_miner(struct supernet_info *myinfo,struct iguana_info *btcd,struct ig
}
if ( virt->blocks.hwmchain.height < virt->longestchain-1 )
return;
if ( (virt->blocks.hwmchain.height % myinfo->NOTARY.NUMRELAYS) != myinfo->NOTARY.RELAYID )
if ( myinfo->IAMNOTARY != 0 && (virt->blocks.hwmchain.height % myinfo->NOTARY.NUMRELAYS) != myinfo->NOTARY.RELAYID )
{
//if ( NUMRELAYS < 3 )
// return;
gap = (int32_t)(time(NULL) - virt->blocks.hwmchain.RO.timestamp) / 60;//virt->chain->estblocktime;
for (i=0; i<gap; i++)
{
if ( ((virt->blocks.hwmchain.height+i) % myinfo->NOTARY.NUMRELAYS) == myinfo->NOTARY.RELAYID )
if ( myinfo->IAMNOTARY != 0 && ((virt->blocks.hwmchain.height+i) % myinfo->NOTARY.NUMRELAYS) == myinfo->NOTARY.RELAYID )
break;
}
if ( i == gap )

Loading…
Cancel
Save