mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-06 02:38:11 +01:00
ui: auto set blank amount from using amount to and rate.
Fix btc get unspents, 'solvable'.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user