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

Function test_routehint_tous

tests/test_pay.py:5194–5216  ·  view source on GitHub ↗

Test bug where trying to pay an invoice from an *offline* node which gives a routehint straight to us causes an issue

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

5192
5193
5194def test_routehint_tous(node_factory, bitcoind):
5195 """
5196Test bug where trying to pay an invoice from an *offline* node which
5197gives a routehint straight to us causes an issue
5198"""
5199
5200 # Existence of l1 makes l3 use l2 for routehint (otherwise it sees deadend)
5201 l1, l2 = node_factory.line_graph(2, wait_for_announce=True)
5202 scid12 = first_scid(l1, l2)
5203 l3 = node_factory.get_node()
5204 l3.rpc.connect(l2.info['id'], 'localhost', l2.port)
5205 scid23, _ = l2.fundchannel(l3, 1000000, announce_channel=False)
5206 # Make sure l3 sees l1->l2 channel.
5207 l3.wait_channel_active(scid12)
5208
5209 inv = l3.rpc.invoice(10, "test", "test")['bolt11']
5210 decoded = l3.rpc.decode(inv)
5211 assert(only_one(only_one(decoded['routes']))['short_channel_id']
5212 == only_one(l3.rpc.listpeerchannels()['channels'])['alias']['remote'])
5213
5214 l3.stop()
5215 with pytest.raises(RpcError, match=r'Failed: We could not find a usable set of paths. All 1 channels to the destination are disabled.'):
5216 l2.rpc.xpay(inv)
5217
5218
5219def test_setchannel_enforcement_delay(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 12

first_scidFunction · 0.90
only_oneFunction · 0.90
line_graphMethod · 0.80
wait_channel_activeMethod · 0.80
listpeerchannelsMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45
invoiceMethod · 0.45
decodeMethod · 0.45
stopMethod · 0.45
xpayMethod · 0.45

Tested by

no test coverage detected