Skip to content

Commit

Permalink
more obvious bolt11_encode
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Aug 24, 2023
1 parent e451dbc commit 2988c43
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cashu/mint/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import time
from typing import Dict, List, Literal, Optional, Set, Tuple, Union

from bolt11.decode import decode
from bolt11.decode import decode as bolt11_decode
from loguru import logger

from ..core.base import (
Expand Down Expand Up @@ -927,7 +927,7 @@ async def melt(
logger.trace("verified proofs")

total_provided = sum_proofs(proofs)
invoice_obj = decode(invoice)
invoice_obj = bolt11_decode(invoice)
assert invoice_obj.amount_msat, "invoice has no amount"
invoice_amount = math.ceil(invoice_obj.amount_msat / 1000)
if settings.mint_max_peg_out and invoice_amount > settings.mint_max_peg_out:
Expand Down Expand Up @@ -1015,7 +1015,7 @@ async def check_fees(self, pr: str):
# hack: check if it's internal, if it exists, it will return paid = False,
# if id does not exist (not internal), it returns paid = None
if settings.lightning:
decoded_invoice = decode(pr)
decoded_invoice = bolt11_decode(pr)
assert decoded_invoice.amount_msat, "invoice has no amount"
amount = math.ceil(decoded_invoice.amount_msat / 1000)
logger.trace(
Expand Down
4 changes: 2 additions & 2 deletions cashu/wallet/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import requests
from bip32 import BIP32
from bolt11.decode import decode
from bolt11.decode import decode as bolt11_decode
from bolt11.types import Bolt11
from loguru import logger
from mnemonic import Mnemonic
Expand Down Expand Up @@ -1447,7 +1447,7 @@ async def get_pay_amount_with_fees(self, invoice: str):
Decodes the amount from a Lightning invoice and returns the
total amount (amount+fees) to be paid.
"""
decoded_invoice: Bolt11 = decode(invoice)
decoded_invoice: Bolt11 = bolt11_decode(invoice)
assert decoded_invoice.amount_msat, "Invoice has no amount."
# check if it's an internal payment
fees = int((await self.check_fees(invoice))["fee"])
Expand Down

0 comments on commit 2988c43

Please sign in to comment.