|
|
@ -905,9 +905,8 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel |
|
|
|
else maxprice *= 1.001; |
|
|
|
memset(pubkeys,0,sizeof(pubkeys)); |
|
|
|
LP_txfees(&txfee,&desttxfee,base,rel); |
|
|
|
destsatoshis = SATOSHIDEN * relvolume + 2*desttxfee; |
|
|
|
printf("call bestfit\n"); |
|
|
|
if ( (autxo= LP_utxo_bestfit(rel,destsatoshis)) == 0 ) |
|
|
|
destsatoshis = SATOSHIDEN * relvolume; |
|
|
|
if ( (autxo= LP_utxo_bestfit(rel,destsatoshis + 2*desttxfee)) == 0 ) |
|
|
|
return(clonestr("{\"error\":\"cant find alice utxo that is big enough\"}")); |
|
|
|
if ( destsatoshis < autxo->S.satoshis ) |
|
|
|
autxo->S.satoshis = destsatoshis; |
|
|
@ -916,7 +915,6 @@ printf("call bestfit\n"); |
|
|
|
printf("destsatoshis %.8f vs utxo %.8f this would have triggered an quote error -13\n",dstr(destsatoshis),dstr(autxo->payment.value)); |
|
|
|
return(clonestr("{\"error\":\"cant find alice utxo that is small enough\"}")); |
|
|
|
} |
|
|
|
printf("update metrics\n"); |
|
|
|
LP_RTmetrics_update(base,rel); |
|
|
|
while ( 1 ) |
|
|
|
{ |
|
|
@ -932,7 +930,6 @@ printf("call bestfit\n"); |
|
|
|
return(clonestr("{\"error\":\"cant set ordermatch quote info\"}")); |
|
|
|
maxiters = 200; |
|
|
|
qprice = 1. / SMALLVAL; |
|
|
|
printf("validate\n"); |
|
|
|
for (i=0; i<maxiters; i++) |
|
|
|
{ |
|
|
|
if ( (qprice= LP_quote_validate(autxo,0,&Q,0)) <= SMALLVAL ) |
|
|
|