|
@ -225,17 +225,17 @@ char *basilisk_start(struct supernet_info *myinfo,struct basilisk_request *rp,ui |
|
|
{ |
|
|
{ |
|
|
cJSON *retjson; //char msgjsonstr[64];
|
|
|
cJSON *retjson; //char msgjsonstr[64];
|
|
|
//sprintf(rp->message,"{\"state\":%u\"}",statebits);
|
|
|
//sprintf(rp->message,"{\"state\":%u\"}",statebits);
|
|
|
if ( myinfo->RELAYID >= 0 && (bits256_cmp(rp->hash,myinfo->myaddr.persistent) == 0 || bits256_cmp(rp->desthash,myinfo->myaddr.persistent) == 0) ) |
|
|
if ( myinfo->RELAYID < 0 && (bits256_cmp(rp->hash,myinfo->myaddr.persistent) == 0 || bits256_cmp(rp->desthash,myinfo->myaddr.persistent) == 0) ) |
|
|
{ |
|
|
{ |
|
|
printf("START thread to complete %u/%u for (%s %.8f) <- (%s %.8f) q.%u\n",rp->requestid,rp->quoteid,rp->src,dstr(rp->srcamount),rp->dest,dstr(rp->destamount),rp->quoteid); |
|
|
printf("START thread to complete %u/%u for (%s %.8f) <-> (%s %.8f) q.%u\n",rp->requestid,rp->quoteid,rp->src,dstr(rp->srcamount),rp->dest,dstr(rp->destamount),rp->quoteid); |
|
|
if ( basilisk_thread_start(myinfo,rp) != 0 ) |
|
|
if ( basilisk_thread_start(myinfo,rp,statebits) != 0 ) |
|
|
{ |
|
|
{ |
|
|
basilisk_request_enqueue(myinfo,rp); |
|
|
basilisk_request_enqueue(myinfo,rp); |
|
|
return(clonestr("{\"result\":\"started atomic swap thread\"}")); |
|
|
return(clonestr("{\"result\":\"started atomic swap thread\"}")); |
|
|
} |
|
|
} |
|
|
else return(clonestr("{\"error\":\"couldnt atomic swap thread\"}")); |
|
|
else return(clonestr("{\"error\":\"couldnt atomic swap thread\"}")); |
|
|
} |
|
|
} |
|
|
else if ( myinfo->RELAYID < 0 ) |
|
|
else if ( myinfo->RELAYID >= 0 ) |
|
|
{ |
|
|
{ |
|
|
retjson = cJSON_CreateObject(); |
|
|
retjson = cJSON_CreateObject(); |
|
|
jaddstr(retjson,"result","basilisk node needs to start atomic thread locally"); |
|
|
jaddstr(retjson,"result","basilisk node needs to start atomic thread locally"); |
|
@ -572,7 +572,7 @@ INT_ARG(InstantDEX,incoming,requestid) |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
vals = cJSON_CreateObject(); |
|
|
vals = cJSON_CreateObject(); |
|
|
jaddnum(vals,"requestid",requestid); |
|
|
jaddnum(vals,"requestid",(uint32_t)requestid); |
|
|
jaddbits256(vals,"hash",myinfo->myaddr.persistent); |
|
|
jaddbits256(vals,"hash",myinfo->myaddr.persistent); |
|
|
retstr = basilisk_standardservice("RID",myinfo,0,myinfo->myaddr.persistent,vals,"",1); |
|
|
retstr = basilisk_standardservice("RID",myinfo,0,myinfo->myaddr.persistent,vals,"",1); |
|
|
free_json(vals); |
|
|
free_json(vals); |
|
@ -589,8 +589,8 @@ TWO_INTS(InstantDEX,swapstatus,requestid,quoteid) |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
vals = cJSON_CreateObject(); |
|
|
vals = cJSON_CreateObject(); |
|
|
jaddnum(vals,"requestid",requestid); |
|
|
jaddnum(vals,"requestid",(uint32_t)requestid); |
|
|
jaddnum(vals,"quoteid",quoteid); |
|
|
jaddnum(vals,"quoteid",(uint32_t)quoteid); |
|
|
jaddbits256(vals,"hash",myinfo->myaddr.persistent); |
|
|
jaddbits256(vals,"hash",myinfo->myaddr.persistent); |
|
|
retstr = basilisk_standardservice("SWP",myinfo,0,myinfo->myaddr.persistent,vals,"",1); |
|
|
retstr = basilisk_standardservice("SWP",myinfo,0,myinfo->myaddr.persistent,vals,"",1); |
|
|
free_json(vals); |
|
|
free_json(vals); |
|
@ -607,8 +607,8 @@ TWO_INTS(InstantDEX,accept,requestid,quoteid) |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
vals = cJSON_CreateObject(); |
|
|
vals = cJSON_CreateObject(); |
|
|
jaddnum(vals,"quoteid",quoteid); |
|
|
jaddnum(vals,"quoteid",(uint32_t)quoteid); |
|
|
jaddnum(vals,"requestid",requestid); |
|
|
jaddnum(vals,"requestid",(uint32_t)requestid); |
|
|
if ( (retstr= basilisk_standardservice("ACC",myinfo,0,myinfo->myaddr.persistent,vals,"",1)) != 0 ) |
|
|
if ( (retstr= basilisk_standardservice("ACC",myinfo,0,myinfo->myaddr.persistent,vals,"",1)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
/*if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
|
|
/*if ( (retjson= cJSON_Parse(retstr)) != 0 )
|
|
|