mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
test_lightningd.py: test reconnection on htlc_add.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -567,7 +567,33 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
ret = l1.rpc.connect('localhost', l2.info['port'], l2.info['id'])
|
ret = l1.rpc.connect('localhost', l2.info['port'], l2.info['id'])
|
||||||
|
|
||||||
self.fund_channel(l1, l2, 10**6)
|
self.fund_channel(l1, l2, 10**6)
|
||||||
|
|
||||||
|
def test_reconnect_add_htlc(self):
|
||||||
|
# Fail after add is OK, will cause payment failure though.
|
||||||
|
disconnects = ['-WIRE_UPDATE_ADD_HTLC',
|
||||||
|
'@WIRE_UPDATE_ADD_HTLC',
|
||||||
|
'+WIRE_UPDATE_ADD_HTLC']
|
||||||
|
l1 = self.node_factory.get_node(legacy=False, disconnect=disconnects)
|
||||||
|
l2 = self.node_factory.get_node(legacy=False)
|
||||||
|
ret = l1.rpc.connect('localhost', l2.info['port'], l2.info['id'])
|
||||||
|
|
||||||
|
self.fund_channel(l1, l2, 10**6)
|
||||||
|
|
||||||
|
amt = 200000000
|
||||||
|
rhash = l2.rpc.invoice(amt, 'testpayment2')['rhash']
|
||||||
|
assert l2.rpc.listinvoice('testpayment2')[0]['complete'] == False
|
||||||
|
|
||||||
|
rhash = l2.rpc.invoice(amt, 'testpayment3')['rhash']
|
||||||
|
route = [ { 'msatoshi' : amt, 'id' : l2.info['id'], 'delay' : 5, 'channel': '1:1:1'} ]
|
||||||
|
# First time, it will fail because it doesn't send commit.
|
||||||
|
self.assertRaises(ValueError, l1.rpc.sendpay, to_json(route), rhash)
|
||||||
|
# Wait for reconnection.
|
||||||
|
l1.daemon.wait_for_log('Already have funding locked in')
|
||||||
|
# This will send commit, so will reconnect.
|
||||||
|
l1.rpc.sendpay(to_json(route), rhash)
|
||||||
|
l1.daemon.wait_for_log('Already have funding locked in')
|
||||||
|
l1.daemon.wait_for_log('Already have funding locked in')
|
||||||
|
|
||||||
def test_json_addfunds(self):
|
def test_json_addfunds(self):
|
||||||
""" Attempt to add funds
|
""" Attempt to add funds
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user