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

Function test_partial_payment_timeout

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

Source from the content-addressed store, hash-verified

3252
3253
3254def test_partial_payment_timeout(node_factory, bitcoind):
3255 l1, l2 = node_factory.line_graph(2)
3256
3257 inv = l2.rpc.invoice(1000, 'inv', 'inv')
3258 paysecret = l2.rpc.decode(inv['bolt11'])['payment_secret']
3259
3260 route = l1.single_route(l2.info['id'], 500)
3261 l1.rpc.sendpay(
3262 route=route,
3263 payment_hash=inv['payment_hash'],
3264 amount_msat=1000,
3265 bolt11=inv['bolt11'],
3266 payment_secret=paysecret,
3267 partid=1,
3268 groupid=1,
3269 )
3270
3271 with pytest.raises(RpcError, match=r'WIRE_MPP_TIMEOUT'):
3272 l1.rpc.waitsendpay(
3273 payment_hash=inv['payment_hash'],
3274 timeout=70 + TIMEOUT // 4,
3275 partid=1,
3276 groupid=1,
3277 )
3278 l2.daemon.wait_for_log(r'HTLC set contains 1 HTLCs, for a total of 500msat out of 1000msat \(payment_secret\)')
3279
3280 # We can still pay it normally.
3281 l1.rpc.sendpay(
3282 route=route,
3283 payment_hash=inv['payment_hash'],
3284 amount_msat=1000,
3285 bolt11=inv['bolt11'],
3286 payment_secret=paysecret,
3287 partid=1,
3288 groupid=2
3289 )
3290 l1.rpc.sendpay(
3291 route=route,
3292 payment_hash=inv['payment_hash'],
3293 amount_msat=1000,
3294 bolt11=inv['bolt11'],
3295 payment_secret=paysecret,
3296 partid=2,
3297 groupid=2
3298 )
3299 l1.rpc.waitsendpay(payment_hash=inv['payment_hash'], timeout=TIMEOUT, partid=1, groupid=2)
3300 l1.rpc.waitsendpay(payment_hash=inv['payment_hash'], timeout=TIMEOUT, partid=2, groupid=2)
3301 l2.daemon.wait_for_log(r'HTLC set contains 1 HTLCs, for a total of 500msat out of 1000msat \(payment_secret\)')
3302 l2.daemon.wait_for_log(r'HTLC set contains 2 HTLCs, for a total of 1000msat out of 1000msat \(payment_secret\)')
3303
3304
3305@pytest.mark.slow_test

Callers

nothing calls this directly

Calls 7

line_graphMethod · 0.80
single_routeMethod · 0.80
sendpayMethod · 0.80
waitsendpayMethod · 0.80
wait_for_logMethod · 0.80
invoiceMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected