Browse Source

Test

etomic
jl777 8 years ago
parent
commit
d18709100a
  1. 8
      iguana/exchanges/LP_quotes.c
  2. 2
      iguana/exchanges/LP_transaction.c

8
iguana/exchanges/LP_quotes.c

@ -329,7 +329,7 @@ cJSON *LP_autotrade(struct LP_utxoinfo *myutxo,char *base,double maxprice)
bestprice = prices[i];
item = jitem(array,i);
bestitem = LP_quotejson(&Q[i]);
printf("bestprice %f vs maxprice %f\n",bestprice,maxprice);
printf("bestprice %f vs maxprice %f (%s)\n",bestprice,maxprice,jprint(bestitem,0));
if ( maxprice == 0. || bestprice <= maxprice )
{
Q[i].desttxid = myutxo->payment.txid;
@ -337,6 +337,9 @@ cJSON *LP_autotrade(struct LP_utxoinfo *myutxo,char *base,double maxprice)
Q[i].feetxid = myutxo->fee.txid;
Q[i].feevout = myutxo->fee.vout;
strcpy(Q[i].destaddr,myutxo->coinaddr);
Q[i].desthash = LP_mypubkey;
strcpy(Q[i].srccoin,base);
strcpy(Q[i].destcoin,myutxo->coin);
price = LP_query("request",&Q[i],base,myutxo->coin,myutxo->S.mypub);
if ( jobj(bestitem,"price") != 0 )
jdelete(bestitem,"price");
@ -348,6 +351,9 @@ cJSON *LP_autotrade(struct LP_utxoinfo *myutxo,char *base,double maxprice)
Q[i].feetxid = myutxo->fee.txid;
Q[i].feevout = myutxo->fee.vout;
strcpy(Q[i].destaddr,myutxo->coinaddr);
Q[i].desthash = LP_mypubkey;
strcpy(Q[i].srccoin,base);
strcpy(Q[i].destcoin,myutxo->coin);
price = LP_query("connect",&Q[i],base,myutxo->coin,myutxo->S.mypub);
LP_requestinit(&R,Q[i].srchash,Q[i].desthash,base,Q[i].satoshis,Q[i].destcoin,Q[i].destsatoshis,Q[i].timestamp,Q[i].quotetime,DEXselector);
jaddstr(bestitem,"status","connected");

2
iguana/exchanges/LP_transaction.c

@ -227,6 +227,8 @@ int32_t LP_mempoolscan(char *symbol,bits256 txid)
int32_t LP_mempool_vinscan(bits256 *spendtxidp,int32_t *spendvinp,char *symbol,bits256 searchtxid,int32_t searchvout,bits256 searchtxid2,int32_t searchvout2)
{
int32_t i,n; cJSON *array; bits256 mempooltxid;
if ( symbol == 0 || symbol[0] == 0 || bits256_nonz(searchtxid) == 0 || bits256_nonz(searchtxid2) == 0 )
return(-1);
if ( (array= LP_getmempool(symbol)) != 0 )
{
if ( is_cJSON_Array(array) != 0 && (n= cJSON_GetArraySize(array)) > 0 )

Loading…
Cancel
Save