mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 17:31:36 +00:00
swaps: show time left until tx can be refunded
This commit is contained in:
parent
04fb329c2e
commit
fa399f3471
1 changed files with 7 additions and 1 deletions
|
@ -682,6 +682,7 @@ class LNWallet(LNWorker):
|
||||||
out[closing_txid] = item
|
out[closing_txid] = item
|
||||||
# add submarine swaps
|
# add submarine swaps
|
||||||
settled_payments = self.get_settled_payments()
|
settled_payments = self.get_settled_payments()
|
||||||
|
current_height = self.network.get_local_height()
|
||||||
for preimage_hex, swap_info in self.swap_manager.swaps.items():
|
for preimage_hex, swap_info in self.swap_manager.swaps.items():
|
||||||
is_reverse = swap_info.get('invoice')
|
is_reverse = swap_info.get('invoice')
|
||||||
txid = swap_info.get('claim_txid' if is_reverse else 'funding_txid')
|
txid = swap_info.get('claim_txid' if is_reverse else 'funding_txid')
|
||||||
|
@ -694,11 +695,16 @@ class LNWallet(LNWorker):
|
||||||
amount_msat, fee_msat, timestamp = self.get_payment_value(info, plist)
|
amount_msat, fee_msat, timestamp = self.get_payment_value(info, plist)
|
||||||
else:
|
else:
|
||||||
amount_msat = 0
|
amount_msat = 0
|
||||||
|
locktime = swap_info.get('timeoutBlockHeight')
|
||||||
|
delta = current_height - locktime
|
||||||
|
label = 'Reverse swap' if is_reverse else 'Normal swap'
|
||||||
|
if delta < 0:
|
||||||
|
label += f' (refundable in {-delta} blocks)'
|
||||||
out[txid] = {
|
out[txid] = {
|
||||||
'txid': txid,
|
'txid': txid,
|
||||||
'amount_msat': amount_msat,
|
'amount_msat': amount_msat,
|
||||||
'type': 'swap',
|
'type': 'swap',
|
||||||
'label': 'Reverse swap' if is_reverse else 'Normal swap' # TODO: show time left until we can get a refund
|
'label': label
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue