From 1101e3cb6116c4e6bc57b9a63c2aa29c19d6b3e9 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Sat, 23 Mar 2024 12:56:38 +0100 Subject: [PATCH] decode mypy error lndrest --- cashu/lightning/corelightningrest.py | 3 +-- cashu/lightning/fake.py | 3 +-- cashu/lightning/lnbits.py | 3 +-- cashu/lightning/lndrest.py | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/cashu/lightning/corelightningrest.py b/cashu/lightning/corelightningrest.py index d1ffb23b..868da6f9 100644 --- a/cashu/lightning/corelightningrest.py +++ b/cashu/lightning/corelightningrest.py @@ -315,8 +315,7 @@ async def paid_invoices_stream(self) -> AsyncGenerator[str, None]: async def get_payment_quote( self, melt_quote: PostMeltQuoteRequest ) -> PaymentQuoteResponse: - bolt11 = melt_quote.request - invoice_obj = decode(bolt11) + invoice_obj = decode(melt_quote.request) assert invoice_obj.amount_msat, "invoice has no amount." amount_msat = int(invoice_obj.amount_msat) fees_msat = fee_reserve(amount_msat) diff --git a/cashu/lightning/fake.py b/cashu/lightning/fake.py index 6ae85784..59cf983a 100644 --- a/cashu/lightning/fake.py +++ b/cashu/lightning/fake.py @@ -155,8 +155,7 @@ async def paid_invoices_stream(self) -> AsyncGenerator[str, None]: async def get_payment_quote( self, melt_quote: PostMeltQuoteRequest ) -> PaymentQuoteResponse: - bolt11 = melt_quote.request - invoice_obj = decode(bolt11) + invoice_obj = decode(melt_quote.request) assert invoice_obj.amount_msat, "invoice has no amount." if self.unit == Unit.sat: diff --git a/cashu/lightning/lnbits.py b/cashu/lightning/lnbits.py index b24cf74b..e7862892 100644 --- a/cashu/lightning/lnbits.py +++ b/cashu/lightning/lnbits.py @@ -160,8 +160,7 @@ async def get_payment_status(self, checking_id: str) -> PaymentStatus: async def get_payment_quote( self, melt_quote: PostMeltQuoteRequest ) -> PaymentQuoteResponse: - bolt11 = melt_quote.request - invoice_obj = decode(bolt11) + invoice_obj = decode(melt_quote.request) assert invoice_obj.amount_msat, "invoice has no amount." amount_msat = int(invoice_obj.amount_msat) fees_msat = fee_reserve(amount_msat) diff --git a/cashu/lightning/lndrest.py b/cashu/lightning/lndrest.py index eab97b15..0afb9c4e 100644 --- a/cashu/lightning/lndrest.py +++ b/cashu/lightning/lndrest.py @@ -158,7 +158,7 @@ async def pay_invoice( invoice = bolt11.decode(quote.request) if invoice.amount_msat: amount_msat = int(invoice.amount_msat) - if amount_msat != quote.amount * 1000: + if amount_msat != quote.amount * 1000 and self.supports_mpp: return await self.pay_partial_invoice( quote, Amount(Unit.sat, quote.amount), fee_limit_msat ) @@ -374,7 +374,7 @@ async def get_payment_quote( else None ) - invoice_obj = decode(bolt11) + invoice_obj = decode(melt_quote.request) assert invoice_obj.amount_msat, "invoice has no amount." if amount: