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

Function test_reconnect_sender_add1

tests/test_connection.py:743–775  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

741@pytest.mark.openchannel('v1')
742@pytest.mark.openchannel('v2')
743def test_reconnect_sender_add1(node_factory):
744 # Fail after add is OK, will cause payment failure though.
745 # Make sure it doesn't send commit before it sees disconnect though.
746 disconnects = ['-WIRE_UPDATE_ADD_HTLC',
747 '+WIRE_UPDATE_ADD_HTLC']
748
749 # Feerates identical so we don't get gratuitous commit to update them
750 l1 = node_factory.get_node(disconnect=disconnects,
751 may_reconnect=True,
752 options={'commit-time': 2000},
753 feerates=(7500, 7500, 7500, 7500))
754 l2 = node_factory.get_node(may_reconnect=True)
755 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
756
757 l1.fundchannel(l2, 10**6)
758
759 amt = 200000000
760 inv = l2.rpc.invoice(amt, 'test_reconnect_sender_add1', 'desc')
761 rhash = inv['payment_hash']
762 assert only_one(l2.rpc.listinvoices('test_reconnect_sender_add1')['invoices'])['status'] == 'unpaid'
763
764 route = [{'amount_msat': amt, 'id': l2.info['id'], 'delay': 5, 'channel': first_scid(l1, l2)}]
765
766 for i in range(0, len(disconnects)):
767 with pytest.raises(RpcError):
768 l1.rpc.sendpay(route, rhash, payment_secret=inv['payment_secret'])
769 l1.rpc.waitsendpay(rhash)
770
771 # Wait for reconnection.
772 l1.daemon.wait_for_log('Already have funding locked in')
773
774 # This will send commit, so will reconnect as required.
775 l1.rpc.sendpay(route, rhash, payment_secret=inv['payment_secret'])
776
777
778@pytest.mark.developer

Callers

nothing calls this directly

Calls 10

only_oneFunction · 0.90
first_scidFunction · 0.90
sendpayMethod · 0.80
waitsendpayMethod · 0.80
wait_for_logMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45
invoiceMethod · 0.45
listinvoicesMethod · 0.45

Tested by

no test coverage detected