Skip to content

Commit

Permalink
stricter type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Oct 15, 2023
1 parent 3472653 commit ff0f12d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ black-check:
poetry run black . --check

mypy:
poetry run mypy cashu --ignore-missing
poetry run mypy cashu --ignore-missing --check-untyped-defs

format: black ruff

Expand Down
6 changes: 3 additions & 3 deletions cashu/core/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def hash_to_point_pre_0_3_3(secret_msg):
_hash = hashlib.sha256(msg).hexdigest().encode("utf-8") # type: ignore
try:
# We construct compressed pub which has x coordinate encoded with even y
_hash = list(_hash[:33]) # take the 33 bytes and get a list of bytes
_hash[0] = 0x02 # set first byte to represent even y coord
_hash = bytes(_hash)
_hash_list = list(_hash[:33]) # take the 33 bytes and get a list of bytes
_hash_list[0] = 0x02 # set first byte to represent even y coord
_hash = bytes(_hash_list)
point = PublicKey(_hash, raw=True)
except Exception:
msg = _hash
Expand Down
3 changes: 2 additions & 1 deletion cashu/mint/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,11 @@ async def get_melt_fees(self, pr: str) -> int:
"""
# 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
amount_msat = 0
if settings.lightning:
decoded_invoice = bolt11.decode(pr)
assert decoded_invoice.amount_msat, "Amountless invoices not supported."
amount_msat = decoded_invoice.amount_msat
amount_msat = int(decoded_invoice.amount_msat)
logger.trace(
"get_melt_fees: checking lightning invoice:"
f" {decoded_invoice.payment_hash}"
Expand Down
2 changes: 1 addition & 1 deletion cashu/wallet/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async def wrapper(self, *args, **kwargs):

self.httpx = httpx.AsyncClient(
verify=not settings.debug,
proxies=proxies_dict,
proxies=proxies_dict, # type: ignore
headers=headers_dict,
base_url=self.url,
)
Expand Down

0 comments on commit ff0f12d

Please sign in to comment.