jl777 7 years ago
parent
commit
8774869824
  1. 2
      iguana/exchanges/LP_include.h
  2. 2
      iguana/exchanges/LP_ordermatch.c
  3. 22
      iguana/exchanges/LP_rpc.c

2
iguana/exchanges/LP_include.h

@ -284,6 +284,7 @@ int32_t LP_forward(void *ctx,char *myipaddr,int32_t pubsock,bits256 pubkey,char
int32_t LP_ismine(struct LP_utxoinfo *utxo);
int32_t LP_isavailable(struct LP_utxoinfo *utxo);
struct LP_peerinfo *LP_peerfind(uint32_t ipbits,uint16_t port);
uint64_t LP_value_extract(cJSON *obj,int32_t addinterest);
char *LP_command_process(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen);
void LP_availableset(struct LP_utxoinfo *utxo);
int32_t LP_iseligible(uint64_t *valp,uint64_t *val2p,int32_t iambob,char *symbol,bits256 txid,int32_t vout,uint64_t satoshis,bits256 txid2,int32_t vout2);
@ -307,6 +308,7 @@ cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrum
void LP_postutxos(char *symbol,char *coinaddr);
uint16_t LP_randpeer(char *destip);
int32_t LP_butxo_findeither(bits256 txid,int32_t vout);
cJSON *LP_listunspent(char *symbol,char *coinaddr);
#endif

2
iguana/exchanges/LP_ordermatch.c

@ -903,7 +903,7 @@ struct LP_utxoinfo *LP_buyutxo(struct LP_utxoinfo *bestutxo,double *ordermatchpr
price = jdouble(item,"price");
if ( LP_pricevalid(price) > 0 && price <= maxprice )
{
printf("%s\n",jprint(item,0));
//printf("%s\n",jprint(item,0));
pubkey = jbits256(item,"pubkey");
if ( bits256_cmp(pubkey,LP_mypub25519) != 0 && (pubp= LP_pubkeyadd(pubkey)) != 0 )
{

22
iguana/exchanges/LP_rpc.c

@ -313,7 +313,7 @@ cJSON *LP_gettx(char *symbol,bits256 txid)
cJSON *LP_gettxout(char *symbol,bits256 txid,int32_t vout)
{
char buf[128],str[65],coinaddr[64],*hexstr; uint64_t value; uint8_t *serialized; cJSON *sobj,*addresses,*item,*array,*hexobj,*retjson=0; int32_t i,n,v,len; bits256 t; struct iguana_info *coin;
char buf[128],str[65],coinaddr[64],*hexstr; uint64_t value,val; uint8_t *serialized; cJSON *sobj,*addresses,*item,*array,*hexobj,*retjson=0; int32_t i,n,v,len; bits256 t; struct iguana_info *coin;
if ( symbol == 0 || symbol[0] == 0 )
return(cJSON_Parse("{\"error\":\"null symbol\"}"));
coin = LP_coinfind(symbol);
@ -351,7 +351,7 @@ cJSON *LP_gettxout(char *symbol,bits256 txid,int32_t vout)
LP_swap_coinaddr(coin,coinaddr,&value,serialized,len,vout);
//printf("HEX.(%s) len.%d %s %.8f\n",hexstr+1,len,coinaddr,dstr(value));
free(hexstr);
if ( (array= electrum_address_listunspent(coin->symbol,0,&array,coinaddr)) != 0 )
if ( (array= LP_listunspent(coin->symbol,coinaddr)) != 0 )
{
//printf("array.(%s)\n",jprint(array,0));
if ( array != 0 && (n= cJSON_GetArraySize(array)) > 0 )
@ -359,8 +359,20 @@ cJSON *LP_gettxout(char *symbol,bits256 txid,int32_t vout)
for (i=0; i<n; i++)
{
item = jitem(array,i);
t = jbits256(item,"tx_hash");
v = jint(item,"tx_pos");
if ( coin->electrum == 0 )
{
t = jbits256(item,"txid");
v = jint(item,"vout");
val = LP_value_extract(item,0);
}
else
{
t = jbits256(item,"tx_hash");
v = jint(item,"tx_pos");
val = j64bits(item,"value");
}
if ( value != val )
printf("LP_gettxout: value %llu != %llu\n",(long long)value,(long long)val);
if ( v == vout && bits256_cmp(t,txid) == 0 )
{
retjson = cJSON_CreateObject();
@ -380,8 +392,6 @@ cJSON *LP_gettxout(char *symbol,bits256 txid,int32_t vout)
"version": 1,
"coinbase": false
}*/
if ( value != j64bits(item,"value") )
printf("LP_gettxout: value %llu != %llu\n",(long long)value,(long long)j64bits(item,"value"));
jaddnum(retjson,"value",dstr(value));
jaddbits256(retjson,"txid",t);
jaddnum(retjson,"vout",v);

Loading…
Cancel
Save