Skip to content

Commit 58ca254

Browse files
committed
test-patch: switch on disconnects depending on EXP_FEATURES
We don't have a way to introspect if a node will be using v2 before the node has been created, so for now we use the 'crude' "are EXPERIMENTAL_FEATURES turned on" switch to decide what messages to add to the disconnects.
1 parent 4628da0 commit 58ca254

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

‎tests/test_closing.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pyln.client import RpcError
44
from utils import (
55
only_one, sync_blockheight, wait_for, DEVELOPER, TIMEOUT, VALGRIND,
6-
SLOW_MACHINE, COMPAT
6+
SLOW_MACHINE, COMPAT, EXPERIMENTAL_FEATURES
77
)
88

99
import os
@@ -398,7 +398,13 @@ def test_penalty_inhtlc(node_factory, bitcoind, executor, chainparams):
398398
"""Test penalty transaction with an incoming HTLC"""
399399
# We suppress each one after first commit; HTLC gets added not fulfilled.
400400
# Feerates identical so we don't get gratuitous commit to update them
401-
disconnects = ['=WIRE_COMMITMENT_SIGNED', '=WIRE_COMMITMENT_SIGNED-nocommit']
401+
402+
disconnects = ['=WIRE_COMMITMENT_SIGNED-nocommit']
403+
404+
# FIXME: 'experimental features' is a stand in for 'uses v2 channel open'
405+
if EXPERIMENTAL_FEATURES:
406+
disconnects = ['=WIRE_COMMITMENT_SIGNED'] + disconnects
407+
402408
l1 = node_factory.get_node(disconnect=disconnects, may_fail=True, feerates=(7500, 7500, 7500), allow_broken_log=True)
403409
l2 = node_factory.get_node(disconnect=disconnects)
404410

‎tests/test_connection.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1593,7 +1593,10 @@ def test_fee_limits(node_factory, bitcoind):
15931593
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
15941594
def test_update_fee_reconnect(node_factory, bitcoind):
15951595
# Disconnect after first commitsig.
1596-
disconnects = ['=WIRE_COMMITMENT_SIGNED', '+WIRE_COMMITMENT_SIGNED']
1596+
# FIXME: use something else to switch on for v2 enabled
1597+
disconnects = ['+WIRE_COMMITMENT_SIGNED']
1598+
if EXPERIMENTAL_FEATURES:
1599+
disconnects = ['=WIRE_COMMITMENT_SIGNED'] + disconnects
15971600
# Feerates identical so we don't get gratuitous commit to update them
15981601
l1 = node_factory.get_node(disconnect=disconnects, may_reconnect=True,
15991602
feerates=(15000, 15000, 3750))

‎tests/test_pay.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pyln.client import RpcError, Millisatoshi
66
from utils import (
77
DEVELOPER, wait_for, only_one, sync_blockheight, SLOW_MACHINE, TIMEOUT,
8-
VALGRIND
8+
VALGRIND, EXPERIMENTAL_FEATURES
99
)
1010

1111
import concurrent.futures
@@ -373,7 +373,12 @@ def test_payment_success_persistence(node_factory, bitcoind, executor):
373373
def test_payment_failed_persistence(node_factory, executor):
374374
# Start two nodes and open a channel.. die during payment.
375375
# Feerates identical so we don't get gratuitous commit to update them
376-
l1 = node_factory.get_node(disconnect=['=WIRE_COMMITMENT_SIGNED', '+WIRE_COMMITMENT_SIGNED'],
376+
377+
# FIXME: use something else to switch on v2 enablement
378+
disconnects = ['+WIRE_COMMITMENT_SIGNED']
379+
if EXPERIMENTAL_FEATURES:
380+
disconnects = ['=WIRE_COMMITMENT_SIGNED'] + disconnects
381+
l1 = node_factory.get_node(disconnect=disconnects,
377382
options={'dev-no-reconnect': None},
378383
may_reconnect=True,
379384
feerates=(7500, 7500, 7500))

0 commit comments

Comments
 (0)