Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f2ca03680c
  1. 12
      iguana/iguana_instantdex.c
  2. 6
      iguana/main.c

12
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

6
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);

Loading…
Cancel
Save