Browse Source

Test

etomic
jl777 7 years ago
parent
commit
a619fe39bd
  1. 16
      iguana/exchanges/LP_ordermatch.c
  2. 4
      iguana/exchanges/LP_utxo.c

16
iguana/exchanges/LP_ordermatch.c

@ -309,10 +309,13 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,char *coinaddr,struct LP_a
if ( i != mini && (up= utxos[i]) != 0 ) if ( i != mini && (up= utxos[i]) != 0 )
{ {
dist = (up->U.value - targetval); dist = (up->U.value - targetval);
if ( dist > 0 && (double)dist/bestdist < 1.1 && up->U.height < bestheight ) if ( dist > 0 && up->U.height < bestheight )
{ {
replacei = i; if ( (double)dist/bestdist < 1.1 )
bestheight = up->U.height; {
replacei = i;
bestheight = up->U.height;
} else printf("almost ratio %.3f dist %.8f vs best %.8f, ht %d vs best ht %d\n",(double)dist/bestdist,dstr(dist),dstr(bestdist),up->U.height,bestheight);
} }
} }
} }
@ -397,8 +400,9 @@ struct LP_utxoinfo *LP_address_myutxopair(struct LP_utxoinfo *butxo,int32_t iamb
{ {
int32_t i; int32_t i;
for (i=0; i<m; i++) for (i=0; i<m; i++)
printf("%.8f ",dstr(utxos[i]->U.value)); if ( utxos[i]->U.value >= targetval )
printf("targetval %.8f vol %.8f price %.8f txfee %.8f %s\n",dstr(targetval),relvolume,price,dstr(txfee),coinaddr); printf("%.8f ",dstr(utxos[i]->U.value));
printf("targetval %.8f vol %.8f price %.8f txfee %.8f %s %s\n",dstr(targetval),relvolume,price,dstr(txfee),coin->symbol,coinaddr);
} }
mini = -1; mini = -1;
if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin,coinaddr,utxos,m,targetval)) >= 0 ) if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin,coinaddr,utxos,m,targetval)) >= 0 )
@ -896,7 +900,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
} }
else else
{ {
printf("cant find utxopair aliceid.%llu %s/%s %.8f -> relvol %.8f\n",(long long)aliceid,Q.srccoin,Q.destcoin,dstr(Q.satoshis),dstr(Q.destsatoshis)); printf("cant find utxopair aliceid.%llu %s/%s %.8f -> relvol %.8f\n",(long long)aliceid,Q.srccoin,Q.destcoin,dstr(LP_basesatoshis(dstr(Q.destsatoshis),price,Q.txfee,Q.desttxfee)),dstr(Q.destsatoshis));
return(retval); return(retval);
} }
} }

4
iguana/exchanges/LP_utxo.c

@ -52,7 +52,7 @@ int32_t _LP_inuse_delete(bits256 txid,int32_t vout)
if ( LP_inuse[ind].ind != ind ) if ( LP_inuse[ind].ind != ind )
printf("ind.%d of %d: mismatched ind.%d\n",ind,LP_numinuse,LP_inuse[ind].ind); printf("ind.%d of %d: mismatched ind.%d\n",ind,LP_numinuse,LP_inuse[ind].ind);
} }
char str[65]; printf("_LP_inuse_delete cant find %s/v%d\n",bits256_str(str,txid),vout); //char str[65]; printf("_LP_inuse_delete cant find %s/v%d\n",bits256_str(str,txid),vout);
return(-1); return(-1);
} }
@ -285,7 +285,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a
utxos[n++] = up; utxos[n++] = up;
if ( n >= max ) if ( n >= max )
break; break;
} else printf("LP_allocated skip\n"); } //else printf("LP_allocated skip\n");
} }
else else
{ {

Loading…
Cancel
Save