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

Function test_pay_manual_exclude

tests/test_pay.py:5359–5385  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

5357
5358@pytest.mark.flaky(reruns=2)
5359def test_pay_manual_exclude(node_factory, bitcoind):
5360 l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True,
5361 opts={'xpay-handle-pay': False,
5362 'allow-deprecated-apis': True})
5363 l1_id = l1.rpc.getinfo()['id']
5364 l2_id = l2.rpc.getinfo()['id']
5365 l3_id = l3.rpc.getinfo()['id']
5366 chan12 = l1.rpc.listpeerchannels(l2_id)['channels'][0]
5367 chan23 = l2.rpc.listpeerchannels(l3_id)['channels'][0]
5368 scid12 = chan12['short_channel_id'] + '/' + str(chan12['direction'])
5369 scid23 = chan23['short_channel_id'] + '/' + str(chan23['direction'])
5370 inv = l3.rpc.invoice(amount_msat=123000, label='label1', description='desc')['bolt11']
5371 # Exclude the payer node id
5372 with pytest.raises(RpcError, match=r'Payer is manually excluded'):
5373 l1.rpc.pay(inv, exclude=[l1_id])
5374 # Exclude the direct payee node id
5375 with pytest.raises(RpcError, match=r'Payee is manually excluded'):
5376 l2.rpc.pay(inv, exclude=[l3_id])
5377 # Exclude intermediate node id
5378 with pytest.raises(RpcError, match=r'is not reachable directly and all routehints were unusable.'):
5379 l1.rpc.pay(inv, exclude=[l2_id])
5380 # Exclude intermediate channel id
5381 with pytest.raises(RpcError, match=r'is not reachable directly and all routehints were unusable.'):
5382 l1.rpc.pay(inv, exclude=[scid12])
5383 # Exclude direct channel id
5384 with pytest.raises(RpcError, match=r'is not reachable directly and all routehints were unusable.'):
5385 l2.rpc.pay(inv, exclude=[scid23])
5386
5387
5388@unittest.skipIf(TEST_NETWORK != 'regtest', "Invoice is network specific")

Callers

nothing calls this directly

Calls 5

line_graphMethod · 0.80
listpeerchannelsMethod · 0.80
getinfoMethod · 0.45
invoiceMethod · 0.45
payMethod · 0.45

Tested by

no test coverage detected