Browse Source

Test

etomic
jl777 7 years ago
parent
commit
ea8aab324b
  1. 4
      iguana/exchanges/LP_cache.c
  2. 2
      iguana/exchanges/LP_include.h
  3. 4
      iguana/exchanges/LP_nativeDEX.c
  4. 2
      iguana/exchanges/LP_ordermatch.c
  5. 3
      iguana/exchanges/LP_socket.c

4
iguana/exchanges/LP_cache.c

@ -228,12 +228,12 @@ bits256 LP_merkleroot(struct iguana_info *coin,struct electrum_info *ep,int32_t
return(merkleroot);
}
int32_t LP_merkleproof(struct iguana_info *coin,struct electrum_info *ep,bits256 txid,int32_t height)
int32_t LP_merkleproof(struct iguana_info *coin,char *coinaddr,struct electrum_info *ep,bits256 txid,int32_t height)
{
struct LP_transaction *tx=0; cJSON *merkobj,*merkles,*retjson; bits256 roothash,merkleroot; int32_t m,SPV = 0;
if ( height < 0 )
return(0);
if ( (tx= LP_transactionfind(coin,txid)) == 0)
if ( (tx= LP_transactionfind(coin,txid)) == 0 && strcmp(coinaddr,coin->smartaddr) == 0 )
{
if ( (retjson= electrum_transaction(coin->symbol,ep,&retjson,txid)) != 0 )
free_json(retjson);

2
iguana/exchanges/LP_include.h

@ -428,7 +428,7 @@ int32_t LP_reserved_msg(int32_t priority,char *base,char *rel,bits256 pubkey,cha
struct iguana_info *LP_coinfind(char *symbol);
int32_t LP_crc32find(int32_t *duplicatep,int32_t ind,uint32_t crc32);
char *LP_pricepings(void *ctx,char *myipaddr,int32_t pubsock,char *base,char *rel,double price);
int32_t LP_merkleproof(struct iguana_info *coin,struct electrum_info *ep,bits256 txid,int32_t height);
int32_t LP_merkleproof(struct iguana_info *coin,char *coinaddr,struct electrum_info *ep,bits256 txid,int32_t height);
int32_t _LP_utxos_remove(bits256 txid,int32_t vout);
int32_t LP_utxos_remove(bits256 txid,int32_t vout);
struct LP_transaction *LP_transactionadd(struct iguana_info *coin,bits256 txid,int32_t height,int32_t numvouts,int32_t numvins);

4
iguana/exchanges/LP_nativeDEX.c

@ -527,7 +527,7 @@ void LP_coinsloop(void *_coins)
if ( up->SPV == 0 )
{
nonz++;
up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height);
up->SPV = LP_merkleproof(coin,coin->smartaddr,backupep,up->U.txid,up->U.height);
if ( up->SPV > 0 )
{
if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && tx->SPV == 0 )
@ -544,7 +544,7 @@ void LP_coinsloop(void *_coins)
oldht = up->U.height;
LP_txheight_check(coin,ap->coinaddr,up);
if ( oldht != up->U.height )
up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height);
up->SPV = LP_merkleproof(coin,coin->smartaddr,backupep,up->U.txid,up->U.height);
if ( up->SPV <= 0 )
up->SPV = -2;
else printf("%s %s: corrected SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV);

2
iguana/exchanges/LP_ordermatch.c

@ -647,7 +647,7 @@ int32_t LP_validSPV(char *symbol,char *coinaddr,bits256 txid,int32_t vout)
return(-1);
if ( (backupep= ep->prev) == 0 )
backupep = ep;
up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height);
up->SPV = LP_merkleproof(coin,coinaddr,backupep,up->U.txid,up->U.height);
if ( up->SPV <= 0 )
return(-1);
}

3
iguana/exchanges/LP_socket.c

@ -329,7 +329,8 @@ int32_t electrum_process_array(struct iguana_info *coin,struct electrum_info *ep
tx->height = ht;
if ( ep != 0 && coin != 0 && tx->SPV == 0 )
{
tx->SPV = LP_merkleproof(coin,ep,txid,tx->height);
if ( strcmp(coinaddr,coin->smartaddr) == 0 )
tx->SPV = LP_merkleproof(coin,coin->smartaddr,ep,txid,tx->height);
//printf("%s %s >>>>>>>>>> set %s <- height %d\n",coin->symbol,coinaddr,bits256_str(str,txid),tx->height);
}
}

Loading…
Cancel
Save