From a24a0f98ab2c7deb30548a303b36389035426e1c Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 1 Jun 2016 01:08:35 -0500 Subject: [PATCH] test --- basilisk/basilisk.c | 48 ++++++++++++++++++++++++------------- basilisk/basilisk.h | 4 ++-- basilisk/basilisk_CMD.c | 30 +++++++++++------------ basilisk/basilisk_bitcoin.c | 6 ++--- crypto777/iguana_utils.c | 2 +- iguana/iguana_instantdex.c | 2 +- 6 files changed, 54 insertions(+), 38 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index e864424c9..71b1e4cc0 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -93,9 +93,9 @@ struct basilisk_item *basilisk_itemcreate(struct supernet_info *myinfo,char *CMD return(n); }*/ -int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *type,uint32_t basilisktag,int32_t encryptflag,int32_t delaymillis,uint8_t *data,int32_t datalen,int32_t fanout) // data must be offset by sizeof(iguana_msghdr)+sizeof(basilisktag) +int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *type,uint32_t *basilisktagp,int32_t encryptflag,int32_t delaymillis,uint8_t *data,int32_t datalen,int32_t fanout,uint32_t nBits) // data must be offset by sizeof(iguana_msghdr)+sizeof(basilisktag) { - int32_t i,j,r,r2,k,l,s,val,n=0,offset,havepubkey=0,retval = -1; char cmd[12]; struct iguana_info *coin; struct iguana_peer *addr; bits256 pubkey; uint32_t *alreadysent; + int32_t i,j,r,r2,k,l,s,numiters,val,n=0,offset,havepubkey=0,retval = -1; char cmd[12]; struct iguana_info *coin; struct iguana_peer *addr; bits256 pubkey,threshold,hash,hash2; uint32_t *alreadysent; if ( fanout <= 0 ) fanout = BASILISK_MINFANOUT; else if ( fanout > BASILISK_MAXFANOUT ) @@ -124,13 +124,28 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ } } offset = (int32_t)(havepubkey * (1 + sizeof(bits256))); - basilisk_msgprocess(myinfo,0,0,type,basilisktag,data+offset,datalen-offset,pubkey); + basilisk_msgprocess(myinfo,0,0,type,*basilisktagp,data+offset,datalen-offset,pubkey); return(0); } } alreadysent = calloc(IGUANA_MAXPEERS * IGUANA_MAXCOINS,sizeof(*alreadysent)); - iguana_rwnum(1,&data[-sizeof(basilisktag)],sizeof(basilisktag),&basilisktag); - data -= sizeof(basilisktag), datalen += sizeof(basilisktag); + iguana_rwnum(1,&data[-sizeof(*basilisktagp)],sizeof(*basilisktagp),basilisktagp); + if ( *basilisktagp == 0 ) + { + numiters = 0; + vcalc_sha256(0,hash.bytes,data,datalen); + threshold = bits256_from_compact(nBits); + while ( numiters++ < 1000000 ) + { + OS_randombytes((void *)hash.uints,sizeof(*basilisktagp)); + vcalc_sha256(0,hash2.bytes,hash.bytes,sizeof(hash)); + if ( bits256_cmp(threshold,hash2) > 0 ) + break; + } + iguana_rwnum(0,(void *)hash.uints,sizeof(*basilisktagp),basilisktagp); + char str[65],str2[65]; printf("found hash after numiters.%d %s vs %s basilisktag.%u\n",numiters,bits256_str(str,threshold),bits256_str(str2,hash2),*basilisktagp); + } + data -= sizeof(*basilisktagp), datalen += sizeof(*basilisktagp); memset(cmd,0,sizeof(cmd)); sprintf(cmd,"SuperNET%s",type); r = rand(), r2 = rand(); @@ -197,7 +212,7 @@ int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *typ void basilisk_p2p(void *_myinfo,void *_addr,int32_t *delaymillisp,char *senderip,uint8_t *data,int32_t datalen,char *type,int32_t encrypted) { - uint32_t ipbits,basilisktag; int32_t i,havepubkey,msglen,len=0; void *ptr = 0; uint8_t space[8192]; bits256 senderpub,pubkey; struct supernet_info *myinfo = _myinfo; + uint32_t ipbits,basilisktag; int32_t i,havepubkey,msglen,len=0; void *ptr = 0; uint8_t space[8192]; bits256 senderpub,pubkey,hash,hash2; struct supernet_info *myinfo = _myinfo; pubkey = GENESIS_PUBKEY; if ( encrypted != 0 ) { @@ -215,6 +230,10 @@ void basilisk_p2p(void *_myinfo,void *_addr,int32_t *delaymillisp,char *senderip len += iguana_rwnum(0,&data[len],sizeof(basilisktag),&basilisktag); if ( datalen > len && (havepubkey= data[len]) != 0 ) { + vcalc_sha256(0,hash.bytes,&data[len],datalen - len); + hash.uints[0] = basilisktag; + vcalc_sha256(0,hash2.bytes,hash.bytes,sizeof(hash)); + char str[65]; printf("tag.%u %s\n",basilisktag,bits256_str(str,hash2)); for (i=0; i<32; i++) pubkey.bytes[i] = data[len + i + 1]; } @@ -268,12 +287,11 @@ uint8_t *basilisk_jsondata(void **ptrp,uint8_t *space,int32_t spacesize,int32_t return(data); } -struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,int32_t *numsentp,char *CMD,char *symbol,cJSON *valsobj,int32_t fanout,int32_t minresults,uint32_t basilisktag,int32_t timeoutmillis,void *_metricfunc,char *retstr,int32_t encryptflag,int32_t delaymillis) +struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,int32_t *numsentp,char *CMD,char *symbol,cJSON *valsobj,int32_t fanout,int32_t minresults,uint32_t basilisktag,int32_t timeoutmillis,void *_metricfunc,char *retstr,int32_t encryptflag,int32_t delaymillis,uint32_t nBits) { struct basilisk_item *ptr; void *allocptr; uint8_t *data,space[4096]; int32_t datalen; basilisk_metricfunc metricfunc = _metricfunc; - if ( basilisktag == 0 ) - basilisktag = rand(); ptr = basilisk_itemcreate(myinfo,CMD,symbol,basilisktag,minresults,valsobj,timeoutmillis,metricfunc); + ptr->nBits = nBits; *numsentp = 0; if ( retstr != 0 ) { @@ -285,7 +303,7 @@ struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,int32_t else { data = basilisk_jsondata(&allocptr,space,sizeof(space),&datalen,symbol,valsobj,basilisktag); - *numsentp = ptr->numsent = basilisk_sendcmd(myinfo,0,CMD,basilisktag,encryptflag,delaymillis,data,datalen,0); + *numsentp = ptr->numsent = basilisk_sendcmd(myinfo,0,CMD,&ptr->basilisktag,encryptflag,delaymillis,data,datalen,0,ptr->nBits); if ( allocptr != 0 ) free(allocptr); } @@ -294,11 +312,9 @@ struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,int32_t return(ptr); } -struct basilisk_item *basilisk_requestservice(struct basilisk_item *Lptr,struct supernet_info *myinfo,char *CMD,uint32_t basilisktag,cJSON *valsobj,bits256 pubkey) +struct basilisk_item *basilisk_requestservice(struct basilisk_item *Lptr,struct supernet_info *myinfo,char *CMD,uint32_t basilisktag,cJSON *valsobj,bits256 pubkey,uint32_t nBits) { int32_t minresults,timeoutmillis,numsent,delaymillis,encryptflag; - if ( basilisktag == 0 ) - OS_randombytes((void *)&basilisktag,sizeof(basilisktag)); if ( jobj(valsobj,"pubkey") != 0 ) jdelete(valsobj,"pubkey"); if ( bits256_cmp(pubkey,GENESIS_PUBKEY) != 0 ) @@ -309,7 +325,7 @@ struct basilisk_item *basilisk_requestservice(struct basilisk_item *Lptr,struct timeoutmillis = BASILISK_TIMEOUT; encryptflag = jint(valsobj,"encrypt"); delaymillis = jint(valsobj,"delay"); - return(basilisk_issueremote(myinfo,&numsent,CMD,"BTCD",valsobj,1,minresults,basilisktag,timeoutmillis,0,0,encryptflag,delaymillis)); + return(basilisk_issueremote(myinfo,&numsent,CMD,"BTCD",valsobj,1,minresults,basilisktag,timeoutmillis,0,0,encryptflag,delaymillis,nBits)); } void basilisk_sendback(struct supernet_info *myinfo,char *symbol,char *remoteaddr,uint32_t basilisktag,char *retstr) @@ -322,7 +338,7 @@ void basilisk_sendback(struct supernet_info *myinfo,char *symbol,char *remoteadd { data = basilisk_jsondata(&allocptr,space,sizeof(space),&datalen,symbol,valsobj,basilisktag); printf("send data.%d\n",datalen); - basilisk_sendcmd(myinfo,remoteaddr,"RET",basilisktag,encryptflag,delaymillis,data,datalen,0); + basilisk_sendcmd(myinfo,remoteaddr,"RET",&basilisktag,encryptflag,delaymillis,data,datalen,0,0x1efffff0); if ( allocptr != 0 ) free(allocptr); free_json(valsobj); @@ -793,7 +809,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *addr,uint32_t sender if ( myinfo->IAMRELAY != 0 ) // iguana node { if ( from_basilisk != 0 ) - basilisk_sendcmd(myinfo,0,cmd,rand(),0,0,origdata,origlen,-1); // to other iguanas + basilisk_sendcmd(myinfo,0,cmd,&basilisktag,0,0,origdata,origlen,-1,0x1efffff0); // to other iguanas if ( (retstr= (*basilisk_services[i][1])(myinfo,type,addr,remoteaddr,basilisktag,valsobj,data,datalen,pubkey,from_basilisk)) != 0 ) { printf("from_basilisk.%d ret.(%s)\n",from_basilisk,retstr); diff --git a/basilisk/basilisk.h b/basilisk/basilisk.h index 8c826d170..bfb38f87f 100755 --- a/basilisk/basilisk.h +++ b/basilisk/basilisk.h @@ -27,7 +27,7 @@ struct basilisk_value { bits256 txid; int64_t value; int32_t height; int16_t vou struct basilisk_item { struct queueitem DL; UT_hash_handle hh; struct basilisk_item *parent; void *dependents; - uint32_t submit,finished,basilisktag,numresults,numsent,numexact,uniqueflag,numrequired,childrendone,numchildren; + uint32_t submit,finished,basilisktag,numresults,numsent,numexact,uniqueflag,numrequired,childrendone,numchildren,nBits; char symbol[32],CMD[4]; double expiration; cJSON *vals; int32_t metricdir; void *metricfunc; char *retstr,*results[BASILISK_MAXFANOUT]; double metrics[BASILISK_MAXFANOUT]; }; @@ -42,7 +42,7 @@ struct basilisk_info void basilisk_msgprocess(struct supernet_info *myinfo,void *addr,uint32_t senderipbits,char *type,uint32_t basilisktag,uint8_t *data,int32_t datalen,bits256 pubkey); void basilisks_init(struct supernet_info *myinfo); -int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *type,uint32_t basilisktag,int32_t encryptflag,int32_t delaymillis,uint8_t *data,int32_t datalen,int32_t fanout); // data must be offset by sizeof(iguana_msghdr) +int32_t basilisk_sendcmd(struct supernet_info *myinfo,char *destipaddr,char *type,uint32_t *basilisktagp,int32_t encryptflag,int32_t delaymillis,uint8_t *data,int32_t datalen,int32_t fanout,uint32_t nBits); // data must be offset by sizeof(iguana_msghdr) void basilisk_p2p(void *myinfo,void *_addr,int32_t *delaymillisp,char *ipaddr,uint8_t *data,int32_t datalen,char *type,int32_t encrypted); uint8_t *basilisk_jsondata(void **ptrp,uint8_t *space,int32_t spacesize,int32_t *datalenp,char *symbol,cJSON *sendjson,uint32_t basilisktag); diff --git a/basilisk/basilisk_CMD.c b/basilisk/basilisk_CMD.c index d1b0eeb81..162ca0dde 100755 --- a/basilisk/basilisk_CMD.c +++ b/basilisk/basilisk_CMD.c @@ -27,7 +27,7 @@ void basilisk_request_goodbye(struct supernet_info *myinfo) { struct basilisk_item Lptr; cJSON *valsobj = cJSON_CreateObject(); jaddnum(valsobj,"timeout",-1); - basilisk_requestservice(&Lptr,myinfo,"BYE",0,valsobj,GENESIS_PUBKEY); + basilisk_requestservice(&Lptr,myinfo,"BYE",0,valsobj,GENESIS_PUBKEY,0x1efffff0); free_json(valsobj); } @@ -63,7 +63,7 @@ char *basilisk_respond_setfield(struct supernet_info *myinfo,char *CMD,struct ig struct basilisk_item *basilisk_request_setfield(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"SET",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"SET",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_getfield(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 prevhash,int32_t from_basilisk) @@ -104,7 +104,7 @@ struct basilisk_item *basilisk_request_getfield(struct basilisk_item *Lptr,struc if ( (category= jstr(valsobj,"category")) == 0 ) return(0); vcalc_sha256(0,cathash.bytes,(uint8_t *)category,(int32_t)strlen(category)); - return(basilisk_requestservice(Lptr,myinfo,"GET",0,valsobj,prevhash)); + return(basilisk_requestservice(Lptr,myinfo,"GET",0,valsobj,prevhash,0x1efffff0)); } char *basilisk_respond_publish(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -116,7 +116,7 @@ char *basilisk_respond_publish(struct supernet_info *myinfo,char *CMD,struct igu struct basilisk_item *basilisk_request_publish(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"PUB",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"PUB",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_subscribe(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -128,7 +128,7 @@ char *basilisk_respond_subscribe(struct supernet_info *myinfo,char *CMD,struct i struct basilisk_item *basilisk_request_subscribe(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"SUB",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"SUB",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_dispatch(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -139,7 +139,7 @@ char *basilisk_respond_dispatch(struct supernet_info *myinfo,char *CMD,struct ig struct basilisk_item *basilisk_request_dispatch(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"RUN",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"RUN",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_addrelay(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -150,7 +150,7 @@ char *basilisk_respond_addrelay(struct supernet_info *myinfo,char *CMD,struct ig struct basilisk_item *basilisk_request_addrelay(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"ADD",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"ADD",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_forward(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -161,7 +161,7 @@ char *basilisk_respond_forward(struct supernet_info *myinfo,char *CMD,struct igu struct basilisk_item *basilisk_request_forward(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"HOP",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"HOP",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_mailbox(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -172,7 +172,7 @@ char *basilisk_respond_mailbox(struct supernet_info *myinfo,char *CMD,struct igu struct basilisk_item *basilisk_request_mailbox(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"BOX",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"BOX",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_VPNcreate(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -183,7 +183,7 @@ char *basilisk_respond_VPNcreate(struct supernet_info *myinfo,char *CMD,struct i struct basilisk_item *basilisk_request_VPNcreate(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"HUB",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"HUB",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_VPNjoin(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -194,7 +194,7 @@ char *basilisk_respond_VPNjoin(struct supernet_info *myinfo,char *CMD,struct igu struct basilisk_item *basilisk_request_VPNjoin(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"ARC",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"ARC",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_VPNlogout(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -205,7 +205,7 @@ char *basilisk_respond_VPNlogout(struct supernet_info *myinfo,char *CMD,struct i struct basilisk_item *basilisk_request_VPNlogout(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"END",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"END",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_VPNbroadcast(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -216,7 +216,7 @@ char *basilisk_respond_VPNbroadcast(struct supernet_info *myinfo,char *CMD,struc struct basilisk_item *basilisk_request_VPNbroadcast(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"SAY",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"SAY",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_VPNreceive(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -227,7 +227,7 @@ char *basilisk_respond_VPNreceive(struct supernet_info *myinfo,char *CMD,struct struct basilisk_item *basilisk_request_VPNreceive(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"EAR",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"EAR",0,valsobj,pubkey,0x1efffff0)); } char *basilisk_respond_VPNmessage(struct supernet_info *myinfo,char *CMD,struct iguana_peer *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 pubkey,int32_t from_basilisk) @@ -238,7 +238,7 @@ char *basilisk_respond_VPNmessage(struct supernet_info *myinfo,char *CMD,struct struct basilisk_item *basilisk_request_VPNmessage(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 pubkey,cJSON *valsobj,uint8_t *data,int32_t datalen) { - return(basilisk_requestservice(Lptr,myinfo,"GAP",0,valsobj,pubkey)); + return(basilisk_requestservice(Lptr,myinfo,"GAP",0,valsobj,pubkey,0x1efffff0)); } diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index ece76a18d..ab7f648cf 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -362,12 +362,12 @@ void *basilisk_bitcoinvalue(struct basilisk_item *Lptr,struct supernet_info *myi if ( v->vout == vout && bits256_cmp(txid,v->txid) == 0 && strcmp(v->coinaddr,coinaddr) == 0 ) { printf("bitcoinvalue local ht.%d %s %.8f\n",v->height,v->coinaddr,dstr(v->value)); - return(basilisk_issueremote(myinfo,&numsent,"VAL",coin->symbol,valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_valuemetric,basilisk_valuestr(coin,v->coinaddr,v->value,v->height,txid,vout),0,0)); + return(basilisk_issueremote(myinfo,&numsent,"VAL",coin->symbol,valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_valuemetric,basilisk_valuestr(coin,v->coinaddr,v->value,v->height,txid,vout),0,0,0x1efffff0)); } } } printf("bitcoinvalue issue remote\n"); - return(basilisk_issueremote(myinfo,&numsent,"VAL",coin->symbol,valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_valuemetric,0,0,0)); + return(basilisk_issueremote(myinfo,&numsent,"VAL",coin->symbol,valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_valuemetric,0,0,0,0x1efffff0)); } double basilisk_bitcoin_rawtxmetric_dependents(struct supernet_info *myinfo,struct iguana_info *coin,struct basilisk_item *ptr,struct bitcoin_rawtxdependents *dependents) @@ -628,6 +628,6 @@ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myi Lptr->retstr = clonestr("{\"error\":\"couldnt create rawtx\"}"); return(Lptr); } - return(basilisk_issueremote(myinfo,&numsent,"RAW",coin->symbol,valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_rawtxmetric,0,0,0)); + return(basilisk_issueremote(myinfo,&numsent,"RAW",coin->symbol,valsobj,juint(valsobj,"fanout"),juint(valsobj,"minresults"),basilisktag,timeoutmillis,coin->basilisk_rawtxmetric,0,0,0,0x1efffff0)); } diff --git a/crypto777/iguana_utils.c b/crypto777/iguana_utils.c index dfcdb75c3..222417d1c 100755 --- a/crypto777/iguana_utils.c +++ b/crypto777/iguana_utils.c @@ -90,7 +90,7 @@ bits256 bits256_add(bits256 a,bits256 b) int32_t bits256_cmp(bits256 a,bits256 b) { int32_t i; - for (i=0; i<4; i++) + for (i=3; i>=0; i--) { if ( a.ulongs[i] > b.ulongs[i] ) return(1); diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index b51048013..8fcc535f8 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -474,7 +474,7 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o jaddbits256(sendjson,"categoryhash",myinfo->instantdex_category); jaddbits256(sendjson,"traderpub",myinfo->myaddr.persistent); data = basilisk_jsondata(&allocptr,space,sizeof(space),&datalen,swap->mine.offer.base,sendjson,basilisktag); - basilisk_sendcmd(myinfo,addr->ipaddr,dir > 0 ? "BID" : "ASK",basilisktag,encryptflag,delaymillis,data,datalen,1); + basilisk_sendcmd(myinfo,addr->ipaddr,dir > 0 ? "BID" : "ASK",&basilisktag,encryptflag,delaymillis,data,datalen,1,0x1efffff0); free_json(sendjson); if ( allocptr != 0 ) free(allocptr);