Fix LTC getUnspentsByAddr() returning MWEB UTXOs.

This commit is contained in:
tecnovert 2024-05-04 19:11:50 +02:00
parent 6df09a973e
commit a08bdfbdb8
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
4 changed files with 11 additions and 7 deletions

View File

@ -1376,7 +1376,9 @@ class BTCInterface(CoinInterface):
unspent_addr = dict() unspent_addr = dict()
unspent = self.rpc_wallet('listunspent') unspent = self.rpc_wallet('listunspent')
for u in unspent: for u in unspent:
if u['spendable'] is not True: if u.get('spendable', False) is False:
continue
if u.get('solveable', False) is False:
continue continue
if 'address' not in u: if 'address' not in u:
continue continue

View File

@ -277,8 +277,6 @@ class FIROInterface(BTCInterface):
break break
utxos_hash = hasher.digest() utxos_hash = hasher.digest()
self._log.debug('sign_for_addr %s', sign_for_addr)
if self.using_segwit(): # TODO: Use isSegwitAddress when scantxoutset can use combo if self.using_segwit(): # TODO: Use isSegwitAddress when scantxoutset can use combo
# 'Address does not refer to key' for non p2pkh # 'Address does not refer to key' for non p2pkh
pkh = self.decodeAddress(sign_for_addr) pkh = self.decodeAddress(sign_for_addr)

View File

@ -216,8 +216,6 @@ class NAVInterface(BTCInterface):
break break
utxos_hash = hasher.digest() utxos_hash = hasher.digest()
self._log.debug('sign_for_addr %s', sign_for_addr)
if self.using_segwit(): # TODO: Use isSegwitAddress when scantxoutset can use combo if self.using_segwit(): # TODO: Use isSegwitAddress when scantxoutset can use combo
# 'Address does not refer to key' for non p2pkh # 'Address does not refer to key' for non p2pkh
addr_info = self.rpc('validateaddress', [addr, ]) addr_info = self.rpc('validateaddress', [addr, ])

View File

@ -177,8 +177,14 @@ class TestLTC(BasicSwapTest):
tx = ci1.rpc_wallet('gettransaction', [mweb_tx['txid'],]) tx = ci1.rpc_wallet('gettransaction', [mweb_tx['txid'],])
blockhash = tx['blockhash'] blockhash = tx['blockhash']
block = ci1.rpc('getblock', [blockhash, 3]) block3 = ci1.rpc('getblock', [blockhash, 3])
block = ci1.rpc('getblock', [blockhash, 0]) block0 = ci1.rpc('getblock', [blockhash, 0])
require_amount: int = ci1.make_int(1)
unspent_addr = ci1.getUnspentsByAddr()
for addr, _ in unspent_addr.items():
if 'mweb1' in addr:
raise ValueError('getUnspentsByAddr should exclude mweb UTXOs.')
# TODO # TODO