Skip to content

Commit 4500661

Browse files
ddustinrustyrussell
authored andcommitted
channeld: Add aggressive restart test
Changelog-None
1 parent cb2163e commit 4500661

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

contrib/pyln-client/pyln/client/lightning.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,20 @@ def splice(self, script_or_json, dryrun=None, force_feerate=None, debug_log=None
11491149
}
11501150
return self.call("dev-splice", payload)
11511151

1152+
def stfu_channels(self, channel_ids):
1153+
""" STFU multiple channels """
1154+
payload = {
1155+
"channel_ids": channel_ids,
1156+
}
1157+
return self.call("stfu_channels", payload)
1158+
1159+
def abort_channels(self, channel_ids):
1160+
""" Abort multiple channels """
1161+
payload = {
1162+
"channel_ids": channel_ids,
1163+
}
1164+
return self.call("abort_channels", payload)
1165+
11521166
def splice_init(self, chan_id, amount, initialpsbt=None, feerate_per_kw=None):
11531167
""" Initiate a splice """
11541168
payload = {

tests/test_restart.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from fixtures import * # noqa: F401,F403
2+
import pytest
3+
import unittest
4+
from utils import (
5+
TEST_NETWORK
6+
)
7+
8+
9+
@pytest.mark.openchannel('v1')
10+
@pytest.mark.openchannel('v2')
11+
@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
12+
def test_agressive_restart(node_factory, bitcoind):
13+
l1, l2 = node_factory.line_graph(2, fundamount=1000000, wait_for_announce=True, opts={'experimental-splicing': None})
14+
15+
chan_id = l1.get_channel_id(l2)
16+
17+
for _ in range(20):
18+
l1.rpc.stfu_channels([chan_id])
19+
l1.rpc.abort_channels([chan_id])
20+
l1.daemon.wait_for_log(r'peer_in WIRE_CHANNEL_REESTABLISH')
21+
l2.daemon.wait_for_log(r'peer_in WIRE_CHANNEL_REESTABLISH')

0 commit comments

Comments
 (0)