From 3b96a1b25b3f0a75640f27fa123fd0a8fde641ac Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Sep 2016 13:18:16 -0300 Subject: [PATCH] test --- basilisk/basilisk.c | 6 +++--- basilisk/basilisk_MSG.c | 6 ++---- basilisk/basilisk_bitcoin.c | 10 +++++----- iguana/iguana_wallet.c | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 19c724506..dcf4fed6c 100755 --- a/basilisk/basilisk.c +++ b/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 ) diff --git a/basilisk/basilisk_MSG.c b/basilisk/basilisk_MSG.c index 6b6ef6848..a436043a6 100755 --- a/basilisk/basilisk_MSG.c +++ b/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 ) diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index 2fab0e662..dea04fc92 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/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 ) diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index 30174cfa3..18884b54f 100755 --- a/iguana/iguana_wallet.c +++ b/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 ) {