Browse Source

Test

pass-iguana-arg
jl777 7 years ago
parent
commit
adc81ad979
  1. 5
      iguana/exchanges/LP_ordermatch.c
  2. 14
      iguana/exchanges/LP_transaction.c

5
iguana/exchanges/LP_ordermatch.c

@ -1000,7 +1000,7 @@ double LP_trades_pricevalidate(struct LP_quoteinfo *qp,struct iguana_info *coin,
struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,struct LP_quoteinfo *newqp,char *pairstr) struct LP_quoteinfo *LP_trades_gotrequest(void *ctx,struct LP_quoteinfo *qp,struct LP_quoteinfo *newqp,char *pairstr)
{ {
int32_t voliters=10,priceiters=33; int32_t voliters=10,priceiters=33;
double price=0.,p=0.,qprice,myprice,bestprice,range,bid,ask; uint64_t satoshis; struct iguana_info *coin,*othercoin; struct LP_utxoinfo A,B,*autxo,*butxo; cJSON *reqjson; char str[65],*retstr; struct LP_address_utxo *utxos[4096]; int32_t i,j,r,counter,max = (int32_t)(sizeof(utxos)/sizeof(*utxos)); double price=0.,p=0.,qprice,myprice,bestprice,range,bid,ask; uint64_t satoshis; struct iguana_info *coin,*othercoin; struct LP_utxoinfo A,B,*autxo,*butxo; cJSON *reqjson; char str[65],*retstr; struct LP_address_utxo *utxos[4096]; int32_t i,j,r,num,counter,max = (int32_t)(sizeof(utxos)/sizeof(*utxos));
*newqp = *qp; *newqp = *qp;
qp = newqp; qp = newqp;
printf("bob %s received REQUEST.(%s) fill.%d gtc.%d\n",bits256_str(str,G.LP_mypub25519),qp->uuidstr+32,qp->fill,qp->gtc); printf("bob %s received REQUEST.(%s) fill.%d gtc.%d\n",bits256_str(str,G.LP_mypub25519),qp->uuidstr+32,qp->fill,qp->gtc);
@ -1138,7 +1138,8 @@ printf("bob %s received REQUEST.(%s) fill.%d gtc.%d\n",bits256_str(str,G.LP_mypu
if ( qp->gtc != 0 && qp->fill != 0 && coin != 0 ) if ( qp->gtc != 0 && qp->fill != 0 && coin != 0 )
{ {
satoshis = LP_basesatoshis(dstr(qp->destsatoshis),price,qp->txfee,qp->desttxfee) + 3*qp->txfee; satoshis = LP_basesatoshis(dstr(qp->destsatoshis),price,qp->txfee,qp->desttxfee) + 3*qp->txfee;
if ( (retstr= LP_autofillbob(coin,satoshis)) != 0 ) LP_address_utxo_reset(&num,coin);
if ( (retstr= LP_autofillbob(coin,satoshis*1.02)) != 0 )
{ {
printf("AUTOfill bob.(%s)\n",retstr); printf("AUTOfill bob.(%s)\n",retstr);
free(retstr); free(retstr);

14
iguana/exchanges/LP_transaction.c

@ -1887,7 +1887,7 @@ char *LP_withdraw(struct iguana_info *coin,cJSON *argjson)
if ( autofee != 0 && iter == 0 && strcmp(coin->symbol,"BTC") == 0 ) if ( autofee != 0 && iter == 0 && strcmp(coin->symbol,"BTC") == 0 )
{ {
txfee = newtxfee = LP_txfeecalc(coin,0,datalen); txfee = newtxfee = LP_txfeecalc(coin,0,datalen);
printf("txfee %.8f -> newtxfee %.8f, numvins.%d\n",dstr(txfee),dstr(newtxfee),numvins); printf("txfee %.8f -> newtxfee %.8f, numvins.%d datalen.%d\n",dstr(txfee),dstr(newtxfee),numvins,datalen);
for (i=0; i<numvins; i++) for (i=0; i<numvins; i++)
{ {
item = jitem(vins,i); item = jitem(vins,i);
@ -1998,20 +1998,20 @@ char *LP_autofillbob(struct iguana_info *coin,uint64_t satoshis)
if ( coin->electrum != 0 ) if ( coin->electrum != 0 )
balance = LP_unspents_load(coin->symbol,coin->smartaddr); balance = LP_unspents_load(coin->symbol,coin->smartaddr);
else balance = LP_RTsmartbalance(coin); else balance = LP_RTsmartbalance(coin);
if ( (txfee= coin->txfee) == 0 ) // BTC if ( strcmp("BTC",coin->symbol) == 0 )
txfee = LP_txfeecalc(coin,0,500); txfee = LP_txfeecalc(coin,0,1000);
balance -= (txfee + 100000); balance -= (txfee + 1000000);
if ( balance < (satoshis<<2) ) if ( balance < (satoshis<<2) )
return(clonestr("{\"error\":\"couldnt autofill balance too small\"}")); return(clonestr("{\"error\":\"couldnt autofill balance too small\"}"));
if ( balance > satoshis+3*txfee && balance >= (1000000 - (txfee + 100000)) ) if ( balance > satoshis+3*txfee && balance >= (txfee + 1000000) )
{ {
argjson = cJSON_CreateObject(); argjson = cJSON_CreateObject();
outputs = cJSON_CreateArray(); outputs = cJSON_CreateArray();
item = cJSON_CreateObject(); item = cJSON_CreateObject();
jaddnum(item,coin->smartaddr,dstr(satoshis + txfee*3)); jaddnum(item,coin->smartaddr,dstr(satoshis + 3000000));
jaddi(outputs,item); jaddi(outputs,item);
item = cJSON_CreateObject(); item = cJSON_CreateObject();
jaddnum(item,coin->smartaddr,dstr(LP_DEPOSITSATOSHIS(satoshis) + txfee*3)); jaddnum(item,coin->smartaddr,dstr(LP_DEPOSITSATOSHIS(satoshis) + 3000000));
jaddi(outputs,item); jaddi(outputs,item);
item = cJSON_CreateObject(); item = cJSON_CreateObject();
jaddnum(item,coin->smartaddr,0.0001); jaddnum(item,coin->smartaddr,0.0001);

Loading…
Cancel
Save