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)
| 1872 | @pytest.mark.openchannel('v1') |
| 1873 | @pytest.mark.openchannel('v2') |
| 1874 | def test_plugin_feature_announce(node_factory): |
| 1875 | """Check that features registered by plugins show up in messages. |
| 1876 | |
| 1877 | l1 is the node under test, l2 only serves as the counterparty for a |
| 1878 | channel to check the featurebits in the `channel_announcement`. The plugin |
| 1879 | registers an individual featurebit for each of the locations we can stash |
| 1880 | feature bits in: |
| 1881 | |
| 1882 | - 1 << 201 for `init` messages |
| 1883 | - 1 << 203 for `node_announcement` |
| 1884 | - 1 << 205 for bolt11 invoices |
| 1885 | |
| 1886 | """ |
| 1887 | plugin = os.path.join(os.path.dirname(__file__), 'plugins/feature-test.py') |
| 1888 | l1, l2 = node_factory.line_graph( |
| 1889 | 2, opts=[{'plugin': plugin, 'log-level': 'io'}, {}], |
| 1890 | wait_for_announce=True |
| 1891 | ) |
| 1892 | |
| 1893 | # Check the featurebits we've set in the `init` message from |
| 1894 | # feature-test.py. |
| 1895 | assert l1.daemon.is_in_log(r'\[OUT\] 001000021100....{}' |
| 1896 | .format(expected_peer_features(extra=[201]))) |
| 1897 | |
| 1898 | # Check the invoice featurebit we set in feature-test.py |
| 1899 | inv = l1.rpc.invoice(123, 'lbl', 'desc')['bolt11'] |
| 1900 | details = Invoice.decode(inv) |
| 1901 | assert(details.featurebits.int & (1 << 205) != 0) |
| 1902 | |
| 1903 | # Check the featurebit set in the `node_announcement` |
| 1904 | node = l1.rpc.listnodes(l1.info['id'])['nodes'][0] |
| 1905 | assert node['features'] == expected_node_features(extra=[203]) |
| 1906 | |
| 1907 | |
| 1908 | def test_plugin_feature_remove(node_factory): |
nothing calls this directly
no test coverage detected