jl777 8 years ago
parent
commit
f19ac6dc40
  1. 13
      basilisk/basilisk.c
  2. 2
      basilisk/basilisk_DEX.c
  3. 2
      basilisk/basilisk_MSG.c
  4. 2
      basilisk/basilisk_tradebot.c
  5. 2
      iguana/iguana_json.c
  6. 7
      iguana/iguana_unspents.c

13
basilisk/basilisk.c

@ -206,15 +206,18 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ
return(-1);
}
if ( basilisk_notarycmd(type) != 0 && myinfo->NOTARY.NUMRELAYS == 0 )
{
printf("no notary nodes to send (%s) to\n",type);
return(-1);
}
//portable_mutex_lock(&myinfo->allcoins_mutex);
alreadysent = calloc(IGUANA_MAXPEERS * IGUANA_MAXCOINS,sizeof(*alreadysent));
HASH_ITER(hh,myinfo->allcoins,coin,tmp)
{
if ( coin->peers == 0 )
continue;
//if ( basilisk_notarycmd(type) != 0 && strcmp(coin->symbol,"NOTARY") != 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';
@ -230,7 +233,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 || (strcmp(type,"INF") == 0 && strcmp(coin->symbol,"NOTARY") == 0) )
{
valid = 0;
/*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) )
{
//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");
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));
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 ( (outerarray= jarray(&n,retjson,"responses")) != 0 )

2
basilisk/basilisk_DEX.c

@ -456,7 +456,7 @@ STRING_ARG(InstantDEX,available,source)
HASH_ARRAY_STRING(InstantDEX,request,hash,vals,hexstr)
{
uint8_t serialized[512]; struct basilisk_request R; cJSON *reqjson; uint32_t datalen=0,DEX_channel;
myinfo->DEXactive = (uint32_t)time(NULL) + BASILISK_TIMEOUT;
myinfo->DEXactive = (uint32_t)time(NULL) + 3*BASILISK_TIMEOUT;
jadd64bits(vals,"minamount",jdouble(vals,"minprice") * jdouble(vals,"amount") * SATOSHIDEN);
if ( jobj(vals,"srchash") == 0 )
jaddbits256(vals,"srchash",myinfo->myaddr.pubkey);

2
basilisk/basilisk_MSG.c

@ -261,7 +261,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),myinfo->NOTARY.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);

2
basilisk/basilisk_tradebot.c

@ -249,7 +249,7 @@ double basilisk_process_results(struct supernet_info *myinfo,struct basilisk_req
if ( (hexdata= get_dataptr(0,&allocptr,&hexlen,hexspace,sizeof(hexspace),hexstr)) != 0 )
{
basilisk_rwDEXquote(0,hexdata,&R);
//printf("[%d].(%s)\n",i,jprint(basilisk_requestjson(&R),1));
printf("[%d].(%s)\n",i,jprint(basilisk_requestjson(&R),1));
}
} else basilisk_parsejson(&R,item);
if ( nonz != 0 )

2
iguana/iguana_json.c

@ -651,6 +651,8 @@ TWO_STRINGS(iguana,addnode,activecoin,ipaddr)
struct iguana_peer *addr; int32_t i,n;
if ( coin == 0 )
coin = iguana_coinfind(activecoin);
if ( strcmp(coin->symbol,"NOTARY") == 0 )
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);
if ( coin != 0 && coin->peers != 0 && ipaddr != 0 && is_ipaddr(ipaddr) != 0 )
{

7
iguana/iguana_unspents.c

@ -366,8 +366,11 @@ struct iguana_pkhash *iguana_pkhashfind(struct iguana_info *coin,struct iguana_r
return(p);
} else if ( pkind != 0 )
printf("[%d] not found pkind.%d vs num.%d RT.%d rdata.%p\n",i,pkind,rdata->numpkinds,bp->isRT,rdata);
} else if ( coin->spendvectorsaved > 1 && bp != coin->current && bp->bundleheight < coin->firstRTheight )
printf("%s.[%d] skip null rdata isRT.%d [%d]\n",coin->symbol,i,bp->isRT,coin->current!=0?coin->current->hdrsi:-1);
}
else if ( coin->spendvectorsaved > 1 && bp != coin->current && bp->bundleheight < coin->firstRTheight )
{
//printf("%s.[%d] skip null rdata isRT.%d [%d]\n",coin->symbol,i,bp->isRT,coin->current!=0?coin->current->hdrsi:-1);
}
}
}
return(0);

Loading…
Cancel
Save