jl777 8 years ago
parent
commit
c7e9685de7
  1. 5
      basilisk/basilisk.c
  2. 2
      basilisk/basilisk_MSG.c
  3. 2
      iguana/iguana_json.c

5
basilisk/basilisk.c

@ -221,7 +221,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ
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';
r = rand() % (coin->peers->numranked+1); r = rand() % IGUANA_MAXPEERS;
for (l=0; l<IGUANA_MAXPEERS; l++) for (l=0; l<IGUANA_MAXPEERS; l++)
{ {
i = (l + r) % IGUANA_MAXPEERS; i = (l + r) % IGUANA_MAXPEERS;
@ -262,7 +262,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 [%x] datalen.%d addr->supernet.%u basilisk.%u to (%s).%d destip.%s\n",n,fanout,i,l,cmd,*(uint32_t *)data,type,*(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 )
{ {
void *ptr; uint8_t *cipher,space[8192]; int32_t cipherlen; bits256 privkey; void *ptr; uint8_t *cipher,space[8192]; int32_t cipherlen; bits256 privkey;
@ -320,6 +320,7 @@ void basilisk_sendback(struct supernet_info *myinfo,char *origCMD,char *symbol,c
if ( (virt= iguana_coinfind(symbol)) != 0 ) if ( (virt= iguana_coinfind(symbol)) != 0 )
{ {
jaddnum(valsobj,"hwm",virt->blocks.hwmchain.height); jaddnum(valsobj,"hwm",virt->blocks.hwmchain.height);
if ( bits256_nonz(virt->blocks.hwmchain.RO.hash2) != 0 )
jaddbits256(valsobj,"chaintip",virt->blocks.hwmchain.RO.hash2); jaddbits256(valsobj,"chaintip",virt->blocks.hwmchain.RO.hash2);
} }
data = basilisk_jsondata(sizeof(struct iguana_msghdr),&allocptr,space,sizeof(space),&datalen,symbol,valsobj,basilisktag); data = basilisk_jsondata(sizeof(struct iguana_msghdr),&allocptr,space,sizeof(space),&datalen,symbol,valsobj,basilisktag);

2
basilisk/basilisk_MSG.c

@ -312,7 +312,7 @@ cJSON *basilisk_channelget(struct supernet_info *myinfo,bits256 srchash,bits256
jaddbits256(valsobj,"desthash",desthash); jaddbits256(valsobj,"desthash",desthash);
if ( (retstr= basilisk_getmessage(myinfo,0,0,0,desthash,valsobj,0)) != 0 ) if ( (retstr= basilisk_getmessage(myinfo,0,0,0,desthash,valsobj,0)) != 0 )
{ {
printf("channel.%u msgid.%u gotmessage.(%s)\n",channel,msgid,retstr); printf("channel.%u msgid.%u gotmessage.(%d)\n",channel,msgid,(int32_t)strlen(retstr));
if ( (retarray= cJSON_Parse(retstr)) != 0 ) if ( (retarray= cJSON_Parse(retstr)) != 0 )
{ {
if ( is_cJSON_Array(retarray) == 0 ) if ( is_cJSON_Array(retarray) == 0 )

2
iguana/iguana_json.c

@ -651,7 +651,7 @@ TWO_STRINGS(iguana,addnode,activecoin,ipaddr)
struct iguana_peer *addr; int32_t i,n; struct iguana_peer *addr; int32_t i,n;
if ( coin == 0 ) if ( coin == 0 )
coin = iguana_coinfind(activecoin); coin = iguana_coinfind(activecoin);
if ( strcmp(coin->symbol,"NOTARY") == 0 ) if ( coin != 0 && strcmp(coin->symbol,"NOTARY") == 0 )
basilisk_addrelay_info(myinfo,0,(uint32_t)calc_ipbits(ipaddr),GENESIS_PUBKEY); basilisk_addrelay_info(myinfo,0,(uint32_t)calc_ipbits(ipaddr),GENESIS_PUBKEY);
printf("coin.%p.[%s] addnode.%s -> %s\n",coin,coin!=0?coin->symbol:"",activecoin,ipaddr); printf("coin.%p.[%s] addnode.%s -> %s\n",coin,coin!=0?coin->symbol:"",activecoin,ipaddr);
if ( coin != 0 && coin->peers != 0 && ipaddr != 0 && is_ipaddr(ipaddr) != 0 ) if ( coin != 0 && coin->peers != 0 && ipaddr != 0 && is_ipaddr(ipaddr) != 0 )

Loading…
Cancel
Save