mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 16:14:23 +01:00
tests/test_lightningd.py: test closing and shutdown reconnection.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -696,6 +696,58 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
for i in range(len(disconnects)):
|
for i in range(len(disconnects)):
|
||||||
l1.daemon.wait_for_log('Already have funding locked in')
|
l1.daemon.wait_for_log('Already have funding locked in')
|
||||||
assert l2.rpc.listinvoice('testpayment2')[0]['complete'] == True
|
assert l2.rpc.listinvoice('testpayment2')[0]['complete'] == True
|
||||||
|
|
||||||
|
def test_shutdown_reconnect(self):
|
||||||
|
disconnects = ['-WIRE_SHUTDOWN',
|
||||||
|
'@WIRE_SHUTDOWN',
|
||||||
|
'+WIRE_SHUTDOWN']
|
||||||
|
l1 = self.node_factory.get_node(legacy=False, disconnect=disconnects)
|
||||||
|
l2 = self.node_factory.get_node(legacy=False)
|
||||||
|
l1.rpc.connect('localhost', l2.info['port'], l2.info['id'])
|
||||||
|
|
||||||
|
self.fund_channel(l1, l2, 10**6)
|
||||||
|
self.pay(l1,l2,200000000,'testpayment2')
|
||||||
|
|
||||||
|
assert l1.bitcoin.rpc.getmempoolinfo()['size'] == 0
|
||||||
|
|
||||||
|
# This should return, then close.
|
||||||
|
l1.rpc.close(l2.info['id']);
|
||||||
|
l1.daemon.wait_for_log('-> CHANNELD_SHUTTING_DOWN')
|
||||||
|
l2.daemon.wait_for_log('-> CHANNELD_SHUTTING_DOWN')
|
||||||
|
|
||||||
|
l1.daemon.wait_for_log('-> CLOSINGD_SIGEXCHANGE')
|
||||||
|
l2.daemon.wait_for_log('-> CLOSINGD_SIGEXCHANGE')
|
||||||
|
|
||||||
|
# And should put closing into mempool.
|
||||||
|
l1.daemon.wait_for_log('sendrawtx exit 0')
|
||||||
|
l2.daemon.wait_for_log('sendrawtx exit 0')
|
||||||
|
assert l1.bitcoin.rpc.getmempoolinfo()['size'] == 1
|
||||||
|
|
||||||
|
def test_closing_negotiation_reconnect(self):
|
||||||
|
disconnects = ['-WIRE_CLOSING_SIGNED',
|
||||||
|
'@WIRE_CLOSING_SIGNED',
|
||||||
|
'+WIRE_CLOSING_SIGNED']
|
||||||
|
l1 = self.node_factory.get_node(legacy=False, disconnect=disconnects)
|
||||||
|
l2 = self.node_factory.get_node(legacy=False)
|
||||||
|
l1.rpc.connect('localhost', l2.info['port'], l2.info['id'])
|
||||||
|
|
||||||
|
self.fund_channel(l1, l2, 10**6)
|
||||||
|
self.pay(l1,l2,200000000,'testpayment2')
|
||||||
|
|
||||||
|
assert l1.bitcoin.rpc.getmempoolinfo()['size'] == 0
|
||||||
|
|
||||||
|
# This should return, then close.
|
||||||
|
l1.rpc.close(l2.info['id']);
|
||||||
|
l1.daemon.wait_for_log('-> CHANNELD_SHUTTING_DOWN')
|
||||||
|
l2.daemon.wait_for_log('-> CHANNELD_SHUTTING_DOWN')
|
||||||
|
|
||||||
|
l1.daemon.wait_for_log('-> CLOSINGD_SIGEXCHANGE')
|
||||||
|
l2.daemon.wait_for_log('-> CLOSINGD_SIGEXCHANGE')
|
||||||
|
|
||||||
|
# And should put closing into mempool.
|
||||||
|
l1.daemon.wait_for_log('sendrawtx exit 0')
|
||||||
|
l2.daemon.wait_for_log('sendrawtx exit 0')
|
||||||
|
assert l1.bitcoin.rpc.getmempoolinfo()['size'] == 1
|
||||||
|
|
||||||
def test_json_addfunds(self):
|
def test_json_addfunds(self):
|
||||||
sat = 10**6
|
sat = 10**6
|
||||||
|
|||||||
Reference in New Issue
Block a user