Browse Source

test_lightningd.py: test reconnection on htlc_add.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
6dbaa3ace6
  1. 26
      tests/test_lightningd.py

26
tests/test_lightningd.py

@ -568,6 +568,32 @@ class LightningDTests(BaseLightningDTests):
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
""" """

Loading…
Cancel
Save