From b4e24ac8baef0edb0a3a3cc62d4161915181a6c1 Mon Sep 17 00:00:00 2001 From: niftynei Date: Thu, 6 May 2021 14:11:11 -0500 Subject: [PATCH] df: anchor outputs are on if EXP_DF So we should treat it the same as EXPERIMENTAL_FEATURES --- tests/test_connection.py | 15 ++++++--------- tests/test_gossip.py | 2 +- tests/test_plugin.py | 8 ++++---- tests/utils.py | 13 ++++++++++++- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/tests/test_connection.py b/tests/test_connection.py index d763bd3fb..41ab96b04 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -192,7 +192,7 @@ def test_opening_tiny_channel(node_factory): reserves = 2 * dustlimit min_commit_tx_fees = basic_fee(7500) overhead = reserves + min_commit_tx_fees - if EXPERIMENTAL_FEATURES: + if EXPERIMENTAL_FEATURES or EXPERIMENTAL_DUAL_FUND: # Gotta fund those anchors too! overhead += 660 @@ -1662,7 +1662,7 @@ def test_multifunding_feerates(node_factory, bitcoind): # Because of how the anchor outputs protocol is designed, # we *always* pay for 2 anchor outs and their weight - if EXPERIMENTAL_FEATURES: # opt_anchor_outputs + if EXPERIMENTAL_FEATURES or EXPERIMENTAL_DUAL_FUND: # opt_anchor_outputs weight = 1124 else: # the commitment transactions' feerate is calculated off @@ -1675,7 +1675,7 @@ def test_multifunding_feerates(node_factory, bitcoind): # tx, but we subtract out the extra anchor output amount # from the to_us output, so it ends up inflating # our fee by that much. - if EXPERIMENTAL_FEATURES: # opt_anchor_outputs + if EXPERIMENTAL_FEATURES or EXPERIMENTAL_DUAL_FUND: # opt_anchor_outputs expected_fee += 330 assert expected_fee == entry['fees']['base'] * 10 ** 8 @@ -2233,8 +2233,8 @@ def test_peerinfo(node_factory, bitcoind): l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'may_reconnect': True}) if l1.config('experimental-dual-fund'): - lfeatures = expected_peer_features(extra=[223]) - nfeatures = expected_node_features(extra=[223]) + lfeatures = expected_peer_features(extra=[21, 29]) + nfeatures = expected_node_features(extra=[21, 29]) else: lfeatures = expected_peer_features() nfeatures = expected_node_features() @@ -2506,9 +2506,6 @@ def test_dataloss_protection(node_factory, bitcoind): feerates=(7500, 7500, 7500, 7500), allow_broken_log=True) lf = expected_peer_features() - if l1.config('experimental-dual-fund'): - lf = expected_peer_features(extra=[223]) - l1.rpc.connect(l2.info['id'], 'localhost', l2.port) # l1 should send out WIRE_INIT (0010) l1.daemon.wait_for_log(r"\[OUT\] 0010.*" @@ -3011,7 +3008,7 @@ def test_wumbo_channels(node_factory, bitcoind): expected_features = expected_peer_features(wumbo_channels=True) if l1.config('experimental-dual-fund'): expected_features = expected_peer_features(wumbo_channels=True, - extra=[223]) + extra=[21, 29]) assert conn['features'] == expected_features assert only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['features'] == expected_features diff --git a/tests/test_gossip.py b/tests/test_gossip.py index fd20ccaf1..20059f073 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -1044,7 +1044,7 @@ def test_node_reannounce(node_factory, bitcoind): lfeatures = expected_node_features() if l1.config('experimental-dual-fund'): - lfeatures = expected_node_features(extra=[223]) + lfeatures = expected_node_features(extra=[21, 29]) # Make sure it gets features correct. assert only_one(l2.rpc.listnodes(l1.info['id'])['nodes'])['features'] == lfeatures diff --git a/tests/test_plugin.py b/tests/test_plugin.py index a4584ef34..43347b8e3 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1469,7 +1469,8 @@ def test_plugin_feature_announce(node_factory): extra = [] if l1.config('experimental-dual-fund'): - extra.append(223) + extra.append(21) # option-anchor-outputs + extra.append(29) # option-dual-fund # Check the featurebits we've set in the `init` message from # feature-test.py. @@ -1706,10 +1707,9 @@ def test_feature_set(node_factory): l1 = node_factory.get_node(options={"plugin": plugin}) fs = l1.rpc.call('getfeatureset') - extra = [233] if l1.config('experimental-dual-fund') else [] - assert fs['init'] == expected_peer_features(extra=extra) - assert fs['node'] == expected_node_features(extra=extra) + assert fs['init'] == expected_peer_features() + assert fs['node'] == expected_node_features() assert fs['channel'] == expected_channel_features() assert 'invoice' in fs diff --git a/tests/utils.py b/tests/utils.py index 843f2f859..2c0e08840 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -2,6 +2,7 @@ from pyln.testing.utils import TEST_NETWORK, TIMEOUT, VALGRIND, DEVELOPER, DEPRE from pyln.testing.utils import env, only_one, wait_for, write_config, TailableProc, sync_blockheight, wait_channel_quiescent, get_tx_p2wsh_outnum # noqa: F401 import bitstring from pyln.client import Millisatoshi +from pyln.testing.utils import EXPERIMENTAL_DUAL_FUND EXPERIMENTAL_FEATURES = env("EXPERIMENTAL_FEATURES", "0") == "1" COMPAT = env("COMPAT", "1") == "1" @@ -29,6 +30,11 @@ def expected_peer_features(wumbo_channels=False, extra=[]): features += [27] if wumbo_channels: features += [19] + if EXPERIMENTAL_DUAL_FUND: + # option_anchor_outputs + features += [21] + # option_dual_fund + features += [29] return hex_bits(features + extra) @@ -46,6 +52,11 @@ def expected_node_features(wumbo_channels=False, extra=[]): features += [27] if wumbo_channels: features += [19] + if EXPERIMENTAL_DUAL_FUND: + # option_anchor_outputs + features += [21] + # option_dual_fund + features += [29] return hex_bits(features + extra) @@ -136,7 +147,7 @@ def first_channel_id(n1, n2): def basic_fee(feerate): - if EXPERIMENTAL_FEATURES: + if EXPERIMENTAL_FEATURES or EXPERIMENTAL_DUAL_FUND: # option_anchor_outputs weight = 1124 else: