Browse Source

Pending only to return null if .finished

patch-3
jl777 7 years ago
parent
commit
68574e5535
  1. 2
      iguana/exchanges/LP_remember.c
  2. 20
      iguana/exchanges/LP_swap.c
  3. 4
      iguana/exchanges/prices/bet

2
iguana/exchanges/LP_remember.c

@ -983,6 +983,8 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
if ( (retjson= cJSON_Parse(fstr)) != 0 ) if ( (retjson= cJSON_Parse(fstr)) != 0 )
{ {
free(fstr); free(fstr);
if ( pendingonly != 0 )
free_json(retjson), retjson = 0;
return(retjson); return(retjson);
} }
free(fstr); free(fstr);

20
iguana/exchanges/LP_swap.c

@ -728,8 +728,11 @@ uint32_t LP_swapdata_rawtxsend(int32_t pairsock,struct basilisk_swap *swap,uint3
int32_t LP_swapwait(struct basilisk_swap *swap,uint32_t requestid,uint32_t quoteid,int32_t duration,int32_t sleeptime) int32_t LP_swapwait(struct basilisk_swap *swap,uint32_t requestid,uint32_t quoteid,int32_t duration,int32_t sleeptime)
{ {
char *retstr; cJSON *retjson=0; uint32_t expiration = (uint32_t)(time(NULL) + duration); char *retstr; cJSON *retjson=0; uint32_t expiration = (uint32_t)(time(NULL) + duration);
printf("wait %d:%d for SWAP.(r%u/q%u) to complete\n",duration,sleeptime,requestid,quoteid); if ( sleeptime != 0 )
sleep(sleeptime/3); {
printf("wait %d:%d for SWAP.(r%u/q%u) to complete\n",duration,sleeptime,requestid,quoteid);
sleep(sleeptime/3);
}
while ( time(NULL) < expiration ) while ( time(NULL) < expiration )
{ {
if ( (retstr= basilisk_swapentry(requestid,quoteid,1)) != 0 ) if ( (retstr= basilisk_swapentry(requestid,quoteid,1)) != 0 )
@ -749,22 +752,25 @@ int32_t LP_swapwait(struct basilisk_swap *swap,uint32_t requestid,uint32_t quote
} }
free(retstr); free(retstr);
} }
sleep(sleeptime); if ( sleeptime != 0 )
sleep(sleeptime);
if ( duration < 0 )
break;
} }
if ( retjson != 0 ) if ( retjson != 0 )
{ {
printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>\nSWAP completed! %u-%u %s\n",requestid,quoteid,jprint(retjson,0));
free_json(retjson); free_json(retjson);
if ( 0 && (retstr= basilisk_swapentry(requestid,quoteid,1)) != 0 ) if ( (retstr= basilisk_swapentry(requestid,quoteid,1)) != 0 )
{ {
printf("second call.(%s)\n",retstr); printf("\n>>>>>>>>>>>>>>>>>>>>>>>>>\nSWAP completed! %u-%u %s\n",requestid,quoteid,retstr);
free(retstr); free(retstr);
} }
return(0); return(0);
} }
else else
{ {
printf("\nSWAP did not complete! %u-%u %s\n",requestid,quoteid,jprint(retjson,0)); if ( time(NULL) > swap->I.expiration )
printf("\nSWAP did not complete! %u-%u %s\n",requestid,quoteid,jprint(retjson,0));
return(-1); return(-1);
} }
} }

4
iguana/exchanges/prices/bet

@ -1,3 +1,3 @@
coin=BET coin=BET
price=0.0005 price=0.00075
invprice=2000 invprice=1333.33

Loading…
Cancel
Save