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

Function test_partial_payment_restart

tests/test_pay.py:3306–3346  ·  view source on GitHub ↗

Test that we recover a set when we restart

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

3304
3305@pytest.mark.slow_test
3306def test_partial_payment_restart(node_factory, bitcoind):
3307 """Test that we recover a set when we restart"""
3308 l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True,
3309 opts=[{}]
3310 + [{'may_reconnect': True}] * 2)
3311
3312 inv = l3.rpc.invoice(1000, 'inv', 'inv')
3313 paysecret = l3.rpc.decode(inv['bolt11'])['payment_secret']
3314
3315 route = l1.single_route(l3.info['id'], 500)
3316
3317 l1.rpc.sendpay(
3318 route=route,
3319 payment_hash=inv['payment_hash'],
3320 amount_msat=1000,
3321 bolt11=inv['bolt11'],
3322 payment_secret=paysecret,
3323 partid=1,
3324 groupid=1,
3325 )
3326
3327 wait_for(lambda: [f['status'] for f in l2.rpc.listforwards()['forwards']] == ['offered'])
3328
3329 # Restart, and make sure it's reconnected to l2.
3330 l3.restart()
3331 print(l2.rpc.listpeers())
3332 wait_for(lambda: [p['connected'] for p in l2.rpc.listpeers()['peers']] == [True, True])
3333
3334 # Pay second part.
3335 l1.rpc.sendpay(
3336 route=route,
3337 payment_hash=inv['payment_hash'],
3338 amount_msat=1000,
3339 bolt11=inv['bolt11'],
3340 payment_secret=paysecret,
3341 partid=2,
3342 groupid=1,
3343 )
3344
3345 l1.rpc.waitsendpay(payment_hash=inv['payment_hash'], timeout=TIMEOUT, partid=1)
3346 l1.rpc.waitsendpay(payment_hash=inv['payment_hash'], timeout=TIMEOUT, partid=2)
3347
3348
3349def test_partial_payment_htlc_loss(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 10

wait_forFunction · 0.90
line_graphMethod · 0.80
single_routeMethod · 0.80
sendpayMethod · 0.80
listforwardsMethod · 0.80
restartMethod · 0.80
waitsendpayMethod · 0.80
invoiceMethod · 0.45
decodeMethod · 0.45
listpeersMethod · 0.45

Tested by

no test coverage detected