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
This commit is contained in:
Michael Schmoock
2023-01-02 13:16:54 +01:00
committed by Christian Decker
parent 7f8d4356ed
commit f3d741e7af
4 changed files with 6 additions and 12 deletions

View File

@@ -9,7 +9,7 @@ on:
push: push:
branches: [ master ] branches: [ master ]
pull_request: pull_request:
jobs: jobs:
build-and-test: build-and-test:
name: Test PY=${{ matrix.python-version }}, DEV=${{ matrix.developer }}, EXP=${{ matrix.experimental }}, DEP=${{ matrix.deprecated }} name: Test PY=${{ matrix.python-version }}, DEV=${{ matrix.developer }}, EXP=${{ matrix.experimental }}, DEP=${{ matrix.deprecated }}

View File

@@ -25,5 +25,4 @@ def test_main(node_factory):
l1, l2 = node_factory.line_graph(2, wait_for_announce=True, opts=plugin_opt) l1, l2 = node_factory.line_graph(2, wait_for_announce=True, opts=plugin_opt)
# just call main function # just call main function
res = l1.rpc.autopilot_run_once(dryrun=True) 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") l1.daemon.wait_for_log("I'd like to open [0-9]+ new channels with [0-9]+msat satoshis each")
print(res)

View File

@@ -2,7 +2,7 @@ from backend import Backend
import socketbackend import socketbackend
from flaky import flaky from flaky import flaky
from pyln.testing.fixtures import * # noqa: F401,F403 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 os
import pytest import pytest
import subprocess import subprocess
@@ -37,7 +37,7 @@ def test_start(node_factory, directory):
assert "backup.py" in plugins 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 """The plugin should refuse to start if we haven't initialized the backup
""" """
bpath = os.path.join(directory, 'lightning-1', 'regtest') bpath = os.path.join(directory, 'lightning-1', 'regtest')

View File

@@ -54,9 +54,10 @@ class Payment(object):
def serialize_payload(n, blockheight): def serialize_payload(n, blockheight):
block, tx, out = n['channel'].split('x') block, tx, out = n['channel'].split('x')
scid = int(block) << 40 | int(tx) << 16 | int(out) scid = int(block) << 40 | int(tx) << 16 | int(out)
def minint(i): def minint(i):
if i < 2**8: if i < 2**8:
return struct.pack("!b", i) return struct.pack("!B", i)
elif i < 2**16: elif i < 2**16:
return struct.pack('!H', i) return struct.pack('!H', i)
elif i < 2**32: elif i < 2**32:
@@ -213,9 +214,6 @@ def on_htlc_accepted(onion, htlc, plugin, **kwargs):
msg.verified = sigcheck['verified'] msg.verified = sigcheck['verified']
preimage = payload.get(TLV_KEYSEND_PREIMAGE) preimage = payload.get(TLV_KEYSEND_PREIMAGE)
print("YYY")
print(htlc)
print(onion)
if preimage is not None: if preimage is not None:
msg.payment = Payment(preimage.value, htlc['amount_msat']) msg.payment = Payment(preimage.value, htlc['amount_msat'])
res = { res = {
@@ -226,9 +224,6 @@ def on_htlc_accepted(onion, htlc, plugin, **kwargs):
res = {'result': 'continue'} res = {'result': 'continue'}
plugin.messages.append(msg) plugin.messages.append(msg)
print("Delivering message to {c} waiters".format(
c=len(plugin.receive_waiters)
))
for r in plugin.receive_waiters: for r in plugin.receive_waiters:
m = msg.to_dict() m = msg.to_dict()
m['total_messages'] = len(plugin.messages) m['total_messages'] = len(plugin.messages)