Browse Source

Test

etomic
jl777 7 years ago
parent
commit
6af7acf8fe
  1. 41
      iguana/exchanges/LP_remember.c

41
iguana/exchanges/LP_remember.c

@ -1044,21 +1044,26 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid)
//,statebits; int32_t optionduration; struct basilisk_request R; bits256 privkey; //,statebits; int32_t optionduration; struct basilisk_request R; bits256 privkey;
retjson = cJSON_CreateObject(); retjson = cJSON_CreateObject();
array = cJSON_CreateArray(); array = cJSON_CreateArray();
sprintf(fname,"%s/SWAPS/list",GLOBAL_DBDIR), OS_compatible_path(fname); if ( origrequestid != 0 && origquoteid != 0 )
if ( (fp= fopen(fname,"rb")) != 0 )
{ {
//struct basilisk_swap *swap; if ( (item= basilisk_remember(KMDtotals,BTCtotals,origrequestid,origquoteid)) != 0 )
int32_t flag = 0; jaddi(array,item);
while ( fread(&requestid,1,sizeof(requestid),fp) == sizeof(requestid) && fread(&quoteid,1,sizeof(quoteid),fp) == sizeof(quoteid) ) }
else
{
sprintf(fname,"%s/SWAPS/list",GLOBAL_DBDIR), OS_compatible_path(fname);
if ( (fp= fopen(fname,"rb")) != 0 )
{ {
flag = 0; //struct basilisk_swap *swap;
for (i=0; i<G.LP_numskips; i++) int32_t flag = 0;
while ( fread(&requestid,1,sizeof(requestid),fp) == sizeof(requestid) && fread(&quoteid,1,sizeof(quoteid),fp) == sizeof(quoteid) )
{ {
r = (uint32_t)(G.LP_skipstatus[i] >> 32); flag = 0;
q = (uint32_t)G.LP_skipstatus[i]; for (i=0; i<G.LP_numskips; i++)
if ( r == requestid && q == quoteid )
{ {
if ( r != origrequestid || q != origquoteid ) r = (uint32_t)(G.LP_skipstatus[i] >> 32);
q = (uint32_t)G.LP_skipstatus[i];
if ( r == requestid && q == quoteid )
{ {
item = cJSON_CreateObject(); item = cJSON_CreateObject();
jaddstr(item,"status","realtime"); jaddstr(item,"status","realtime");
@ -1066,21 +1071,17 @@ char *basilisk_swaplist(uint32_t origrequestid,uint32_t origquoteid)
jaddnum(item,"quoteid",q); jaddnum(item,"quoteid",q);
jaddi(array,item); jaddi(array,item);
flag = 1; flag = 1;
break;
} }
break;
} }
} if ( flag == 0 )
if ( flag == 0 )
{
if ( (item= basilisk_remember(KMDtotals,BTCtotals,requestid,quoteid)) != 0 )
{ {
jaddi(array,item); if ( (item= basilisk_remember(KMDtotals,BTCtotals,requestid,quoteid)) != 0 )
//if ( (status= jstr(item,"status")) != 0 && strcmp(status,"pending") == 0 ) jaddi(array,item);
// break;
} }
} }
fclose(fp);
} }
fclose(fp);
} }
jaddstr(retjson,"result","success"); jaddstr(retjson,"result","success");
jadd(retjson,"swaps",array); jadd(retjson,"swaps",array);

Loading…
Cancel
Save