diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 5586edc31..2ce57c600 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -153,7 +153,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ else if ( fanout > BASILISK_MAXFANOUT ) fanout = BASILISK_MAXFANOUT; if ( type == 0 ) - type = "BTCD"; + type = "INF"; if ( strlen(type) > 3 ) { printf("basilisk_sendcmd illegal type(%s)\n",type); @@ -213,6 +213,8 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ { if ( coin->peers == 0 ) continue; + //if ( basilisk_notarycmd(type) != 0 && strcmp(coin->symbol,"NOTARY") != 0 ) + // continue; if ( coin->FULLNODE == 0 && coin->VALIDATENODE == 0 ) cmd[0] = 's'; else cmd[0] = 'S'; @@ -228,21 +230,21 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ { s = 0; valid = (addr->supernet != 0); - if ( basilisk_notarycmd(type) != 0 && myinfo->IAMNOTARY != 0 ) + if ( basilisk_notarycmd(type) != 0 ) { valid = 0; - OS_randombytes((void *)&r2,sizeof(r2)); + /*OS_randombytes((void *)&r2,sizeof(r2)); if ( (r2 % myinfo->NOTARY.NUMRELAYS) >= sqrt(myinfo->NOTARY.NUMRELAYS) ) { - //printf("fanout.%d s.%d n.%d skip %s\n",fanout,s,n,addr->ipaddr); + printf("fanout.%d s.%d n.%d skip %s\n",fanout,s,n,addr->ipaddr); continue; - } + }*/ for (s=0; sNOTARY.NUMRELAYS; s++) if ( addr->ipbits != myinfo->myaddr.myipbits && myinfo->NOTARY.RELAYS[s].ipbits == addr->ipbits ) break; if ( s == myinfo->NOTARY.NUMRELAYS ) { - //printf("skip non-relay.(%s)\n",addr->ipaddr); + printf("skip non-relay.(%s)\n",addr->ipaddr); continue; } valid = 1; @@ -256,7 +258,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) ) { - //fprintf(stderr,"(%s) ",addr->ipaddr); + 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"); if ( encryptflag != 0 && bits256_nonz(addr->pubkey) != 0 ) { @@ -676,7 +678,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende return; } else if ( basilisk_notarycmd(CMD) != 0 ) return; - symbol = "BTCD"; + symbol = "NOTARY"; if ( senderipbits == 0 ) expand_ipbits(remoteaddr,myinfo->myaddr.myipbits); else expand_ipbits(remoteaddr,senderipbits); @@ -723,7 +725,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende data += jsonlen, datalen -= jsonlen; else data = 0, datalen = 0; if ( coin == 0 ) - coin = iguana_coinfind("BTCD"); + coin = iguana_coinfind(symbol); if ( coin != 0 ) { symbol = coin->symbol; diff --git a/basilisk/basilisk_MSG.c b/basilisk/basilisk_MSG.c index 7c578cd52..23d6287d7 100755 --- a/basilisk/basilisk_MSG.c +++ b/basilisk/basilisk_MSG.c @@ -207,7 +207,7 @@ int32_t basilisk_channelsend(struct supernet_info *myinfo,bits256 hash,uint32_t jaddnum(valsobj,"msgid",msgid); jaddnum(valsobj,"duration",duration); jaddbits256(valsobj,"sender",myinfo->myaddr.persistent); - //char str[65]; printf("sendmessage.[%d] channel.%u msgid.%x -> %s numrelays.%d:%d\n",datalen,channel,msgid,bits256_str(str,hash),NUMRELAYS,juint(valsobj,"fanout")); + char str[65]; printf("sendmessage.[%d] channel.%u msgid.%x -> %s numrelays.%d:%d\n",datalen,channel,msgid,bits256_str(str,hash),myinfo->NOTARY.NUMRELAYS,juint(valsobj,"fanout")); if ( (retstr= basilisk_sendmessage(myinfo,0,0,0,hash,valsobj,hexstr)) != 0 ) free(retstr); free_json(valsobj); diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index cddd4b733..81be7eb1c 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -1010,7 +1010,7 @@ int32_t iguana_msgparser(struct supernet_info *myinfo,struct iguana_info *coin,s { struct iguana_msgzblock zmsg; struct iguana_msgblock *msg = (void *)&zmsg; struct iguana_zblock *zblocks; uint32_t tmp,n=0; len = 0; - if ( addr != 0 && recvlen >= sizeof(bits256) && strcmp("BTCD",coin->symbol) != 0 ) + if ( addr != 0 && recvlen >= sizeof(bits256) && strcmp("NOTARY",coin->symbol) != 0 ) { if ( ishost == 0 ) { diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index 016dda529..285e4f1be 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -584,7 +584,7 @@ int32_t iguana_recv(char *ipaddr,int32_t usock,uint8_t *recvbuf,int32_t len) remains -= recvlen; //int32_t i; for (i=0; iFULLNODE != 0 || coin->VALIDATENODE != 0 ) @@ -1174,7 +1174,17 @@ ZERO_ARGS(bitcoinrpc,getinfo) } if ( (fullnodes= jarray(&m,item,"supernet")) != 0 ) { - for (j=0; jsymbol,"NOTARY") == 0 ) + { + for (j=0; jmyaddr.pubkey.uints[0] % incr); + } else j = 0; + for (; j