paytest: fix flake8 code nits

This commit is contained in:
Michael Schmoock
2022-12-27 13:23:44 +01:00
parent 81899006e2
commit 9c7a70f6ff
2 changed files with 6 additions and 8 deletions

View File

@@ -193,10 +193,10 @@ def testinvoice(destination, amount=None, **kwargs):
def wrap_error(keys, err):
b = unhexlify(err)
l = len(b)
padlen = 256 - l
c = len(b)
padlen = 256 - c
pad = b"\x00" * padlen
b = struct.pack("!H", l) + b + struct.pack("!H", padlen) + pad
b = struct.pack("!H", c) + b + struct.pack("!H", padlen) + pad
assert len(b) == 256 + 2 + 2
h = hmac.HMAC(keys.um, hashes.SHA256(), backend=default_backend())
h.update(b)
@@ -280,7 +280,7 @@ def on_htlc_accepted(onion, htlc, request, plugin, *args, **kwargs):
Timer(60.0, timeout, args=(plugin, ps)).start()
payment_data = payload.get(8).value
secret = payment_data[:32]
# secret = payment_data[:32]
total = payment_data[32:].hex()
total = int(total, 16)

View File

@@ -1,8 +1,6 @@
from pyln.testing.fixtures import * # noqa: F401,F403
from pyln.testing.utils import DEVELOPER
from pyln.client import RpcError
import os
import unittest
import pytest
from pprint import pprint
@@ -17,7 +15,7 @@ def test_start(node_factory):
def test_invoice(node_factory):
l1 = node_factory.get_node(options=pluginopt)
inv = l1.rpc.testinvoice('03'*33)
inv = l1.rpc.testinvoice('03' * 33)
details = l1.rpc.decodepay(inv['invoice'])
pprint(details)
@@ -41,7 +39,7 @@ def test_mpp_pay(node_factory):
""" l1 send a payment that is going to be split.
"""
l1, l2 = node_factory.line_graph(2, opts=pluginopt, wait_for_announce=True)
res = l1.rpc.paytest(l2.info['id'], 2*10**8)
res = l1.rpc.paytest(l2.info['id'], 2 * 10**8)
l2.daemon.wait_for_log(r'Received 200000000/200000000 with [0-9]+ parts')