df: anchor outputs are on if EXP_DF

So we should treat it the same as EXPERIMENTAL_FEATURES
This commit is contained in:
niftynei 2021-05-06 14:11:11 -05:00 committed by Rusty Russell
parent 484d6bde83
commit b4e24ac8ba
4 changed files with 23 additions and 15 deletions

View File

@ -192,7 +192,7 @@ def test_opening_tiny_channel(node_factory):
reserves = 2 * dustlimit reserves = 2 * dustlimit
min_commit_tx_fees = basic_fee(7500) min_commit_tx_fees = basic_fee(7500)
overhead = reserves + min_commit_tx_fees overhead = reserves + min_commit_tx_fees
if EXPERIMENTAL_FEATURES: if EXPERIMENTAL_FEATURES or EXPERIMENTAL_DUAL_FUND:
# Gotta fund those anchors too! # Gotta fund those anchors too!
overhead += 660 overhead += 660
@ -1662,7 +1662,7 @@ def test_multifunding_feerates(node_factory, bitcoind):
# Because of how the anchor outputs protocol is designed, # Because of how the anchor outputs protocol is designed,
# we *always* pay for 2 anchor outs and their weight # 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 weight = 1124
else: else:
# the commitment transactions' feerate is calculated off # 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 # tx, but we subtract out the extra anchor output amount
# from the to_us output, so it ends up inflating # from the to_us output, so it ends up inflating
# our fee by that much. # our fee by that much.
if EXPERIMENTAL_FEATURES: # opt_anchor_outputs if EXPERIMENTAL_FEATURES or EXPERIMENTAL_DUAL_FUND: # opt_anchor_outputs
expected_fee += 330 expected_fee += 330
assert expected_fee == entry['fees']['base'] * 10 ** 8 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}) l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'may_reconnect': True})
if l1.config('experimental-dual-fund'): if l1.config('experimental-dual-fund'):
lfeatures = expected_peer_features(extra=[223]) lfeatures = expected_peer_features(extra=[21, 29])
nfeatures = expected_node_features(extra=[223]) nfeatures = expected_node_features(extra=[21, 29])
else: else:
lfeatures = expected_peer_features() lfeatures = expected_peer_features()
nfeatures = expected_node_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) feerates=(7500, 7500, 7500, 7500), allow_broken_log=True)
lf = expected_peer_features() 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.rpc.connect(l2.info['id'], 'localhost', l2.port)
# l1 should send out WIRE_INIT (0010) # l1 should send out WIRE_INIT (0010)
l1.daemon.wait_for_log(r"\[OUT\] 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) expected_features = expected_peer_features(wumbo_channels=True)
if l1.config('experimental-dual-fund'): if l1.config('experimental-dual-fund'):
expected_features = expected_peer_features(wumbo_channels=True, expected_features = expected_peer_features(wumbo_channels=True,
extra=[223]) extra=[21, 29])
assert conn['features'] == expected_features assert conn['features'] == expected_features
assert only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['features'] == expected_features assert only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['features'] == expected_features

View File

@ -1044,7 +1044,7 @@ def test_node_reannounce(node_factory, bitcoind):
lfeatures = expected_node_features() lfeatures = expected_node_features()
if l1.config('experimental-dual-fund'): 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. # Make sure it gets features correct.
assert only_one(l2.rpc.listnodes(l1.info['id'])['nodes'])['features'] == lfeatures assert only_one(l2.rpc.listnodes(l1.info['id'])['nodes'])['features'] == lfeatures

View File

@ -1469,7 +1469,8 @@ def test_plugin_feature_announce(node_factory):
extra = [] extra = []
if l1.config('experimental-dual-fund'): 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 # Check the featurebits we've set in the `init` message from
# feature-test.py. # feature-test.py.
@ -1706,10 +1707,9 @@ def test_feature_set(node_factory):
l1 = node_factory.get_node(options={"plugin": plugin}) l1 = node_factory.get_node(options={"plugin": plugin})
fs = l1.rpc.call('getfeatureset') fs = l1.rpc.call('getfeatureset')
extra = [233] if l1.config('experimental-dual-fund') else []
assert fs['init'] == expected_peer_features(extra=extra) assert fs['init'] == expected_peer_features()
assert fs['node'] == expected_node_features(extra=extra) assert fs['node'] == expected_node_features()
assert fs['channel'] == expected_channel_features() assert fs['channel'] == expected_channel_features()
assert 'invoice' in fs assert 'invoice' in fs

View File

@ -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 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 import bitstring
from pyln.client import Millisatoshi from pyln.client import Millisatoshi
from pyln.testing.utils import EXPERIMENTAL_DUAL_FUND
EXPERIMENTAL_FEATURES = env("EXPERIMENTAL_FEATURES", "0") == "1" EXPERIMENTAL_FEATURES = env("EXPERIMENTAL_FEATURES", "0") == "1"
COMPAT = env("COMPAT", "1") == "1" COMPAT = env("COMPAT", "1") == "1"
@ -29,6 +30,11 @@ def expected_peer_features(wumbo_channels=False, extra=[]):
features += [27] features += [27]
if wumbo_channels: if wumbo_channels:
features += [19] features += [19]
if EXPERIMENTAL_DUAL_FUND:
# option_anchor_outputs
features += [21]
# option_dual_fund
features += [29]
return hex_bits(features + extra) return hex_bits(features + extra)
@ -46,6 +52,11 @@ def expected_node_features(wumbo_channels=False, extra=[]):
features += [27] features += [27]
if wumbo_channels: if wumbo_channels:
features += [19] features += [19]
if EXPERIMENTAL_DUAL_FUND:
# option_anchor_outputs
features += [21]
# option_dual_fund
features += [29]
return hex_bits(features + extra) return hex_bits(features + extra)
@ -136,7 +147,7 @@ def first_channel_id(n1, n2):
def basic_fee(feerate): def basic_fee(feerate):
if EXPERIMENTAL_FEATURES: if EXPERIMENTAL_FEATURES or EXPERIMENTAL_DUAL_FUND:
# option_anchor_outputs # option_anchor_outputs
weight = 1124 weight = 1124
else: else: