ui: auto set blank amount from using amount to and rate.

Fix btc get unspents, 'solvable'.
This commit is contained in:
tecnovert
2024-05-05 20:50:00 +02:00
parent f64b2c1030
commit 47f7b4545e
7 changed files with 104 additions and 42 deletions

View File

@@ -1378,8 +1378,6 @@ class BTCInterface(CoinInterface):
for u in unspent:
if u.get('spendable', False) is False:
continue
if u.get('solveable', False) is False:
continue
if 'address' not in u:
continue
if 'desc' in u:
@@ -1411,7 +1409,6 @@ class BTCInterface(CoinInterface):
def getProofOfFunds(self, amount_for, extra_commit_bytes):
# TODO: Lock unspent and use same output/s to fund bid
unspent_addr = self.getUnspentsByAddr()
sign_for_addr = None
for addr, value in unspent_addr.items():
if value >= amount_for:

View File

@@ -51,6 +51,31 @@ class LTCInterface(BTCInterface):
rv['mweb_immature'] = mweb_info['immature_balance']
return rv
def getUnspentsByAddr(self):
unspent_addr = dict()
unspent = self.rpc_wallet('listunspent')
for u in unspent:
if u.get('spendable', False) is False:
continue
if u.get('solvable', False) is False: # Filter out mweb outputs
continue
if 'address' not in u:
continue
if 'desc' in u:
desc = u['desc']
if self.using_segwit:
if self.use_p2shp2wsh():
if not desc.startswith('sh(wpkh'):
continue
else:
if not desc.startswith('wpkh'):
continue
else:
if not desc.startswith('pkh'):
continue
unspent_addr[u['address']] = unspent_addr.get(u['address'], 0) + self.make_int(u['amount'], r=1)
return unspent_addr
class LTCInterfaceMWEB(LTCInterface):
@staticmethod