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

Function test_htlc_accepted_hook_malformedtlvs

tests/test_plugin.py:2869–2885  ·  view source on GitHub ↗

Passes an custom extra tlv field to the hooks return that is malformed and should cause a broken log. l1 -- l2 -- l3

(node_factory)

Source from the content-addressed store, hash-verified

2867
2868
2869def test_htlc_accepted_hook_malformedtlvs(node_factory):
2870 """ Passes an custom extra tlv field to the hooks return that is malformed
2871 and should cause a broken log.
2872 l1 -- l2 -- l3
2873 """
2874 plugin = os.path.join(os.path.dirname(__file__), 'plugins/htlc_accepted-customtlv.py')
2875 l1, l2, l3 = node_factory.line_graph(3, opts=[{}, {'plugin': plugin, 'broken_log': "lightningd: ", 'may_fail': True}, {}], wait_for_announce=True)
2876
2877 mal_tlv = "fe00010001020539fdffff012a" # is malformed, types are 65537 and 65535 not in asc order.
2878 l2.rpc.setcustomtlvs(tlvs=mal_tlv)
2879 inv = l3.rpc.invoice(1000, 'customtlvs-maltlvs', '')
2880 phash = inv['payment_hash']
2881 route = l1.single_route(l3.info['id'], 1000)
2882
2883 # Here shouldn't use `pay` command because l2 should fail with a broken log.
2884 l1.rpc.sendpay(route, phash, payment_secret=inv['payment_secret'])
2885 assert l2.daemon.wait_for_log("BROKEN.*htlc_accepted_hook returned bad extra_tlvs")
2886
2887
2888def test_hook_dep(node_factory):

Callers

nothing calls this directly

Calls 6

joinMethod · 0.80
line_graphMethod · 0.80
single_routeMethod · 0.80
sendpayMethod · 0.80
wait_for_logMethod · 0.80
invoiceMethod · 0.45

Tested by

no test coverage detected