Browse Source

Test

etomic
jl777 7 years ago
parent
commit
93a3a93c71
  1. 1
      iguana/exchanges/LP_include.h
  2. 9
      iguana/exchanges/LP_scan.c
  3. 2
      iguana/exchanges/LP_transaction.c

1
iguana/exchanges/LP_include.h

@ -288,6 +288,7 @@ 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);
int32_t LP_swap_getcoinaddr(char *symbol,char *coinaddr,bits256 txid,int32_t vout);
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);

9
iguana/exchanges/LP_scan.c

@ -391,7 +391,7 @@ char *LP_dividends(struct iguana_info *coin,int32_t height,cJSON *argjson)
return(clonestr("{\"error\":\"symbol not found\"}"));
}
int32_t LP_spendsearch(bits256 *spendtxidp,int32_t *indp,char *symbol,bits256 searchtxid,int32_t searchvout)
int32_t LP_spendsearch(char *coinaddr,bits256 *spendtxidp,int32_t *indp,char *symbol,bits256 searchtxid,int32_t searchvout)
{
struct LP_transaction *tx; struct iguana_info *coin;
*indp = -1;
@ -402,6 +402,7 @@ int32_t LP_spendsearch(bits256 *spendtxidp,int32_t *indp,char *symbol,bits256 se
{
if ( searchvout < tx->numvouts && tx->outpoints[searchvout].spendvini >= 0 )
{
LP_swap_getcoinaddr(symbol,coinaddr,*spendtxidp,*indp);
*spendtxidp = tx->outpoints[searchvout].spendtxid;
*indp = tx->outpoints[searchvout].spendvini;
return(tx->outpoints[searchvout].spendheight);
@ -504,7 +505,7 @@ int32_t LP_waitmempool(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int
int32_t LP_mempool_vinscan(bits256 *spendtxidp,int32_t *spendvinp,char *symbol,char *coinaddr,bits256 searchtxid,int32_t searchvout,bits256 searchtxid2,int32_t searchvout2)
{
struct iguana_info *coin; int32_t selector; cJSON *array;
struct iguana_info *coin; int32_t selector; cJSON *array; char addr[64];
if ( symbol == 0 || symbol[0] == 0 || bits256_nonz(searchtxid) == 0 || bits256_nonz(searchtxid2) == 0 )
return(-1);
if ( (coin= LP_coinfind(symbol)) == 0 || coin->inactive != 0 )
@ -517,9 +518,9 @@ int32_t LP_mempool_vinscan(bits256 *spendtxidp,int32_t *spendvinp,char *symbol,c
coin->lastmempool = (uint32_t)time(NULL);
}
}
if ( (selector= LP_spendsearch(spendtxidp,spendvinp,symbol,searchtxid,searchvout)) >= 0 )
if ( (selector= LP_spendsearch(addr,spendtxidp,spendvinp,symbol,searchtxid,searchvout)) >= 0 )
return(selector);
else if ( (selector= LP_spendsearch(spendtxidp,spendvinp,symbol,searchtxid2,searchvout2)) >= 0 )
else if ( (selector= LP_spendsearch(addr,spendtxidp,spendvinp,symbol,searchtxid2,searchvout2)) >= 0 )
return(selector);
return(-1);
}

2
iguana/exchanges/LP_transaction.c

@ -940,7 +940,7 @@ bits256 LP_swap_spendtxid(char *symbol,char *destaddr,bits256 utxotxid,int32_t v
destaddr[0] = 0;
coinaddr[0] = 0;
memset(&spendtxid,0,sizeof(spendtxid));
if ( LP_spendsearch(&spendtxid,&spendvin,symbol,utxotxid,vout) > 0 )
if ( LP_spendsearch(destaddr,&spendtxid,&spendvin,symbol,utxotxid,vout) > 0 )
printf("spend of %s/v%d detected\n",bits256_str(str,utxotxid),vout);
else if ( 0 && (coin= LP_coinfind(symbol)) != 0 && coin->electrum == 0 )
{

Loading…
Cancel
Save