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

Function test_htlc_accepted_hook_fwdto

tests/test_plugin.py:3002–3016  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

3000
3001
3002def test_htlc_accepted_hook_fwdto(node_factory):
3003 plugin = os.path.join(os.path.dirname(__file__), 'plugins/htlc_accepted-fwdto.py')
3004 l1, l2, l3 = node_factory.line_graph(3, opts=[{}, {'plugin': plugin}, {}], wait_for_announce=True)
3005
3006 # Add some balance
3007 l1.rpc.xpay(l2.rpc.invoice(10**9 // 2, 'balance', '')['bolt11'])
3008 wait_for(lambda: only_one(l1.rpc.listpeerchannels()['channels'])['htlcs'] == [])
3009
3010 # make it forward back down same channel.
3011 l2.rpc.setfwdto(only_one(l1.rpc.listpeerchannels()['channels'])['channel_id'])
3012 inv = l3.rpc.invoice(42, 'fwdto', '')['bolt11']
3013 with pytest.raises(RpcError, match=r"Unexpected error \(invalid_onion_hmac\) from intermediate node: disabling the invoice's route hint"):
3014 l1.rpc.xpay(inv)
3015
3016 assert l2.rpc.listforwards()['forwards'][0]['out_channel'] == only_one(l1.rpc.listpeerchannels()['channels'])['short_channel_id']
3017
3018
3019def test_dynamic_args(node_factory):

Callers

nothing calls this directly

Calls 8

wait_forFunction · 0.90
only_oneFunction · 0.90
joinMethod · 0.80
line_graphMethod · 0.80
listpeerchannelsMethod · 0.80
listforwardsMethod · 0.80
xpayMethod · 0.45
invoiceMethod · 0.45

Tested by

no test coverage detected