Browse Source

test_lightningd.py: Clean up some uses of 'close' RPC.

ppa-0.6.1
ZmnSCPxj 7 years ago
committed by Rusty Russell
parent
commit
0b331a2b60
  1. 37
      tests/test_lightningd.py

37
tests/test_lightningd.py

@ -1333,13 +1333,10 @@ class LightningDTests(BaseLightningDTests):
self.pay(l1, p, 100000000)
# Now close
for p in peers:
self.assertRaisesRegex(ValueError,
"Channel close negotiation not finished",
l1.rpc.close, p.info['id'], False, 0)
closes = [self.executor.submit(l1.rpc.close, p.info['id']) for p in peers]
for p in peers:
p.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
for c in closes:
c.result(30)
bitcoind.generate_block(1)
for p in peers:
@ -3935,12 +3932,8 @@ class LightningDTests(BaseLightningDTests):
l1.rpc.dev_setfees()
l1.daemon.wait_for_log('dev-setfees: fees now 21098/7654/321')
# This should return with an error, then close.
self.assertRaisesRegex(ValueError,
"Channel close negotiation not finished",
l1.rpc.close, l2.info['id'], False, 0)
l1.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
l2.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
# This should return finish closing.
l1.rpc.close(l2.info['id'])
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
def test_fee_limits(self):
@ -3977,12 +3970,8 @@ class LightningDTests(BaseLightningDTests):
# 15sat/byte fee
l1.daemon.wait_for_log('peer_out WIRE_REVOKE_AND_ACK')
# This should return with an error, then close.
self.assertRaisesRegex(ValueError,
"Channel close negotiation not finished",
l1.rpc.close, l3.info['id'], False, 0)
l1.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
l3.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
# This should wait for close to complete
l1.rpc.close(l3.info['id'])
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
def test_update_fee_reconnect(self):
@ -4011,11 +4000,7 @@ class LightningDTests(BaseLightningDTests):
assert l2.daemon.is_in_log('got commitsig [0-9]*: feerate 14000')
# Now shutdown cleanly.
self.assertRaisesRegex(ValueError,
"Channel close negotiation not finished",
l1.rpc.close, l2.info['id'], False, 0)
l1.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
l2.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
l1.rpc.close(l2.info['id'])
# And should put closing into mempool.
l1.daemon.wait_for_log('sendrawtx exit 0')
@ -4149,11 +4134,7 @@ class LightningDTests(BaseLightningDTests):
l2.daemon.wait_for_log('Handing back peer .* to master')
self.fund_channel(l1, l2, 10**6)
self.assertRaisesRegex(ValueError,
"Channel close negotiation not finished",
l1.rpc.close, l2.info['id'], False, 0)
l1.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
l2.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
l1.rpc.close(l2.info['id'])
channels = l1.rpc.listpeers()['peers'][0]['channels']
assert len(channels) == 3

Loading…
Cancel
Save