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

Function test_plugin_feature_announce

tests/test_plugin.py:1568–1604  ·  view source on GitHub ↗

Check that features registered by plugins show up in messages. l1 is the node under test, l2 only serves as the counterparty for a channel to check the featurebits in the `channel_announcement`. The plugin registers an individual featurebit for each of the locations we can stash fea

(node_factory)

Source from the content-addressed store, hash-verified

1566@pytest.mark.openchannel('v1')
1567@pytest.mark.openchannel('v2')
1568def test_plugin_feature_announce(node_factory):
1569 """Check that features registered by plugins show up in messages.
1570
1571 l1 is the node under test, l2 only serves as the counterparty for a
1572 channel to check the featurebits in the `channel_announcement`. The plugin
1573 registers an individual featurebit for each of the locations we can stash
1574 feature bits in:
1575
1576 - 1 << 201 for `init` messages
1577 - 1 << 203 for `node_announcement`
1578 - 1 << 205 for bolt11 invoices
1579
1580 """
1581 plugin = os.path.join(os.path.dirname(__file__), 'plugins/feature-test.py')
1582 l1, l2 = node_factory.line_graph(
1583 2, opts=[{'plugin': plugin, 'log-level': 'io'}, {}],
1584 wait_for_announce=True
1585 )
1586
1587 extra = []
1588 if l1.config('experimental-dual-fund'):
1589 extra.append(21) # option-anchor-outputs
1590 extra.append(29) # option-dual-fund
1591
1592 # Check the featurebits we've set in the `init` message from
1593 # feature-test.py.
1594 assert l1.daemon.is_in_log(r'\[OUT\] 001000022100....{}'
1595 .format(expected_peer_features(extra=[201] + extra)))
1596
1597 # Check the invoice featurebit we set in feature-test.py
1598 inv = l1.rpc.invoice(123, 'lbl', 'desc')['bolt11']
1599 details = Invoice.decode(inv)
1600 assert(details.featurebits.int & (1 << 205) != 0)
1601
1602 # Check the featurebit set in the `node_announcement`
1603 node = l1.rpc.listnodes(l1.info['id'])['nodes'][0]
1604 assert node['features'] == expected_node_features(extra=[203] + extra)
1605
1606
1607def test_hook_chaining(node_factory):

Callers

nothing calls this directly

Calls 9

expected_peer_featuresFunction · 0.90
expected_node_featuresFunction · 0.90
joinMethod · 0.80
line_graphMethod · 0.80
configMethod · 0.80
is_in_logMethod · 0.80
invoiceMethod · 0.45
decodeMethod · 0.45
listnodesMethod · 0.45

Tested by

no test coverage detected