From adc81ad9795cd55f6db55dadb77179bd7ae24449 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 24 Jun 2018 01:50:15 -1100 Subject: [PATCH] Test --- iguana/exchanges/LP_ordermatch.c | 5 +++-- iguana/exchanges/LP_transaction.c | 14 +++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 9403ad05b..2f699741b 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/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) { 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; 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); @@ -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 ) { 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); free(retstr); diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 64ecc1540..f7352fe36 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/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 ) { 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; ielectrum != 0 ) balance = LP_unspents_load(coin->symbol,coin->smartaddr); else balance = LP_RTsmartbalance(coin); - if ( (txfee= coin->txfee) == 0 ) // BTC - txfee = LP_txfeecalc(coin,0,500); - balance -= (txfee + 100000); + if ( strcmp("BTC",coin->symbol) == 0 ) + txfee = LP_txfeecalc(coin,0,1000); + balance -= (txfee + 1000000); if ( balance < (satoshis<<2) ) 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(); outputs = cJSON_CreateArray(); item = cJSON_CreateObject(); - jaddnum(item,coin->smartaddr,dstr(satoshis + txfee*3)); + jaddnum(item,coin->smartaddr,dstr(satoshis + 3000000)); jaddi(outputs,item); 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); item = cJSON_CreateObject(); jaddnum(item,coin->smartaddr,0.0001);