Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agressive Channeld Restart Testing #7083

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions contrib/pyln-client/pyln/client/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,20 @@ def splice(self, script_or_json, dryrun=None, force_feerate=None, debug_log=None
}
return self.call("dev-splice", payload)

def stfu_channels(self, channel_ids):
""" STFU multiple channels """
payload = {
"channel_ids": channel_ids,
}
return self.call("stfu_channels", payload)

def abort_channels(self, channel_ids):
""" Abort multiple channels """
payload = {
"channel_ids": channel_ids,
}
return self.call("abort_channels", payload)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need these wrappers, esp. for dev commands. It automatically handles unknown RPCs (we mainly add them so you get nicer documentation and error detection).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!

def splice_init(self, chan_id, amount, initialpsbt=None, feerate_per_kw=None):
""" Initiate a splice """
payload = {
Expand Down
21 changes: 21 additions & 0 deletions tests/test_restart.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from fixtures import * # noqa: F401,F403
import pytest
import unittest
from utils import (
TEST_NETWORK
)


@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
def test_agressive_restart(node_factory, bitcoind):
l1, l2 = node_factory.line_graph(2, fundamount=1000000, wait_for_announce=True, opts={'experimental-splicing': None})

chan_id = l1.get_channel_id(l2)

for _ in range(20):
l1.rpc.stfu_channels([chan_id])
l1.rpc.abort_channels([chan_id])
l1.daemon.wait_for_log(r'peer_in WIRE_CHANNEL_REESTABLISH')
l2.daemon.wait_for_log(r'peer_in WIRE_CHANNEL_REESTABLISH')
Loading