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

Function test_htlc_accepted_hook_crash

tests/test_plugin.py:2732–2758  ·  view source on GitHub ↗

Test that we do not hang incoming HTLCs if the hook plugin crashes. Reproduces #3748.

(node_factory, executor)

Source from the content-addressed store, hash-verified

2730
2731
2732def test_htlc_accepted_hook_crash(node_factory, executor):
2733 """Test that we do not hang incoming HTLCs if the hook plugin crashes.
2734
2735 Reproduces #3748.
2736 """
2737 plugin = os.path.join(os.getcwd(), 'tests/plugins/htlc_accepted-crash.py')
2738 l1 = node_factory.get_node()
2739 l2 = node_factory.get_node(
2740 options={'plugin': plugin},
2741 broken_log='plugin-htlc_accepted-crash.py: Hook handler for htlc_accepted failed with an exception. Returning safe fallback response'
2742 )
2743 l1.connect(l2)
2744 l1.fundchannel(l2)
2745
2746 i = l2.rpc.invoice(500, "crashpls", "crashpls")['bolt11']
2747
2748 # This should still succeed
2749
2750 f = executor.submit(l1.rpc.xpay, i)
2751
2752 l2.daemon.wait_for_log(r'Crashing on purpose...')
2753 l2.daemon.wait_for_log(
2754 r'Hook handler for htlc_accepted failed with an exception.'
2755 )
2756
2757 with pytest.raises(RpcError, match=r'Unexpected error \(temporary_node_failure\) from final node: disabling'):
2758 f.result(TIMEOUT)
2759
2760
2761def test_notify(node_factory):

Callers

nothing calls this directly

Calls 6

joinMethod · 0.80
wait_for_logMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45
invoiceMethod · 0.45

Tested by

no test coverage detected