This commit is contained in:
dni ⚡
2023-04-17 08:21:45 +02:00
parent 1ac9d2572d
commit 0af22a6256
4 changed files with 11 additions and 13 deletions

View File

@@ -4,8 +4,6 @@ exclude = lnbits/wallets/lnd_grpc_files/, lnbits/extensions/
ignore = ignore =
# E402: module level import not at top of file # E402: module level import not at top of file
E402, E402,
# E741 ambiguous variable name
E741,
# W503: line break before binary operator # W503: line break before binary operator
W503, W503,
# F821: undefined name - should be addressed in future PR # F821: undefined name - should be addressed in future PR

View File

@@ -316,23 +316,23 @@ def _pull_tagged(stream):
# Tagged field containing BitArray # Tagged field containing BitArray
def tagged(char, l): def tagged(char, bits):
# Tagged fields need to be zero-padded to 5 bits. # Tagged fields need to be zero-padded to 5 bits.
while l.len % 5 != 0: while bits.len % 5 != 0:
l.append("0b0") bits.append("0b0")
return ( return (
bitstring.pack( bitstring.pack(
"uint:5, uint:5, uint:5", "uint:5, uint:5, uint:5",
CHARSET.find(char), CHARSET.find(char),
(l.len / 5) / 32, (bits.len / 5) / 32,
(l.len / 5) % 32, (bits.len / 5) % 32,
) )
+ l + bits
) )
def tagged_bytes(char, l): def tagged_bytes(char, bits):
return tagged(char, bitstring.BitArray(l)) return tagged(char, bitstring.BitArray(bits))
def _trim_to_bytes(barr): def _trim_to_bytes(barr):

View File

@@ -96,7 +96,7 @@ class Connection(Compat):
# tuple to list and back to tuple # tuple to list and back to tuple
value_list = [values] if isinstance(values, str) else list(values) value_list = [values] if isinstance(values, str) else list(values)
values = tuple([cleanhtml(l) for l in value_list]) values = tuple([cleanhtml(val) for val in value_list])
return values return values
async def fetchall(self, query: str, values: tuple = ()) -> list: async def fetchall(self, query: str, values: tuple = ()) -> list:

View File

@@ -173,9 +173,9 @@ class LndRestWallet(Wallet):
timeout=None, headers=self.auth, verify=self.cert timeout=None, headers=self.auth, verify=self.cert
) as client: ) as client:
async with client.stream("GET", url) as r: async with client.stream("GET", url) as r:
async for l in r.aiter_lines(): async for json_line in r.aiter_lines():
try: try:
line = json.loads(l) line = json.loads(json_line)
if line.get("error"): if line.get("error"):
logger.error( logger.error(
line["error"]["message"] line["error"]["message"]