|
|
@ -421,12 +421,14 @@ struct LP_utxoinfo *LP_address_myutxopair(struct LP_utxoinfo *butxo,int32_t iamb |
|
|
|
printf("%.8f ",dstr(utxos[i]->U.value)); |
|
|
|
printf("targetval %.8f vol %.8f price %.8f txfee %.8f %s %s\n",dstr(targetval),relvolume,price,dstr(fee),coin->symbol,coinaddr); |
|
|
|
} |
|
|
|
while ( 1 ) |
|
|
|
{ |
|
|
|
mini = -1; |
|
|
|
if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin,coinaddr,utxos,m,targetval+fee)) >= 0 ) |
|
|
|
{ |
|
|
|
up = utxos[mini]; |
|
|
|
utxos[mini] = 0; |
|
|
|
//printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(up->U.value),dstr(targetval),dstr(targetval2),(double)up->U.value/targetval);
|
|
|
|
//printf("found mini.%d %.8f for targetval %.8f -> targetval2 %.8f, ratio %.2f\n",mini,dstr(up->U.value),dstr(targetval),dstr(targetval2),(double)up->U.value/targetval);
|
|
|
|
if ( (double)up->U.value/targetval < ratio-1 ) |
|
|
|
|
|
|
|
{ |
|
|
@ -449,6 +451,9 @@ struct LP_utxoinfo *LP_address_myutxopair(struct LP_utxoinfo *butxo,int32_t iamb |
|
|
|
} else printf("failed ratio test %.8f\n",(double)up->U.value/targetval); |
|
|
|
} else if ( targetval != 0 && mini >= 0 ) |
|
|
|
printf("targetval %.8f mini.%d\n",dstr(targetval),mini); |
|
|
|
if ( targetval == 0 || mini < 0 ) |
|
|
|
break; |
|
|
|
} |
|
|
|
} else printf("no %s utxos pass LP_address_utxo_ptrs filter\n",coinaddr); |
|
|
|
} else printf("address_myutxopair couldnt find %s %s\n",coin->symbol,coinaddr); |
|
|
|
return(0); |
|
|
|