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

Function test_payment_duplicate_uncommitted

tests/test_pay.py:438–469  ·  view source on GitHub ↗
(node_factory, executor)

Source from the content-addressed store, hash-verified

436
437
438def test_payment_duplicate_uncommitted(node_factory, executor):
439 # We want to test two payments at the same time, before we send commit
440 l1 = node_factory.get_node(options={'dev-disable-commit-after': 0})
441 l2 = node_factory.get_node()
442
443 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
444
445 l1.fundchannel(l2, 100000)
446
447 inv1 = l2.rpc.invoice(1000, 'inv1', 'inv1')
448
449 # Start first payment, but not yet in db.
450 fut = executor.submit(l1.rpc.xpay, inv1['bolt11'])
451
452 # Make sure that's started...
453 l1.daemon.wait_for_log('peer_out WIRE_UPDATE_ADD_HTLC')
454
455 # We should see it in listsendpays
456 payments = l1.rpc.listsendpays()['payments']
457 assert len(payments) == 1
458 assert payments[0]['status'] == 'pending' and payments[0]['payment_hash'] == inv1['payment_hash']
459
460 # Second one will be stopped.
461 fut2 = executor.submit(l1.rpc.xpay, inv1['bolt11'])
462
463 # Now, let it commit.
464 l1.rpc.dev_reenable_commit(l2.info['id'])
465
466 # First should succeed, second should be denied.
467 fut.result(TIMEOUT)
468 with pytest.raises(RpcError, match="Payment with groupid=[0-9]* still in progress, cannot retry before that completes"):
469 fut2.result(TIMEOUT)
470
471
472def test_pay_maxfee_shadow(node_factory):

Callers

nothing calls this directly

Calls 7

wait_for_logMethod · 0.80
listsendpaysMethod · 0.80
dev_reenable_commitMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45
invoiceMethod · 0.45

Tested by

no test coverage detected