jl777 7 years ago
parent
commit
707ae333de
  1. 1
      iguana/exchanges/LP_coins.c
  2. 2
      iguana/exchanges/LP_include.h
  3. 9
      iguana/exchanges/LP_utxo.c

1
iguana/exchanges/LP_coins.c

@ -342,6 +342,7 @@ struct iguana_info *LP_coinadd(struct iguana_info *cdata)
*coin = *cdata;
portable_mutex_init(&coin->txmutex);
portable_mutex_init(&coin->addrmutex);
portable_mutex_init(&coin->addressutxo_mutex);
portable_mutex_lock(&LP_coinmutex);
HASH_ADD_KEYPTR(hh,LP_coins,coin->symbol,strlen(coin->symbol),coin);
portable_mutex_unlock(&LP_coinmutex);

2
iguana/exchanges/LP_include.h

@ -298,7 +298,7 @@ struct LP_transaction
struct iguana_info
{
UT_hash_handle hh;
portable_mutex_t txmutex,addrmutex; struct LP_transaction *transactions; struct LP_address *addresses;
portable_mutex_t txmutex,addrmutex,addressutxo_mutex; struct LP_transaction *transactions; struct LP_address *addresses;
uint64_t txfee;
int32_t numutxos,notarized,longestchain,firstrefht,firstscanht,lastscanht,height; uint16_t busport;
uint32_t txversion,dPoWtime,lastresetutxo,loadedcache,electrumlist,lastunspent,importedprivkey,lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime;

9
iguana/exchanges/LP_utxo.c

@ -411,7 +411,7 @@ int32_t LP_address_utxoadd(uint32_t timestamp,char *debug,struct iguana_info *co
}
if ( flag == 0 && value != 0 )
{
if ( 0 && coin->electrum == 0 )
if ( coin->electrum == 0 )
{
if ( (txobj= LP_gettxout(coin->symbol,coinaddr,txid,vout)) == 0 )
{
@ -457,6 +457,7 @@ struct LP_address *LP_address_utxo_reset(struct iguana_info *coin)
//if ( IAMLP != 0 && time(NULL) < coin->lastresetutxo+60 )
// return(ap);
coin->lastresetutxo = (uint32_t)time(NULL);
portable_mutex_lock(&coin->addressutxo_mutex);
if ( (array= LP_listunspent(coin->symbol,coin->smartaddr,zero,zero)) != 0 )
{
printf("clear %s ap->utxos\n",coin->symbol);
@ -480,7 +481,7 @@ struct LP_address *LP_address_utxo_reset(struct iguana_info *coin)
//{"tx_hash":"38d1b7c73015e1b1d6cb7fc314cae402a635b7d7ea294970ab857df8777a66f4","tx_pos":0,"height":577975,"value":238700}
item = jitem(array,i);
value = LP_listunspent_parseitem(coin,&txid,&vout,&height,item);
if ( 0 )
if ( 1 )
{
if ( (txobj= LP_gettxout(coin->symbol,coin->smartaddr,txid,vout)) == 0 )
continue;
@ -489,7 +490,7 @@ struct LP_address *LP_address_utxo_reset(struct iguana_info *coin)
continue;
}
LP_address_utxoadd(now,"withdraw",coin,coin->smartaddr,txid,vout,value,height,-1);
if ( 0 && (up= LP_address_utxofind(coin,coin->smartaddr,txid,vout)) == 0 )
if ( (up= LP_address_utxofind(coin,coin->smartaddr,txid,vout)) == 0 )
printf("couldnt find just added %s/%d ht.%d %.8f\n",bits256_str(str,txid),vout,height,dstr(value));
else
{
@ -501,6 +502,7 @@ struct LP_address *LP_address_utxo_reset(struct iguana_info *coin)
}
free_json(array);
}
portable_mutex_unlock(&coin->addressutxo_mutex);
return(ap);
}
@ -552,7 +554,6 @@ cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrum
}
if ( up->spendheight <= 0 && up->U.value != 0 )
{
char str[65];
if ( LP_allocated(up->U.txid,up->U.vout) != 0 )
{
//printf("%s %s/v%d allocated\n",coin->symbol,bits256_str(str,up->U.txid),up->U.vout);

Loading…
Cancel
Save