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

Function test_plugin_feature_announce

tests/test_plugin.py:1990–2021  ·  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

1988@pytest.mark.openchannel('v1')
1989@pytest.mark.openchannel('v2')
1990def test_plugin_feature_announce(node_factory):
1991 """Check that features registered by plugins show up in messages.
1992
1993 l1 is the node under test, l2 only serves as the counterparty for a
1994 channel to check the featurebits in the `channel_announcement`. The plugin
1995 registers an individual featurebit for each of the locations we can stash
1996 feature bits in:
1997
1998 - 1 << 201 for `init` messages
1999 - 1 << 203 for `node_announcement`
2000 - 1 << 205 for bolt11 invoices
2001
2002 """
2003 plugin = os.path.join(os.path.dirname(__file__), 'plugins/feature-test.py')
2004 l1, l2 = node_factory.line_graph(
2005 2, opts=[{'plugin': plugin, 'log-level': 'io'}, {}],
2006 wait_for_announce=True
2007 )
2008
2009 # Check the featurebits we've set in the `init` message from
2010 # feature-test.py.
2011 assert l1.daemon.is_in_log(r'\[OUT\] 001000021100....{}'
2012 .format(expected_peer_features(extra=[201])))
2013
2014 # Check the invoice featurebit we set in feature-test.py
2015 inv = l1.rpc.invoice(123, 'lbl', 'desc')['bolt11']
2016 details = Invoice.decode(inv)
2017 assert(details.featurebits.int & (1 << 205) != 0)
2018
2019 # Check the featurebit set in the `node_announcement`
2020 node = l1.rpc.listnodes(l1.info['id'])['nodes'][0]
2021 assert node['features'] == expected_node_features(extra=[203])
2022
2023
2024def test_plugin_feature_remove(node_factory):

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected