|
|
@ -572,6 +572,8 @@ char *LP_connectedalice(cJSON *argjson) // alice |
|
|
|
return(clonestr("{\"result\",\"update stats\"}")); |
|
|
|
} |
|
|
|
printf("CONNECTED.(%s) numpending.%d tradeid.%u requestid.%u quoteid.%u\n",jprint(argjson,0),G.LP_pendingswaps,Q.tradeid,Q.R.requestid,Q.R.quoteid); |
|
|
|
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); |
|
|
|
printf("calculated requestid.%u quoteid.%u\n",Q.R.requestid,Q.R.quoteid); |
|
|
|
if ( LP_pendingswap(Q.R.requestid,Q.R.quoteid) > 0 ) |
|
|
|
{ |
|
|
|
printf("requestid.%u quoteid.%u is already in progres\n",Q.R.requestid,Q.R.quoteid); |
|
|
@ -622,7 +624,6 @@ char *LP_connectedalice(cJSON *argjson) // alice |
|
|
|
if ( bits256_nonz(Q.privkey) != 0 )//&& Q.quotetime >= Q.timestamp-3 )
|
|
|
|
{ |
|
|
|
retjson = cJSON_CreateObject(); |
|
|
|
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); |
|
|
|
if ( (swap= LP_swapinit(0,0,Q.privkey,&Q.R,&Q)) == 0 ) |
|
|
|
{ |
|
|
|
jaddstr(retjson,"error","couldnt swapinit"); |
|
|
@ -771,7 +772,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *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_tradecommand_log(argjson); |
|
|
|
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); |
|
|
|
printf("(%u-%u): received %12s aliceid.%22llu %5s/%-5s %12.8f -> %12.8f price %12.8f\n",Q.R.requestid,Q.R.quoteid,method,(long long)Q.aliceid,Q.srccoin,Q.destcoin,dstr(Q.satoshis),dstr(Q.destsatoshis),(double)Q.destsatoshis/Q.satoshis); |
|
|
|
retval = 1; |
|
|
|
autxo = &A; |
|
|
|
butxo = &B; |
|
|
|