mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
features: set OPT_VAR_ONION (bit 9) iff EXPERIMENTAL_FEATURES
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
9dc8cff9b4
commit
bb06bec891
@ -8,6 +8,9 @@ static const u32 our_features[] = {
|
||||
OPTIONAL_FEATURE(OPT_DATA_LOSS_PROTECT),
|
||||
OPTIONAL_FEATURE(OPT_UPFRONT_SHUTDOWN_SCRIPT),
|
||||
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES),
|
||||
#if EXPERIMENTAL_FEATURES
|
||||
OPTIONAL_FEATURE(OPT_VAR_ONION),
|
||||
#endif
|
||||
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES_EX),
|
||||
OPTIONAL_FEATURE(OPT_STATIC_REMOTEKEY),
|
||||
};
|
||||
|
@ -4,7 +4,7 @@ from fixtures import * # noqa: F401,F403
|
||||
from fixtures import TEST_NETWORK
|
||||
from flaky import flaky # noqa: F401
|
||||
from lightning import RpcError
|
||||
from utils import DEVELOPER, only_one, wait_for, sync_blockheight, VALGRIND, TIMEOUT, SLOW_MACHINE, COMPAT
|
||||
from utils import DEVELOPER, only_one, wait_for, sync_blockheight, VALGRIND, TIMEOUT, SLOW_MACHINE, COMPAT, expected_features
|
||||
from bitcoin.core import CMutableTransaction, CMutableTxOut
|
||||
|
||||
import binascii
|
||||
@ -1564,7 +1564,7 @@ def test_forget_channel(node_factory):
|
||||
|
||||
def test_peerinfo(node_factory, bitcoind):
|
||||
l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'may_reconnect': True})
|
||||
lfeatures = '28a2'
|
||||
lfeatures = expected_features()
|
||||
# Gossiping but no node announcement yet
|
||||
assert l1.rpc.getpeer(l2.info['id'])['connected']
|
||||
assert len(l1.rpc.getpeer(l2.info['id'])['channels']) == 0
|
||||
@ -1816,8 +1816,8 @@ def test_dataloss_protection(node_factory, bitcoind):
|
||||
l2 = node_factory.get_node(may_reconnect=True, log_all_io=True,
|
||||
feerates=(7500, 7500, 7500), allow_broken_log=True)
|
||||
|
||||
# features 1, 3, 7, 11 and 13 (0x28a2).
|
||||
lf = "28a2"
|
||||
lf = expected_features()
|
||||
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||
# l1 should send out WIRE_INIT (0010)
|
||||
l1.daemon.wait_for_log(r"\[OUT\] 0010"
|
||||
|
@ -2,7 +2,7 @@ from collections import Counter
|
||||
from fixtures import * # noqa: F401,F403
|
||||
from fixtures import TEST_NETWORK
|
||||
from lightning import RpcError
|
||||
from utils import wait_for, TIMEOUT, only_one, sync_blockheight
|
||||
from utils import wait_for, TIMEOUT, only_one, sync_blockheight, expected_features
|
||||
|
||||
import json
|
||||
import logging
|
||||
@ -1031,7 +1031,7 @@ def test_node_reannounce(node_factory, bitcoind):
|
||||
wait_for(lambda: 'alias' in only_one(l2.rpc.listnodes(l1.info['id'])['nodes']))
|
||||
assert only_one(l2.rpc.listnodes(l1.info['id'])['nodes'])['alias'].startswith('JUNIORBEAM')
|
||||
|
||||
lfeatures = '28a2'
|
||||
lfeatures = expected_features()
|
||||
|
||||
# Make sure it gets features correct.
|
||||
assert only_one(l2.rpc.listnodes(l1.info['id'])['nodes'])['features'] == lfeatures
|
||||
|
@ -5,7 +5,7 @@ from fixtures import TEST_NETWORK
|
||||
from flaky import flaky # noqa: F401
|
||||
from lightning import RpcError
|
||||
from threading import Event
|
||||
from utils import DEVELOPER, TIMEOUT, VALGRIND, sync_blockheight, only_one, wait_for, TailableProc
|
||||
from utils import DEVELOPER, TIMEOUT, VALGRIND, sync_blockheight, only_one, wait_for, TailableProc, EXPERIMENTAL_FEATURES
|
||||
from ephemeral_port_reserve import reserve
|
||||
|
||||
import json
|
||||
@ -1632,11 +1632,19 @@ def test_dev_demux(node_factory):
|
||||
def test_list_features_only(node_factory):
|
||||
features = subprocess.check_output(['lightningd/lightningd',
|
||||
'--list-features-only']).decode('utf-8').splitlines()
|
||||
expected = ['option_data_loss_protect/odd',
|
||||
'option_upfront_shutdown_script/odd',
|
||||
'option_gossip_queries/odd',
|
||||
'option_gossip_queries_ex/odd',
|
||||
'option_static_remotekey/odd']
|
||||
if EXPERIMENTAL_FEATURES:
|
||||
expected = ['option_data_loss_protect/odd',
|
||||
'option_upfront_shutdown_script/odd',
|
||||
'option_gossip_queries/odd',
|
||||
'option_var_onion_optin/odd',
|
||||
'option_gossip_queries_ex/odd',
|
||||
'option_static_remotekey/odd']
|
||||
else:
|
||||
expected = ['option_data_loss_protect/odd',
|
||||
'option_upfront_shutdown_script/odd',
|
||||
'option_gossip_queries/odd',
|
||||
'option_gossip_queries_ex/odd',
|
||||
'option_static_remotekey/odd']
|
||||
assert features == expected
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ from collections import OrderedDict
|
||||
from fixtures import * # noqa: F401,F403
|
||||
from flaky import flaky # noqa: F401
|
||||
from lightning import RpcError, Millisatoshi
|
||||
from utils import DEVELOPER, only_one, sync_blockheight, TIMEOUT, wait_for
|
||||
from utils import DEVELOPER, only_one, sync_blockheight, TIMEOUT, wait_for, EXPERIMENTAL_FEATURES
|
||||
|
||||
import json
|
||||
import os
|
||||
@ -534,10 +534,14 @@ def test_htlc_accepted_hook_forward_restart(node_factory, executor):
|
||||
logline = l2.daemon.wait_for_log(r'Onion written to')
|
||||
fname = re.search(r'Onion written to (.*\.json)', logline).group(1)
|
||||
onion = json.load(open(fname))
|
||||
assert re.match(r'^00006700000.000100000000000003e8000000..000000000000000000000000$', onion['payload'])
|
||||
assert len(onion['payload']) == 64
|
||||
if EXPERIMENTAL_FEATURES:
|
||||
assert onion['type'] == 'tlv'
|
||||
assert re.match(r'^020203e80401..0608................$', onion['payload'])
|
||||
else:
|
||||
assert onion['type'] == 'legacy'
|
||||
assert re.match(r'^00006700000.000100000000000003e8000000..000000000000000000000000$', onion['payload'])
|
||||
assert len(onion['payload']) == 64
|
||||
assert len(onion['shared_secret']) == 64
|
||||
assert onion['type'] == 'legacy'
|
||||
assert onion['forward_amount'] == '1000msat'
|
||||
assert len(onion['next_onion']) == 2 * (1300 + 32 + 33 + 1)
|
||||
|
||||
|
@ -4,3 +4,13 @@ from pyln.testing.utils import env, only_one, wait_for, write_config, TailablePr
|
||||
|
||||
EXPERIMENTAL_FEATURES = env("EXPERIMENTAL_FEATURES", "0") == "1"
|
||||
COMPAT = env("COMPAT", "1") == "1"
|
||||
|
||||
|
||||
def expected_features():
|
||||
"""Return the expected features hexstring for this configuration"""
|
||||
if EXPERIMENTAL_FEATURES:
|
||||
# features 1, 3, 7, 9, 11 and 13 (0x2aa2).
|
||||
return "2aa2"
|
||||
else:
|
||||
# features 1, 3, 7, 11 and 13 (0x28a2).
|
||||
return "28a2"
|
||||
|
Loading…
Reference in New Issue
Block a user