From e3778e93decc9f24111ef88d78875219e81c5775 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 May 2016 22:19:00 -0500 Subject: [PATCH] test --- iguana/SuperNET.h | 2 +- iguana/SuperNET_category.c | 21 +++++++++++++++++++-- iguana/iguana_payments.c | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/iguana/SuperNET.h b/iguana/SuperNET.h index a09c8ccd9..732862871 100755 --- a/iguana/SuperNET.h +++ b/iguana/SuperNET.h @@ -80,7 +80,7 @@ struct supernet_info char ipaddr[64],transport[8]; int32_t APISLEEP; int32_t iamrelay; uint32_t expiration,dirty; int32_t Debuglevel,readyflag,dead,POLLTIMEOUT; char rpcsymbol[16],LBpoint[64],PUBpoint[64]; //int32_t pullsock,subclient,lbclient,lbserver,servicesock,pubglobal,pubrelays,numservers; - bits256 privkey,persistent_priv,BTCmarkerhash,instantdex_category,pangea_category; + bits256 privkey,persistent_priv,BTCmarkerhash,instantdex_category,pangea_category,bitcoin_category; char secret[2048],NXTAPIURL[512],permanentfile[1024]; uint8_t *recvbuf[6]; struct supernet_address myaddr; diff --git a/iguana/SuperNET_category.c b/iguana/SuperNET_category.c index f8c570169..5552d2795 100755 --- a/iguana/SuperNET_category.c +++ b/iguana/SuperNET_category.c @@ -202,9 +202,22 @@ char *SuperNET_categorymulticast(struct supernet_info *myinfo,int32_t surveyflag return(retstr); } +char *bitcoin_hexmsg(struct supernet_info *myinfo,struct category_info *cat,void *ptr,int32_t len,char *remoteaddr) +{ + char buf[IGUANA_MAXSCRIPTSIZE],*method="",*agent="",*retstr = 0; cJSON *json; + decode_hex((uint8_t *)buf,len,ptr); + if ( (json= cJSON_Parse(buf)) != 0 ) + { + agent = jstr(json,"agent"); + method = jstr(json,"method"); + } + printf("bitcoin_hexmsg.(%s) from %s (%s/%s)\n",buf,remoteaddr,agent,method); + return(retstr); +} + void category_init(struct supernet_info *myinfo) { - bits256 pangeahash,instantdexhash; + bits256 pangeahash,instantdexhash,bitcoinhash; category_subscribe(myinfo,GENESIS_PUBKEY,GENESIS_PUBKEY); pangeahash = calc_categoryhashes(0,"pangea",0); myinfo->pangea_category = pangeahash; @@ -217,5 +230,9 @@ void category_init(struct supernet_info *myinfo) category_processfunc(instantdexhash,GENESIS_PUBKEY,InstantDEX_hexmsg); category_processfunc(instantdexhash,myinfo->myaddr.persistent,InstantDEX_hexmsg); - //exchanges777_init(myinfo,0,0); + bitcoinhash = calc_categoryhashes(0,"InstantDEX",0); + myinfo->bitcoin_category = bitcoinhash; + category_subscribe(myinfo,bitcoinhash,GENESIS_PUBKEY); + category_processfunc(bitcoinhash,GENESIS_PUBKEY,bitcoin_hexmsg); + category_processfunc(bitcoinhash,myinfo->myaddr.persistent,bitcoin_hexmsg); } diff --git a/iguana/iguana_payments.c b/iguana/iguana_payments.c index cc5b9520b..95181633e 100755 --- a/iguana/iguana_payments.c +++ b/iguana/iguana_payments.c @@ -418,6 +418,7 @@ char *iguana_rawtxissue(struct supernet_info *myinfo,uint32_t rawtxtag,char *sym jaddstr(reqjson,"agent","SuperNET"); jaddstr(reqjson,"method","DHT"); jaddnum(reqjson,"plaintext",1); + jaddbits256(reqjson,"category",myinfo->bitcoin_category); jaddnum(reqjson,"request",1); jaddnum(reqjson,"timeout",5000); jaddstr(reqjson,"hexmsg",(char *)buf);