From f3d741e7afeb244f6807181332dfae94bc58c2b5 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Mon, 2 Jan 2023 13:16:54 +0100 Subject: [PATCH] chore: some cleanups and minor fixes This removes debug output and corrects some code nits that have been introduced by the big CI restoration PR #418 --- .github/workflows/main.yml | 2 +- autopilot/test_autopilot.py | 3 +-- backup/test_backup.py | 4 ++-- noise/noise.py | 9 ++------- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1cc19f1..5fa73d2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ on: push: branches: [ master ] pull_request: - + jobs: build-and-test: name: Test PY=${{ matrix.python-version }}, DEV=${{ matrix.developer }}, EXP=${{ matrix.experimental }}, DEP=${{ matrix.deprecated }} diff --git a/autopilot/test_autopilot.py b/autopilot/test_autopilot.py index 84514db..52b26be 100644 --- a/autopilot/test_autopilot.py +++ b/autopilot/test_autopilot.py @@ -25,5 +25,4 @@ def test_main(node_factory): l1, l2 = node_factory.line_graph(2, wait_for_announce=True, opts=plugin_opt) # just call main function res = l1.rpc.autopilot_run_once(dryrun=True) - #l1.daemon.wait_for_log("I'd like to open [0-9]* new channels with [0-9]* satoshis each") - print(res) + l1.daemon.wait_for_log("I'd like to open [0-9]+ new channels with [0-9]+msat satoshis each") diff --git a/backup/test_backup.py b/backup/test_backup.py index 493b417..1509d19 100644 --- a/backup/test_backup.py +++ b/backup/test_backup.py @@ -2,7 +2,7 @@ from backend import Backend import socketbackend from flaky import flaky from pyln.testing.fixtures import * # noqa: F401,F403 -from pyln.testing.utils import wait_for, sync_blockheight +from pyln.testing.utils import sync_blockheight import os import pytest import subprocess @@ -37,7 +37,7 @@ def test_start(node_factory, directory): assert "backup.py" in plugins -def test_start_no_init(node_factory, directory, executor): +def test_start_no_init(node_factory, directory): """The plugin should refuse to start if we haven't initialized the backup """ bpath = os.path.join(directory, 'lightning-1', 'regtest') diff --git a/noise/noise.py b/noise/noise.py index 2b020bd..60c74ab 100755 --- a/noise/noise.py +++ b/noise/noise.py @@ -54,9 +54,10 @@ class Payment(object): def serialize_payload(n, blockheight): block, tx, out = n['channel'].split('x') scid = int(block) << 40 | int(tx) << 16 | int(out) + def minint(i): if i < 2**8: - return struct.pack("!b", i) + return struct.pack("!B", i) elif i < 2**16: return struct.pack('!H', i) elif i < 2**32: @@ -213,9 +214,6 @@ def on_htlc_accepted(onion, htlc, plugin, **kwargs): msg.verified = sigcheck['verified'] preimage = payload.get(TLV_KEYSEND_PREIMAGE) - print("YYY") - print(htlc) - print(onion) if preimage is not None: msg.payment = Payment(preimage.value, htlc['amount_msat']) res = { @@ -226,9 +224,6 @@ def on_htlc_accepted(onion, htlc, plugin, **kwargs): res = {'result': 'continue'} plugin.messages.append(msg) - print("Delivering message to {c} waiters".format( - c=len(plugin.receive_waiters) - )) for r in plugin.receive_waiters: m = msg.to_dict() m['total_messages'] = len(plugin.messages)