From 9c7a70f6ff249a1a8a54980f143a35a4ed28215f Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Tue, 27 Dec 2022 13:23:44 +0100 Subject: [PATCH] paytest: fix flake8 code nits --- paytest/paytest.py | 8 ++++---- paytest/test_paytest.py | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/paytest/paytest.py b/paytest/paytest.py index debb0cd..104aba8 100755 --- a/paytest/paytest.py +++ b/paytest/paytest.py @@ -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) diff --git a/paytest/test_paytest.py b/paytest/test_paytest.py index ef5b354..c709e64 100644 --- a/paytest/test_paytest.py +++ b/paytest/test_paytest.py @@ -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')