From 8867693aa0e908dc6db2cae330c77e67e0d81eb1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 11 Nov 2017 00:12:06 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 12 +++++++++--- iguana/exchanges/LP_utxo.c | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index f6f1725d4..8af912800 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -467,7 +467,7 @@ void utxosQ_loop(void *myipaddr) void LP_coinsloop(void *_coins) { - struct LP_address *ap=0,*atmp; cJSON *retjson; struct LP_address_utxo *up,*tmp; struct iguana_info *coin,*ctmp; char str[65]; struct electrum_info *ep,*backupep=0; bits256 zero; int32_t oldht,j,nonz; char *coins = _coins; + struct LP_address *ap=0,*atmp; struct LP_transaction *tx; cJSON *retjson; struct LP_address_utxo *up,*tmp; struct iguana_info *coin,*ctmp; char str[65]; struct electrum_info *ep,*backupep=0; bits256 zero; int32_t oldht,j,nonz; char *coins = _coins; if ( strcmp("BTC",coins) == 0 ) { strcpy(LP_coinsloopBTC_stats.name,"BTC coin loop"); @@ -526,8 +526,14 @@ void LP_coinsloop(void *_coins) { nonz++; up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - if ( 0 && up->SPV > 0 ) - printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); + if ( up->SPV > 0 ) + { + if ( (tx= LP_transactionfind(coin,up->U.txid)) != 0 && tx->SPV == 0 ) + { + tx->SPV = up->SPV; + printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); + } + } } else if ( up->SPV == -1 ) { diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index ce98ac396..9674cece5 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -237,7 +237,7 @@ void LP_mark_spent(char *symbol,bits256 txid,int32_t vout) int32_t LP_address_utxoadd(char *debug,struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight) { - struct LP_address *ap; cJSON *txobj; struct LP_address_utxo *up,*tmp; int32_t flag,retval = 0; char str[65]; + struct LP_address *ap; cJSON *txobj; struct LP_transaction *tx; struct LP_address_utxo *up,*tmp; int32_t flag,retval = 0; char str[65]; if ( coin == 0 ) return(0); if ( spendheight > 0 ) // dont autocreate entries for spends we dont care about @@ -282,8 +282,11 @@ int32_t LP_address_utxoadd(char *debug,struct iguana_info *coin,char *coinaddr,b DL_APPEND(ap->utxos,up); portable_mutex_unlock(&coin->addrmutex); retval = 1; - if ( value == 0 ) + if ( (tx= LP_transactionfind(coin,txid)) != 0 && tx->SPV > 0 ) + { + up->SPV = tx->SPV; printf("%s ADD UTXO >> %s %s %s/v%d ht.%d %.8f\n",debug,coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); + } } } // else printf("cant get ap %s %s\n",coin->symbol,coinaddr); //printf("done %s add addr.%s ht.%d\n",coin->symbol,coinaddr,height);