Browse Source

Test

etomic
jl777 7 years ago
parent
commit
402214f45b
  1. 2
      iguana/exchanges/LP_include.h
  2. 10
      iguana/exchanges/LP_instantdex.c
  3. 6
      iguana/exchanges/LP_stats.c

2
iguana/exchanges/LP_include.h

@ -403,7 +403,7 @@ struct LP_swapstats
bits256 bobdeposit,alicepayment,bobpayment,paymentspent,Apaymentspent,depositspent;
double qprice;
uint64_t aliceid;
int32_t bobneeds_dPoW,aliceneeds_dPoW,bob_dPoWheight,alice_dPoWheight;
int32_t bobneeds_dPoW,aliceneeds_dPoW;
uint32_t ind,methodind,finished,expired,lasttime,dPoWfinished;
char alicegui[32],bobgui[32];
};

10
iguana/exchanges/LP_instantdex.c

@ -447,7 +447,7 @@ int64_t LP_myzcredits()
cJSON *LP_swapstats_item(struct LP_swapstats *sp,int32_t iambob)
{
cJSON *item = cJSON_CreateObject();
struct iguana_info *bob,*alice; cJSON *item = cJSON_CreateObject();
jaddnum(item,"iambob",iambob);
jaddnum(item,"aliceid",sp->aliceid);
jaddnum(item,"requestid",sp->Q.R.requestid);
@ -460,15 +460,15 @@ cJSON *LP_swapstats_item(struct LP_swapstats *sp,int32_t iambob)
if ( LP_swap_finished(sp,1) == 0 )
{
jaddnum(item,"finished",sp->finished);
if ( sp->bobneeds_dPoW != 0 )
if ( sp->bobneeds_dPoW != 0 && (bob= LP_coinfind(sp->Q.srccoin)) != 0 )
{
jaddnum(item,"bobneeds_dPoW",sp->bobneeds_dPoW);
jaddnum(item,"bob_dPoWheight",sp->bob_dPoWheight);
jaddnum(item,"bob_dPoWheight",bob->notarized);
}
if ( sp->aliceneeds_dPoW != 0 )
if ( sp->aliceneeds_dPoW != 0 && (alice= LP_coinfind(sp->Q.destcoin)) != 0 )
{
jaddnum(item,"aliceneeds_dPoW",sp->aliceneeds_dPoW);
jaddnum(item,"alice_dPoWheight",sp->alice_dPoWheight);
jaddnum(item,"alice_dPoWheight",alice->notarized);
}
}
return(item);

6
iguana/exchanges/LP_stats.c

@ -279,11 +279,9 @@ int32_t LP_swap_finished(struct LP_swapstats *sp,int32_t dPoWflag)
sp->bobneeds_dPoW = LP_finished_lastheight(sp,1);
if ( alice->isassetchain != 0 )
sp->aliceneeds_dPoW = LP_finished_lastheight(sp,0);
sp->bob_dPoWheight = LP_dPoWheight(bob);
sp->alice_dPoWheight = LP_dPoWheight(alice);
printf("bob needs %d @ %d, alice needs %d @ %d\n",sp->bobneeds_dPoW,sp->bob_dPoWheight,sp->aliceneeds_dPoW,sp->alice_dPoWheight);
printf("bob needs %d @ %d, alice needs %d @ %d\n",sp->bobneeds_dPoW,bob->notarized,sp->aliceneeds_dPoW,alice->notarized);
}
if ( (sp->bobneeds_dPoW == 0 || (sp->bobneeds_dPoW > 1 && sp->bob_dPoWheight >= sp->bobneeds_dPoW)) && (sp->aliceneeds_dPoW == 0 || (sp->aliceneeds_dPoW > 1 && sp->alice_dPoWheight >= sp->aliceneeds_dPoW)) )
if ( (sp->bobneeds_dPoW == 0 || (sp->bobneeds_dPoW > 1 && bob->notarized >= sp->bobneeds_dPoW)) && (sp->aliceneeds_dPoW == 0 || (sp->aliceneeds_dPoW > 1 && alice->notarized >= sp->aliceneeds_dPoW)) )
{
sp->dPoWfinished = (uint32_t)time(NULL);
return(1);

Loading…
Cancel
Save