jl777 7 years ago
parent
commit
71c3f448eb
  1. 30
      iguana/exchanges/LP_prices.c
  2. 2
      iguana/exchanges/LP_utxo.c

30
iguana/exchanges/LP_prices.c

@ -524,7 +524,33 @@ static int _cmp_orderbook(const void *a,const void *b)
else if ( ptr_b < ptr_a )
return(1);
}
// printf("%.8f vs %.8f -> %d\n",ptr_a,ptr_b,retval);
// printf("%.8f vs %.8f -> %d\n",ptr_a,ptr_b,retval);
return(retval);
#undef ptr_a
#undef ptr_b
}
static int _revcmp_orderbook(const void *a,const void *b)
{
int32_t retval = 0;
#define ptr_a (*(struct LP_orderbookentry **)a)->price
#define ptr_b (*(struct LP_orderbookentry **)b)->price
if ( ptr_b > ptr_a )
retval = 1;
else if ( ptr_b < ptr_a )
retval = -1;
else
{
#undef ptr_a
#undef ptr_b
#define ptr_a ((struct LP_orderbookentry *)a)->maxsatoshis
#define ptr_b ((struct LP_orderbookentry *)b)->maxsatoshis
if ( ptr_b > ptr_a )
return(-1);
else if ( ptr_b < ptr_a )
return(1);
}
// printf("%.8f vs %.8f -> %d\n",ptr_a,ptr_b,retval);
return(retval);
#undef ptr_a
#undef ptr_b
@ -664,7 +690,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration)
retjson = cJSON_CreateObject();
array = cJSON_CreateArray();
if ( numbids > 1 )
qsort(bids,numbids,sizeof(*bids),_cmp_orderbook);
qsort(bids,numbids,sizeof(*bids),_revcmp_orderbook);
if ( numasks > 1 )
{
//for (i=0; i<numasks; i++)

2
iguana/exchanges/LP_utxo.c

@ -451,7 +451,7 @@ cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJS
LP_address_utxoadd(coin,tx->outpoints[spentvout].coinaddr,spenttxid,spentvout,tx->outpoints[spentvout].value,-1,height>0?height:1);
if ( strcmp(coin->symbol,"BTC") != 0 )
printf("spend %s %s/v%d at ht.%d\n",coin->symbol,bits256_str(str,tx->txid),spentvout,height);
} else printf("LP_transactioninit: %s spentvout.%d < numvouts.%d\n",bits256_str(str,spenttxid),spentvout,tx->numvouts);
} else printf("LP_transactioninit: %s spentvout.%d < numvouts.%d spendheight.%d\n",bits256_str(str,spenttxid),spentvout,tx->numvouts,tx->outpoints[spentvout].spendheight);
} //else printf("LP_transactioninit: couldnt find (%s) ht.%d %s\n",bits256_str(str,spenttxid),height,jprint(vin,0));
if ( bits256_cmp(spenttxid,txid) == 0 )
printf("spending same tx's %p vout ht.%d %s.[%d] s%d\n",tx,height,bits256_str(str,txid),tx!=0?tx->numvouts:0,spentvout);

Loading…
Cancel
Save