diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 4abddda35..5db9a7f24 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -19,9 +19,6 @@ // LP_nativeDEX.c // marketmaker // -// n41r0j [12:21 AM] -// when i remove funds from my smart addresses, the first time i do ./inv, it shows up empty, but after that, the old values come back -//[12:23] a restart of client fixes it though // SPV at tx level and limit SPV proofing // stats, fix pricearray diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 9d6ab89f5..9a67d2cda 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -36,6 +36,20 @@ int32_t LP_isavailable(struct LP_utxoinfo *utxo) int32_t LP_isunspent(struct LP_utxoinfo *utxo) { + struct LP_address_utxo *up; struct _LP_utxoinfo u; struct iguana_info *coin; + if ( (coin= LP_coinfind(utxo->coin)) == 0 ) + return(0); + if ( (up= LP_address_utxofind(coin,utxo->coinaddr,utxo->payment.txid,utxo->payment.vout)) != 0 && up->spendheight > 0 ) + { + utxo->T.spentflag = up->spendheight; + return(0); + } + u = (utxo->iambob != 0) ? utxo->deposit : utxo->fee; + if ( (up= LP_address_utxofind(coin,utxo->coinaddr,u.txid,u.vout)) != 0 && up->spendheight > 0 ) + { + utxo->T.spentflag = up->spendheight; + return(0); + } if ( utxo != 0 && utxo->T.spentflag == 0 && LP_isavailable(utxo) > 0 ) return(1); else return(0);