|
|
@ -838,7 +838,7 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru |
|
|
|
double price,qprice,myprice,bestprice,range,bid,ask; struct iguana_info *coin; struct LP_utxoinfo A,B,*autxo,*butxo; cJSON *reqjson; char str[65]; struct LP_address_utxo *utxos[1000]; int32_t r,counter,max = (int32_t)(sizeof(utxos)/sizeof(*utxos)); |
|
|
|
*newqp = *qp; |
|
|
|
qp = newqp; |
|
|
|
//printf("bob %s received REQUEST.(%llu)\n",bits256_str(str,G.LP_mypub25519),(long long)qp->aliceid);
|
|
|
|
printf("bob %s received REQUEST.(%llu)\n",bits256_str(str,G.LP_mypub25519),(long long)qp->aliceid); |
|
|
|
if ( (coin= LP_coinfind(qp->srccoin)) == 0 ) |
|
|
|
return(0); |
|
|
|
if ( (myprice= LP_trades_bobprice(&bid,&ask,qp)) == 0. ) |
|
|
@ -858,6 +858,7 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru |
|
|
|
memset(&qp->txid,0,sizeof(qp->txid)); |
|
|
|
memset(&qp->txid2,0,sizeof(qp->txid2)); |
|
|
|
qp->vout = qp->vout2 = -1; |
|
|
|
printf("eligible to respond\n"); |
|
|
|
} else return(0); |
|
|
|
if ( qprice > myprice ) |
|
|
|
{ |
|
|
@ -868,7 +869,12 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru |
|
|
|
printf("%llu >>>>>>> qprice %.8f r.%d range %.8f -> %.8f, bestprice %.8f counter.%d\n",(long long)qp->aliceid,qprice,r,range,price,bestprice,counter); |
|
|
|
if ( counter > 3 && price > bestprice+SMALLVAL ) // skip if late or bad price
|
|
|
|
return(0); |
|
|
|
} else return(0); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
printf("ignore as qprice %.8f vs myprice %.8f\n",qprice,myprice); |
|
|
|
return(0); |
|
|
|
} |
|
|
|
//LP_RTmetrics_update(qp->srccoin,qp->destcoin);
|
|
|
|
if ( LP_RTmetrics_blacklisted(qp->desthash) >= 0 ) |
|
|
|
{ |
|
|
@ -892,7 +898,7 @@ struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,stru |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//printf("cant find utxopair aliceid.%llu %s/%s %.8f -> relvol %.8f\n",(long long)qp->aliceid,qp->srccoin,qp->destcoin,dstr(LP_basesatoshis(dstr(qp->destsatoshis),price,qp->txfee,qp->desttxfee)),dstr(qp->destsatoshis));
|
|
|
|
printf("cant find utxopair aliceid.%llu %s/%s %.8f -> relvol %.8f\n",(long long)qp->aliceid,qp->srccoin,qp->destcoin,dstr(LP_basesatoshis(dstr(qp->destsatoshis),price,qp->txfee,qp->desttxfee)),dstr(qp->destsatoshis)); |
|
|
|
return(0); |
|
|
|
} |
|
|
|
if ( (qprice= LP_trades_pricevalidate(qp,coin,myprice)) < 0. ) |
|
|
|