mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 20:35:13 +00:00
wallet.export_{request,invoice}: replace 'amount' field with sat/msat
(was failing as 'amount' was Decimal for LN invoices, which cannot be json-serialised)
This commit is contained in:
parent
d5f368c584
commit
d31883a2ea
1 changed files with 6 additions and 2 deletions
|
@ -1691,7 +1691,6 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
|||
is_lightning = x.is_lightning()
|
||||
d = {
|
||||
'is_lightning': is_lightning,
|
||||
'amount': x.get_amount_sat(),
|
||||
'amount_BTC': format_satoshis(x.get_amount_sat()),
|
||||
'message': x.message,
|
||||
'timestamp': x.time,
|
||||
|
@ -1708,6 +1707,9 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
|||
d['can_receive'] = self.lnworker.can_receive_invoice(x)
|
||||
else:
|
||||
assert isinstance(x, OnchainInvoice)
|
||||
amount_sat = x.get_amount_sat()
|
||||
assert isinstance(amount_sat, (int, str, type(None)))
|
||||
d['amount_sat'] = amount_sat
|
||||
addr = x.get_address()
|
||||
paid, conf = self.get_payment_status(addr, x.amount_sat)
|
||||
d['address'] = addr
|
||||
|
@ -1733,7 +1735,6 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
|||
is_lightning = x.is_lightning()
|
||||
d = {
|
||||
'is_lightning': is_lightning,
|
||||
'amount': x.get_amount_sat(),
|
||||
'amount_BTC': format_satoshis(x.get_amount_sat()),
|
||||
'message': x.message,
|
||||
'timestamp': x.time,
|
||||
|
@ -1749,6 +1750,9 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
|||
d['can_pay'] = self.lnworker.can_pay_invoice(x)
|
||||
else:
|
||||
assert isinstance(x, OnchainInvoice)
|
||||
amount_sat = x.get_amount_sat()
|
||||
assert isinstance(amount_sat, (int, str, type(None)))
|
||||
d['amount_sat'] = amount_sat
|
||||
d['outputs'] = [y.to_legacy_tuple() for y in x.outputs]
|
||||
if x.bip70:
|
||||
d['bip70'] = x.bip70
|
||||
|
|
Loading…
Add table
Reference in a new issue