Skip to content

Commit

Permalink
decode mypy error lndrest
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Mar 23, 2024
1 parent 1a75192 commit 1101e3c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions cashu/lightning/corelightningrest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions cashu/lightning/fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions cashu/lightning/lnbits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cashu/lightning/lndrest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1101e3c

Please sign in to comment.