use bytes.fromhex/hex builtins instead of binascii.hexlify/unhexlify

This commit is contained in:
Pavol Rusnak
2022-12-29 16:46:35 +01:00
parent 89aa4a1de9
commit a377381942
10 changed files with 22 additions and 35 deletions
+4 -5
View File
@@ -8,7 +8,6 @@ except ImportError: # pragma: nocover
import asyncio
import base64
import binascii
import hashlib
from os import environ, error
from typing import AsyncGenerator, Dict, Optional
@@ -229,8 +228,8 @@ class LndWallet(Wallet):
try:
r_hash = hex_to_bytes(checking_id)
if len(r_hash) != 32:
raise binascii.Error
except binascii.Error:
raise ValueError
except ValueError:
# this may happen if we switch between backend wallets
# that use different checking_id formats
return PaymentStatus(None)
@@ -250,8 +249,8 @@ class LndWallet(Wallet):
try:
r_hash = hex_to_bytes(checking_id)
if len(r_hash) != 32:
raise binascii.Error
except binascii.Error:
raise ValueError
except ValueError:
# this may happen if we switch between backend wallets
# that use different checking_id formats
return PaymentStatus(None)