From f2ca03680cbdc33f4b5b447236c9f7ba34e393c6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 9 May 2016 21:57:03 -0500 Subject: [PATCH] test --- iguana/iguana_instantdex.c | 12 +++++++++++- iguana/main.c | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index 89d470f78..7ff36188c 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -832,6 +832,11 @@ struct instantdex_accept *instantdex_acceptable(struct supernet_info *myinfo,str { struct instantdex_accept PAD,*ap,*retap = 0; double aveprice;//,retvals[4]; uint64_t minvol,bestprice64 = 0; uint32_t now; int32_t offerdir; + if ( exchange == 0 ) + { + printf("instantdex_acceptable null exchange\n"); + return(0); + } aveprice = 0;//instantdex_avehbla(myinfo,retvals,A->offer.base,A->offer.rel,dstr(A->offer.basevolume64)); now = (uint32_t)time(NULL); memset(&PAD,0,sizeof(PAD)); @@ -1021,6 +1026,11 @@ struct bitcoin_swapinfo *bitcoin_swapinit(struct supernet_info *myinfo,struct ex char *instantdex_checkoffer(struct supernet_info *myinfo,uint64_t *txidp,struct exchange_info *exchange,struct instantdex_accept *myap,cJSON *argjson) { char *retstr = 0; struct instantdex_accept *otherap; struct bitcoin_swapinfo *swap; cJSON *newjson; int32_t isbob = 0; + if ( exchange == 0 ) + { + printf("instantdex_checkoff null exchange\n"); + return(0); + } *txidp = myap->orderid; if ( (otherap= instantdex_acceptable(myinfo,exchange,myap,myap->offer.minperc)) == 0 ) { @@ -1116,7 +1126,7 @@ char *instantdex_parse(struct supernet_info *myinfo,struct instantdex_msghdr *ms A.offer.minperc = 100; if ( strcmp(cmdstr,"BTCoffer") == 0 ) // incoming { - printf("BTCoffer state\n"); + printf("BTCoffer state exchange.%p\n",exchange); if ( (ap= instantdex_acceptable(myinfo,exchange,&A,A.offer.minperc)) != 0 ) { if ( (retstr= instantdex_gotoffer(myinfo,exchange,ap,&A,msg,argjson,remoteaddr,signerbits,serdata,serdatalen)) != 0 ) // adds to statemachine if no error diff --git a/iguana/main.c b/iguana/main.c index 3d23de40f..a520cd5ac 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -287,7 +287,7 @@ char *iguana_blockingjsonstr(struct supernet_info *myinfo,char *jsonstr,uint64_t char *SuperNET_processJSON(struct supernet_info *myinfo,cJSON *json,char *remoteaddr,uint16_t port) { - cJSON *retjson; uint64_t tag; uint32_t timeout; char *jsonstr,*method,*retjsonstr,*retstr = 0; + cJSON *retjson; uint64_t tag; uint32_t timeout; char *jsonstr,*hexmsg,*method,*retjsonstr,*retstr = 0; //char str[65]; printf("processJSON %p %s\n",&myinfo->privkey,bits256_str(str,myinfo->privkey)); if ( json != 0 ) { @@ -298,10 +298,10 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,cJSON *json,char *remote } if ( (timeout= juint(json,"timeout")) == 0 ) timeout = IGUANA_JSONTIMEOUT; - if ( (method= jstr(json,"method")) != 0 && strcmp(method,"DHT") == 0 && remoteaddr != 0 ) + if ( (method= jstr(json,"method")) != 0 && strcmp(method,"DHT") == 0 && remoteaddr != 0 && (hexmsg= jstr(json,"hexmsg")) != 0 ) { printf("hexmsgprocess\n"); - SuperNET_hexmsgprocess(myinfo,0,json,jstr(json,"hexmsg"),remoteaddr); + SuperNET_hexmsgprocess(myinfo,0,json,hexmsg,remoteaddr); return(clonestr("{\"result\":\"processed remote DHT\"}")); } jsonstr = jprint(json,0);