jl777 8 years ago
parent
commit
fab74cd339
  1. 2
      basilisk/basilisk.c
  2. 2
      basilisk/basilisk_ping.c
  3. 2
      datachain/datachain.c
  4. 4
      gecko/gecko_miner.c
  5. 12
      iguana/iguana_peers.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 )

12
iguana/iguana_peers.c

@ -448,10 +448,10 @@ int32_t iguana_socket(int32_t bindflag,char *hostname,uint16_t port)
}
}
timeout.tv_sec = 0;
timeout.tv_usec = 300000;
timeout.tv_usec = 30000;
setsockopt(sock,SOL_SOCKET,SO_RCVTIMEO,(void *)&timeout,sizeof(timeout));
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
timeout.tv_usec = 10000;
setsockopt(sock,SOL_SOCKET,SO_SNDTIMEO,(void *)&timeout,sizeof(timeout));
return(sock);
}
@ -503,11 +503,11 @@ int32_t iguana_send(struct iguana_info *coin,struct iguana_peer *addr,uint8_t *s
if ( (numsent= (int32_t)send(usock,serialized,remains,MSG_NOSIGNAL)) < 0 )
#endif
{
if ( errno == EAGAIN )
if ( errno == EAGAIN || errno == EWOULDBLOCK )
{
addr->persistent_peer = 1;
//sleep(1);
//continue;
//addr->persistent_peer = 1;
sleep(1);
continue;
}
//if ( errno != EAGAIN && errno != EWOULDBLOCK )
{

Loading…
Cancel
Save