MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_channel_features

Function test_channel_features

tests/test_connection.py:3474–3503  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

3472@pytest.mark.openchannel('v1')
3473@pytest.mark.openchannel('v2')
3474def test_channel_features(node_factory, bitcoind):
3475 l1, l2 = node_factory.line_graph(2, fundchannel=False)
3476
3477 bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'], 0.1)
3478 bitcoind.generate_block(1)
3479 wait_for(lambda: l1.rpc.listfunds()['outputs'] != [])
3480
3481 l1.rpc.fundchannel(l2.info['id'], 'all')
3482
3483 # We should see features in unconfirmed channels.
3484 chan = only_one(only_one(l1.rpc.listpeers()['peers'])['channels'])
3485 assert 'option_static_remotekey' in chan['features']
3486 if EXPERIMENTAL_FEATURES or l1.config('experimental-dual-fund'):
3487 assert 'option_anchor_outputs' in chan['features']
3488
3489 # l2 should agree.
3490 assert only_one(only_one(l2.rpc.listpeers()['peers'])['channels'])['features'] == chan['features']
3491
3492 # Confirm it.
3493 bitcoind.generate_block(1)
3494 wait_for(lambda: only_one(only_one(l1.rpc.listpeers()['peers'])['channels'])['state'] == 'CHANNELD_NORMAL')
3495 wait_for(lambda: only_one(only_one(l2.rpc.listpeers()['peers'])['channels'])['state'] == 'CHANNELD_NORMAL')
3496
3497 chan = only_one(only_one(l1.rpc.listpeers()['peers'])['channels'])
3498 assert 'option_static_remotekey' in chan['features']
3499 if EXPERIMENTAL_FEATURES or l1.config('experimental-dual-fund'):
3500 assert 'option_anchor_outputs' in chan['features']
3501
3502 # l2 should agree.
3503 assert only_one(only_one(l2.rpc.listpeers()['peers'])['channels'])['features'] == chan['features']
3504
3505
3506@pytest.mark.developer("need dev-force-features")

Callers

nothing calls this directly

Calls 9

wait_forFunction · 0.90
only_oneFunction · 0.90
line_graphMethod · 0.80
generate_blockMethod · 0.80
configMethod · 0.80
newaddrMethod · 0.45
listfundsMethod · 0.45
fundchannelMethod · 0.45
listpeersMethod · 0.45

Tested by

no test coverage detected