diff --git a/iguana/SuperNET_category.c b/iguana/SuperNET_category.c index 785f0bd16..0aaff35e6 100644 --- a/iguana/SuperNET_category.c +++ b/iguana/SuperNET_category.c @@ -332,15 +332,11 @@ char *SuperNET_categorymulticast(struct supernet_info *myinfo,int32_t surveyflag void category_init(struct supernet_info *myinfo) { - bits256 pangeahash,instantdexhash; - //exchanges777_init(0); + bits256 pangeahash; category_subscribe(myinfo,GENESIS_PUBKEY,GENESIS_PUBKEY); pangeahash = calc_categoryhashes(0,"pangea",0); category_subscribe(myinfo,pangeahash,GENESIS_PUBKEY); category_processfunc(pangeahash,pangea_hexmsg); category_chain_functions(myinfo,pangeahash,GENESIS_PUBKEY,sizeof(bits256),sizeof(bits256),0,0,0,0); - instantdexhash = calc_categoryhashes(0,"InstantDEX",0); - printf("InstantDEX:\n"); - category_subscribe(myinfo,instantdexhash,GENESIS_PUBKEY); - category_processfunc(instantdexhash,InstantDEX_hexmsg); + exchanges777_init(myinfo,0,0); } diff --git a/iguana/iguana_exchanges.c b/iguana/iguana_exchanges.c index a2727ece7..67246a7c7 100755 --- a/iguana/iguana_exchanges.c +++ b/iguana/iguana_exchanges.c @@ -930,7 +930,8 @@ void exchanges777_init(struct supernet_info *myinfo,cJSON *exchanges,int32_t sle free_json(argjson); } instantdexhash = calc_categoryhashes(0,"InstantDEX",0); - category_subscribe(SuperNET_MYINFO(0),instantdexhash,GENESIS_PUBKEY); + printf("InstantDEX:\n"); + category_subscribe(myinfo,instantdexhash,GENESIS_PUBKEY); category_processfunc(instantdexhash,InstantDEX_hexmsg); } diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index a47179a44..b79c87ed3 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -46,7 +46,7 @@ struct instantdex_msghdr *instantdex_msgcreate(struct supernet_info *myinfo,stru char *instantdex_sendcmd(struct supernet_info *myinfo,cJSON *argjson,char *cmdstr,char *ipaddr,int32_t hops) { - char *reqstr,hexstr[8192]; uint8_t _msg[4096]; uint64_t nxt64bits; int32_t datalen; + char *reqstr,hexstr[8192]; uint8_t _msg[4096]; uint64_t nxt64bits; int32_t i,datalen; bits256 instantdexhash; struct instantdex_msghdr *msg; msg = (struct instantdex_msghdr *)_msg; memset(msg,0,sizeof(*msg)); @@ -55,6 +55,9 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,cJSON *argjson,char *cmdst if ( ipaddr == 0 || ipaddr[0] == 0 || strncmp(ipaddr,"127.0.0.1",strlen("127.0.0.1")) == 0 ) return(clonestr("{\"error\":\"no ipaddr, need to send your ipaddr for now\"}")); jaddstr(argjson,"cmd",cmdstr); + for (i=0; icmd); i++) + if ( (msg->cmd[i]= cmdstr[i]) == 0 ) + break; jaddstr(argjson,"agent","SuperNET"); jaddstr(argjson,"method","DHT"); jaddstr(argjson,"traderip",ipaddr); @@ -223,12 +226,15 @@ char *instantdex_parse(struct supernet_info *myinfo,struct instantdex_msghdr *ms cmdbits = stringbits(msg->cmd); for (i=0; icmd); return(retstr); } @@ -252,7 +258,7 @@ char *InstantDEX_hexmsg(struct supernet_info *myinfo,void *ptr,int32_t len,char else if ( (signerbits= acct777_validate(&msg->sig,acct777_msgprivkey(data,datalen),msg->sig.pubkey)) != 0 ) { flag++; - printf("<<<<<<<<<<<<< sigsize.%ld VALIDATED [%ld] len.%d t%u allocsize.%d (%s) [%d]\n",sizeof(msg->sig),(long)data-(long)msg,datalen,msg->sig.timestamp,msg->sig.allocsize,(char *)msg->serialized,data[datalen-1]); + printf("InstantDEX_hexmsg <<<<<<<<<<<<< sigsize.%ld VALIDATED [%ld] len.%d t%u allocsize.%d (%s) [%d]\n",sizeof(msg->sig),(long)data-(long)msg,datalen,msg->sig.timestamp,msg->sig.allocsize,(char *)msg->serialized,data[datalen-1]); if ( data[datalen-1] == 0 && (argjson= cJSON_Parse((char *)msg->serialized)) != 0 ) retstr = instantdex_parse(myinfo,msg,argjson,remoteaddr,signerbits,data,datalen); else diff --git a/iguana/iguana_rpc.c b/iguana/iguana_rpc.c index 51442ebf5..cd5a97228 100755 --- a/iguana/iguana_rpc.c +++ b/iguana/iguana_rpc.c @@ -962,7 +962,7 @@ void iguana_rpcloop(void *args) sprintf(hdrs,"Content-Length: %8d\r\n",(int32_t)strlen(retstr)); send(sock,hdrs,strlen(hdrs),MSG_NOSIGNAL);*/ char *response,hdrs[1024]; - if ( jsonflag != 0 ) + if ( jsonflag != 0 || postflag != 0 ) { response = malloc(strlen(retstr)+1024+1); sprintf(hdrs,"HTTP/1.1 200 OK\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Credentials: true\r\nAccess-Control-Allow-Methods: GET, POST\r\nCache-Control : no-cache, no-store, must-revalidate\r\nContent-Length : %8d\r\n\r\n",(int32_t)strlen(retstr));