Browse Source

Test

etomic
jl777 7 years ago
parent
commit
3c1fc577da
  1. 10
      iguana/exchanges/LP_ordermatch.c
  2. 2
      iguana/exchanges/LP_stats.c

10
iguana/exchanges/LP_ordermatch.c

@ -34,7 +34,7 @@ double LP_bob_competition(int32_t *counterp,uint64_t aliceid,double price,int32_
{ {
if ( now > Bob_competition[i].starttime+LP_AUTOTRADE_TIMEOUT ) if ( now > Bob_competition[i].starttime+LP_AUTOTRADE_TIMEOUT )
{ {
//printf("aliceid.%llx expired\n",(long long)aliceid); //printf("aliceid.%llu expired\n",(long long)aliceid);
Bob_competition[i].bestprice = 0.; Bob_competition[i].bestprice = 0.;
Bob_competition[i].starttime = now; Bob_competition[i].starttime = now;
Bob_competition[i].counter = 0; Bob_competition[i].counter = 0;
@ -42,7 +42,7 @@ double LP_bob_competition(int32_t *counterp,uint64_t aliceid,double price,int32_
if ( price != 0. && (Bob_competition[i].bestprice == 0. || price < Bob_competition[i].bestprice) ) if ( price != 0. && (Bob_competition[i].bestprice == 0. || price < Bob_competition[i].bestprice) )
{ {
Bob_competition[i].bestprice = price; Bob_competition[i].bestprice = price;
//printf("Bob competition aliceid.%llx <- bestprice %.8f\n",(long long)aliceid,price); //printf("Bob competition aliceid.%llu <- bestprice %.8f\n",(long long)aliceid,price);
} }
Bob_competition[i].counter += counter; Bob_competition[i].counter += counter;
*counterp = Bob_competition[i].counter; *counterp = Bob_competition[i].counter;
@ -58,7 +58,7 @@ double LP_bob_competition(int32_t *counterp,uint64_t aliceid,double price,int32_
Bob_competition[firsti].aliceid = aliceid; Bob_competition[firsti].aliceid = aliceid;
Bob_competition[firsti].bestprice = price; Bob_competition[firsti].bestprice = price;
*counterp = counter; *counterp = counter;
//printf("Bob competition aliceid.%llx %.8f\n",(long long)aliceid,price); //printf("Bob competition aliceid.%llu %.8f\n",(long long)aliceid,price);
return(price); return(price);
} }
@ -720,7 +720,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
LP_quoteparse(&Q,argjson); LP_quoteparse(&Q,argjson);
LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-Q.txfee,Q.destcoin,Q.destsatoshis-Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector); LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-Q.txfee,Q.destcoin,Q.destsatoshis-Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector);
LP_tradecommand_log(argjson); LP_tradecommand_log(argjson);
printf("LP_tradecommand: check received method %12s aliceid.%16llx %5s/%-5s %12.8f -> %12.8f price %12.8f\n",method,(long long)Q.aliceid,Q.srccoin,Q.destcoin,dstr(Q.satoshis),dstr(Q.destsatoshis),(double)Q.destsatoshis/Q.satoshis); printf("LP_tradecommand: received %12s aliceid.%22llu %5s/%-5s %12.8f -> %12.8f price %12.8f\n",method,(long long)Q.aliceid,Q.srccoin,Q.destcoin,dstr(Q.satoshis),dstr(Q.destsatoshis),(double)Q.destsatoshis/Q.satoshis);
retval = 1; retval = 1;
autxo = &A; autxo = &A;
butxo = &B; butxo = &B;
@ -732,7 +732,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
if ( strcmp(method,"reserved") == 0 ) if ( strcmp(method,"reserved") == 0 )
{ {
bestprice = LP_bob_competition(&counter,aliceid,qprice,1); bestprice = LP_bob_competition(&counter,aliceid,qprice,1);
//printf("aliceid.%llx price %.8f -> bestprice %.8f\n",(long long)aliceid,qprice,bestprice); //printf("aliceid.%llu price %.8f -> bestprice %.8f\n",(long long)aliceid,qprice,bestprice);
if ( LP_Alicemaxprice == 0. ) if ( LP_Alicemaxprice == 0. )
return(retval); return(retval);
if ( bits256_nonz(LP_Alicedestpubkey) != 0 ) if ( bits256_nonz(LP_Alicedestpubkey) != 0 )

2
iguana/exchanges/LP_stats.c

@ -209,7 +209,7 @@ int32_t LP_swapstats_update(struct LP_swapstats *sp,struct LP_quoteinfo *qp,cJSO
else else
{ {
if ( requestid == sp->Q.R.requestid && quoteid == sp->Q.R.quoteid ) if ( requestid == sp->Q.R.requestid && quoteid == sp->Q.R.quoteid )
printf("mismatched tradestatus aliceid.%016llx b%s/%s r%s/%s r%u/%u q%u/%u %.8f/%.8f -> %.8f/%.8f\n",(long long)sp->aliceid,base,sp->Q.srccoin,rel,sp->Q.destcoin,requestid,sp->Q.R.requestid,quoteid,sp->Q.R.quoteid,dstr(satoshis+2*sp->Q.txfee),dstr(sp->Q.satoshis),dstr(destsatoshis+2*sp->Q.desttxfee),dstr(sp->Q.destsatoshis)); printf("mismatched tradestatus aliceid.%22llu b%s/%s r%s/%s r%u/%u q%u/%u %.8f/%.8f -> %.8f/%.8f\n",(long long)sp->aliceid,base,sp->Q.srccoin,rel,sp->Q.destcoin,requestid,sp->Q.R.requestid,quoteid,sp->Q.R.quoteid,dstr(satoshis+2*sp->Q.txfee),dstr(sp->Q.satoshis),dstr(destsatoshis+2*sp->Q.desttxfee),dstr(sp->Q.destsatoshis));
return(-1); return(-1);
} }

Loading…
Cancel
Save