jl777 8 years ago
parent
commit
3b96a1b25b
  1. 6
      basilisk/basilisk.c
  2. 6
      basilisk/basilisk_MSG.c
  3. 10
      basilisk/basilisk_bitcoin.c
  4. 2
      iguana/iguana_wallet.c

6
basilisk/basilisk.c

@ -323,7 +323,7 @@ void basilisk_sendback(struct supernet_info *myinfo,char *origCMD,char *symbol,c
jaddbits256(valsobj,"chaintip",virt->blocks.hwmchain.RO.hash2);
}
data = basilisk_jsondata(sizeof(struct iguana_msghdr),&allocptr,space,sizeof(space),&datalen,symbol,valsobj,basilisktag);
//printf("sendback.%d -> %s\n",datalen,remoteaddr);
printf("sendback.%d -> %s\n",datalen,remoteaddr);
basilisk_sendcmd(myinfo,remoteaddr,"RET",&basilisktag,encryptflag,delaymillis,data,datalen,0,0);
if ( allocptr != 0 )
free(allocptr);
@ -408,7 +408,7 @@ struct basilisk_item *basilisk_requestservice(struct supernet_info *myinfo,struc
if ( fanout < minfanout )
fanout = minfanout;
if ( (numrequired= jint(valsobj,"numrequired")) <= 0 )
numrequired = MAX(fanout,sqrt(myinfo->NOTARY.NUMRELAYS)+1);
numrequired = MIN(fanout,sqrt(myinfo->NOTARY.NUMRELAYS)+1);
if ( (symbol= jstr(valsobj,"coin")) != 0 || (symbol= jstr(valsobj,"symbol")) != 0 )
{
if ( (virt= iguana_coinfind(symbol)) != 0 )
@ -749,7 +749,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende
{
if ( (retstr= (*basilisk_services[i][1])(myinfo,type,addr,remoteaddr,basilisktag,valsobj,data,datalen,hash,from_basilisk)) != 0 )
{
//printf("from_basilisk.%d ret.(%s)\n",from_basilisk,retstr);
printf("from_basilisk.%d ret.(%s)\n",from_basilisk,retstr);
//if ( from_basilisk != 0 || strcmp(CMD,"GET") == 0 )
basilisk_sendback(myinfo,CMD,symbol,remoteaddr,basilisktag,retstr);
if ( retstr != 0 )

6
basilisk/basilisk_MSG.c

@ -27,8 +27,6 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3
else if ( duration > INSTANTDEX_LOCKTIME*2 )
duration = INSTANTDEX_LOCKTIME*2;
memcpy(desthash.bytes,&key[BASILISK_KEYSIZE - sizeof(desthash)],sizeof(desthash));
if ( bits256_nonz(desthash) == 0 )
msg->broadcast = 1;
if ( bits256_nonz(desthash) == 0 )
msg->broadcast = 1;
msg->duration = duration;
@ -118,7 +116,7 @@ char *basilisk_respond_OUT(struct supernet_info *myinfo,char *CMD,void *addr,cha
duration = BASILISK_MSGDURATION;
}
// printf("OUT keylen.%d datalen.%d\n",keylen,datalen);
// char str[65]; printf("add message.[%d] channel.%u msgid.%x %s\n",datalen,juint(valsobj,"channel"),juint(valsobj,"msgid"),bits256_str(str,hash));
char str[65]; printf("add message.[%d] channel.%u msgid.%x %s\n",datalen,juint(valsobj,"channel"),juint(valsobj,"msgid"),bits256_str(str,hash));
return(retstr);
}
@ -314,7 +312,7 @@ cJSON *basilisk_channelget(struct supernet_info *myinfo,bits256 srchash,bits256
jaddbits256(valsobj,"desthash",desthash);
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.(%s)\n",channel,msgid,retstr);
if ( (retarray= cJSON_Parse(retstr)) != 0 )
{
if ( is_cJSON_Array(retarray) == 0 )

10
basilisk/basilisk_bitcoin.c

@ -437,12 +437,12 @@ void *basilisk_getinfo(struct basilisk_item *Lptr,struct supernet_info *myinfo,s
Lptr->retstr = jprint(infojson,1);
return(Lptr);
}
if ( (fanout= juint(valsobj,"fanout")) < 5 )
fanout = 5;
if ( (fanout= juint(valsobj,"fanout")) < 8 )
fanout = 8;
if ( (numrequired= juint(valsobj,"numrequired")) < fanout )
{
jaddnum(valsobj,"numrequired",fanout);
numrequired = fanout;
numrequired = 1;
}
ptr = basilisk_issueremote(myinfo,0,&numsent,"INF",coin->symbol,1,valsobj,fanout,numrequired,basilisktag,timeoutmillis,0,0,0,0,BASILISK_DEFAULTDIFF);
return(ptr);
@ -860,9 +860,9 @@ HASH_ARRAY_STRING(basilisk,rawtx,hash,vals,hexstr)
coin = iguana_coinfind(symbol);
}
if ( jobj(vals,"numrequired") == 0 )
jaddnum(vals,"numrequired",myinfo->NOTARY.NUMRELAYS);
jaddnum(vals,"numrequired",MIN(3,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+1));
if ( jobj(vals,"fanout") == 0 )
jaddnum(vals,"fanout",MAX(5,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+1));
jaddnum(vals,"fanout",MIN(3,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+1));
if ( coin != 0 )
{
//if ( juint(vals,"burn") == 0 )

2
iguana/iguana_wallet.c

@ -1146,7 +1146,7 @@ ZERO_ARGS(bitcoinrpc,getinfo)
else
{
valsobj = cJSON_CreateObject();
ptr = basilisk_getinfo(&Lptr,myinfo,coin,remoteaddr,0,1000,valsobj);
ptr = basilisk_getinfo(&Lptr,myinfo,coin,remoteaddr,0,3000,valsobj);
free_json(valsobj);
if ( ptr != 0 && ptr->retstr != 0 )
{

Loading…
Cancel
Save