diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index d594eb29c..efe3720c9 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -962,8 +962,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *addr,uint32_t sender // unencrypted low level functions, used by higher level protocols and virtual network funcs { (void *)"ADD", &basilisk_respond_addrelay }, // relays register with each other bus - { (void *)"BID", &basilisk_respond_bid }, - { (void *)"ASK", &basilisk_respond_ask }, + { (void *)"DEX", &basilisk_respond_instantdex }, // encrypted data for jumblr { (void *)"HOP", &basilisk_respond_forward }, // message forwarding diff --git a/basilisk/basilisk_CMD.c b/basilisk/basilisk_CMD.c index ee24015a3..3d62cf33b 100755 --- a/basilisk/basilisk_CMD.c +++ b/basilisk/basilisk_CMD.c @@ -32,18 +32,10 @@ void basilisk_request_goodbye(struct supernet_info *myinfo) free_json(valsobj); } -char *basilisk_respond_bid(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash,int32_t from_basilisk) +char *basilisk_respond_instantdex(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash,int32_t from_basilisk) { char *retstr=0; - printf("from.(%s) BID.(%s) datalen.%d\n",remoteaddr,jprint(valsobj,0),datalen); - instantdex_quotep2p(myinfo,0,addr,data,datalen); - return(retstr); -} - -char *basilisk_respond_ask(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash,int32_t from_basilisk) -{ - char *retstr=0; - printf("from.(%s) ASK.(%s) datalen.%d\n",remoteaddr,jprint(valsobj,0),datalen); + printf("from.(%s) DEX.(%s) datalen.%d\n",remoteaddr,jprint(valsobj,0),datalen); instantdex_quotep2p(myinfo,0,addr,data,datalen); return(retstr); } diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index 20bc864cc..ad6f3aa77 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -389,7 +389,7 @@ bits256 instantdex_rwoffer(int32_t rwflag,int32_t *lenp,uint8_t *serialized,stru char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *offer,cJSON *argjson,char *cmdstr,bits256 desthash,int32_t hops,void *extraser,int32_t extralen,struct iguana_peer *addr,struct bitcoin_swapinfo *swap) { - cJSON *sendjson; char *reqstr; struct instantdex_msghdr *msg; bits256 orderhash,tmphash; int32_t i,j,len,dir=0,serflag,olen,slen,datalen; uint8_t *buf,*allocptr,space[4096],serialized[sizeof(*offer) + sizeof(struct iguana_msghdr) + 4096 + INSTANTDEX_DECKSIZE*33]; uint64_t x,nxt64bits; + cJSON *sendjson; char *reqstr; struct instantdex_msghdr *msg; bits256 orderhash,tmphash; int32_t i,j,len,serflag,olen,slen,datalen; uint8_t *buf,*allocptr,space[4096],serialized[sizeof(*offer) + sizeof(struct iguana_msghdr) + 4096 + INSTANTDEX_DECKSIZE*33]; uint64_t x,nxt64bits; orderhash = instantdex_rwoffer(1,&olen,serialized,offer); if ( 1 ) { @@ -466,7 +466,7 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o jaddstr(sendjson,"handle",myinfo->handle); jaddbits256(sendjson,"traderpub",myinfo->myaddr.persistent); data = basilisk_jsondata(sizeof(struct iguana_msghdr),&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_DEFAULTDIFF); + basilisk_sendcmd(myinfo,addr->ipaddr,"DEX",&basilisktag,encryptflag,delaymillis,data,datalen,1,BASILISK_DEFAULTDIFF); free_json(sendjson); if ( allocptr != 0 ) free(allocptr); @@ -1069,14 +1069,15 @@ int32_t instantdex_quotep2p(struct supernet_info *myinfo,struct iguana_info *coi void instantdex_propagate(struct supernet_info *myinfo,struct exchange_info *exchange,struct instantdex_accept *ap) { bits256 orderhash; uint8_t serialized[8192]; int32_t i,len; struct iguana_peer *addr; struct iguana_info *coin; - orderhash = instantdex_rwoffer(1,&len,&serialized[sizeof(struct iguana_msghdr)],&ap->offer); + orderhash = instantdex_rwoffer(1,&len,&serialized[64+sizeof(struct iguana_msghdr)],&ap->offer); if ( (coin= iguana_coinfind("BTCD")) != 0 && coin->peers != 0 && coin->peers->numranked > 0 ) { for (i=0; ipeers->numranked; i++) if ( (addr= coin->peers->ranked[i]) != 0 && addr->supernet != 0 && addr->usock >= 0 && GETBIT(ap->peerhas,addr->addrind) == 0 && strcmp("0.0.0.0",addr->ipaddr) != 0 && strcmp("127.0.0.1",addr->ipaddr) != 0 ) { char str[65]; printf("send quote.(%s) <- [%d] %s %llx\n",addr->ipaddr,len,bits256_str(str,orderhash),(long long)orderhash.txid); - iguana_queue_send(addr,0,serialized,"quote",len); + basilisk_sendcmd(myinfo,addr->ipaddr,"DEX",0,0,0,&serialized[64+sizeof(struct iguana_msghdr)],len,1,BASILISK_DEFAULTDIFF); + //iguana_queue_send(addr,0,serialized,"quote",len); } } }