|
@ -206,15 +206,18 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ |
|
|
return(-1); |
|
|
return(-1); |
|
|
} |
|
|
} |
|
|
if ( basilisk_notarycmd(type) != 0 && myinfo->NOTARY.NUMRELAYS == 0 ) |
|
|
if ( basilisk_notarycmd(type) != 0 && myinfo->NOTARY.NUMRELAYS == 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
printf("no notary nodes to send (%s) to\n",type); |
|
|
return(-1); |
|
|
return(-1); |
|
|
|
|
|
} |
|
|
//portable_mutex_lock(&myinfo->allcoins_mutex);
|
|
|
//portable_mutex_lock(&myinfo->allcoins_mutex);
|
|
|
alreadysent = calloc(IGUANA_MAXPEERS * IGUANA_MAXCOINS,sizeof(*alreadysent)); |
|
|
alreadysent = calloc(IGUANA_MAXPEERS * IGUANA_MAXCOINS,sizeof(*alreadysent)); |
|
|
HASH_ITER(hh,myinfo->allcoins,coin,tmp) |
|
|
HASH_ITER(hh,myinfo->allcoins,coin,tmp) |
|
|
{ |
|
|
{ |
|
|
if ( coin->peers == 0 ) |
|
|
if ( coin->peers == 0 ) |
|
|
continue; |
|
|
continue; |
|
|
//if ( basilisk_notarycmd(type) != 0 && strcmp(coin->symbol,"NOTARY") != 0 )
|
|
|
if ( basilisk_notarycmd(type) != 0 && strcmp(coin->symbol,"NOTARY") != 0 ) |
|
|
// continue;
|
|
|
continue; |
|
|
if ( coin->FULLNODE == 0 && coin->VALIDATENODE == 0 ) |
|
|
if ( coin->FULLNODE == 0 && coin->VALIDATENODE == 0 ) |
|
|
cmd[0] = 's'; |
|
|
cmd[0] = 's'; |
|
|
else cmd[0] = 'S'; |
|
|
else cmd[0] = 'S'; |
|
@ -230,7 +233,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ |
|
|
{ |
|
|
{ |
|
|
s = 0; |
|
|
s = 0; |
|
|
valid = (addr->supernet != 0); |
|
|
valid = (addr->supernet != 0); |
|
|
if ( basilisk_notarycmd(type) != 0 ) |
|
|
if ( basilisk_notarycmd(type) != 0 || (strcmp(type,"INF") == 0 && strcmp(coin->symbol,"NOTARY") == 0) ) |
|
|
{ |
|
|
{ |
|
|
valid = 0; |
|
|
valid = 0; |
|
|
/*OS_randombytes((void *)&r2,sizeof(r2));
|
|
|
/*OS_randombytes((void *)&r2,sizeof(r2));
|
|
@ -258,7 +261,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ |
|
|
} |
|
|
} |
|
|
if ( s == n && valid == 1 && (destipaddr == 0 || strcmp(addr->ipaddr,destipaddr) == 0) ) |
|
|
if ( s == n && valid == 1 && (destipaddr == 0 || strcmp(addr->ipaddr,destipaddr) == 0) ) |
|
|
{ |
|
|
{ |
|
|
//fprintf(stderr,"(%s).%u ",addr->ipaddr,coin->chain->portp2p);
|
|
|
fprintf(stderr,">>> (%s).%u ",addr->ipaddr,coin->chain->portp2p); |
|
|
//printf("n.%d/fanout.%d i.%d l.%d [%s].tag%u send %s.(%s) [%x] datalen.%d addr->supernet.%u basilisk.%u to (%s).%d destip.%s\n",n,fanout,i,l,cmd,*(uint32_t *)data,type,(char *)&data[4],*(int32_t *)&data[datalen-4],datalen,addr->supernet,addr->basilisk,addr->ipaddr,addr->A.port,destipaddr!=0?destipaddr:"broadcast");
|
|
|
//printf("n.%d/fanout.%d i.%d l.%d [%s].tag%u send %s.(%s) [%x] datalen.%d addr->supernet.%u basilisk.%u to (%s).%d destip.%s\n",n,fanout,i,l,cmd,*(uint32_t *)data,type,(char *)&data[4],*(int32_t *)&data[datalen-4],datalen,addr->supernet,addr->basilisk,addr->ipaddr,addr->A.port,destipaddr!=0?destipaddr:"broadcast");
|
|
|
if ( encryptflag != 0 && bits256_nonz(addr->pubkey) != 0 ) |
|
|
if ( encryptflag != 0 && bits256_nonz(addr->pubkey) != 0 ) |
|
|
{ |
|
|
{ |
|
@ -805,7 +808,7 @@ void basilisk_requests_poll(struct supernet_info *myinfo) |
|
|
memset(&issueR,0,sizeof(issueR)); |
|
|
memset(&issueR,0,sizeof(issueR)); |
|
|
if ( (retstr= InstantDEX_incoming(myinfo,0,0,0,0)) != 0 ) |
|
|
if ( (retstr= InstantDEX_incoming(myinfo,0,0,0,0)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
//printf("poll.(%s)\n",retstr);
|
|
|
printf("poll.(%s)\n",retstr); |
|
|
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|
|
if ( (retjson= cJSON_Parse(retstr)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( (outerarray= jarray(&n,retjson,"responses")) != 0 ) |
|
|
if ( (outerarray= jarray(&n,retjson,"responses")) != 0 ) |
|
|