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

Function test_openchannel_hook_error_handling

tests/test_plugin.py:797–816  ·  view source on GitHub ↗

l2 uses a plugin that should fatal() crash the node. This is because the plugin rejects a channel while also setting a close_to address which isn't allowed.

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

795@pytest.mark.openchannel('v1')
796@pytest.mark.openchannel('v2')
797def test_openchannel_hook_error_handling(node_factory, bitcoind):
798 """ l2 uses a plugin that should fatal() crash the node.
799
800 This is because the plugin rejects a channel while
801 also setting a close_to address which isn't allowed.
802 """
803 opts = {'plugin': os.path.join(os.getcwd(), 'tests/plugins/openchannel_hook_accepter.py')}
804 # openchannel_reject_but_set_close_to.py')}
805 l1 = node_factory.get_node()
806 l2 = node_factory.get_node(options=opts,
807 expect_fail=True,
808 broken_log='lightningd: ',
809 may_fail=True)
810 l1.connect(l2)
811 l1.fundwallet(10**6)
812
813 # next fundchannel should fail fatal() for l2
814 with pytest.raises(RpcError, match=r'Owning subdaemon (openingd|dualopend) died'):
815 l1.rpc.fundchannel(l2.info['id'], 100004)
816 assert l2.daemon.is_in_log("BROKEN.*Plugin rejected openchannel[2]? but also set close_to")
817
818
819@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 6

joinMethod · 0.80
fundwalletMethod · 0.80
is_in_logMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45

Tested by

no test coverage detected