mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
test_lightningd.py: Clean up some uses of 'close' RPC.
This commit is contained in:
parent
68758a5d42
commit
0b331a2b60
@ -1333,13 +1333,10 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
self.pay(l1, p, 100000000)
|
self.pay(l1, p, 100000000)
|
||||||
|
|
||||||
# Now close
|
# Now close
|
||||||
for p in peers:
|
closes = [self.executor.submit(l1.rpc.close, p.info['id']) for p in peers]
|
||||||
self.assertRaisesRegex(ValueError,
|
|
||||||
"Channel close negotiation not finished",
|
|
||||||
l1.rpc.close, p.info['id'], False, 0)
|
|
||||||
|
|
||||||
for p in peers:
|
for c in closes:
|
||||||
p.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
|
c.result(30)
|
||||||
|
|
||||||
bitcoind.generate_block(1)
|
bitcoind.generate_block(1)
|
||||||
for p in peers:
|
for p in peers:
|
||||||
@ -3935,12 +3932,8 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
l1.rpc.dev_setfees()
|
l1.rpc.dev_setfees()
|
||||||
l1.daemon.wait_for_log('dev-setfees: fees now 21098/7654/321')
|
l1.daemon.wait_for_log('dev-setfees: fees now 21098/7654/321')
|
||||||
|
|
||||||
# This should return with an error, then close.
|
# This should return finish closing.
|
||||||
self.assertRaisesRegex(ValueError,
|
l1.rpc.close(l2.info['id'])
|
||||||
"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')
|
|
||||||
|
|
||||||
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
|
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
|
||||||
def test_fee_limits(self):
|
def test_fee_limits(self):
|
||||||
@ -3977,12 +3970,8 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
# 15sat/byte fee
|
# 15sat/byte fee
|
||||||
l1.daemon.wait_for_log('peer_out WIRE_REVOKE_AND_ACK')
|
l1.daemon.wait_for_log('peer_out WIRE_REVOKE_AND_ACK')
|
||||||
|
|
||||||
# This should return with an error, then close.
|
# This should wait for close to complete
|
||||||
self.assertRaisesRegex(ValueError,
|
l1.rpc.close(l3.info['id'])
|
||||||
"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')
|
|
||||||
|
|
||||||
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
|
@unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1")
|
||||||
def test_update_fee_reconnect(self):
|
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')
|
assert l2.daemon.is_in_log('got commitsig [0-9]*: feerate 14000')
|
||||||
|
|
||||||
# Now shutdown cleanly.
|
# Now shutdown cleanly.
|
||||||
self.assertRaisesRegex(ValueError,
|
l1.rpc.close(l2.info['id'])
|
||||||
"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')
|
|
||||||
|
|
||||||
# And should put closing into mempool.
|
# And should put closing into mempool.
|
||||||
l1.daemon.wait_for_log('sendrawtx exit 0')
|
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')
|
l2.daemon.wait_for_log('Handing back peer .* to master')
|
||||||
self.fund_channel(l1, l2, 10**6)
|
self.fund_channel(l1, l2, 10**6)
|
||||||
|
|
||||||
self.assertRaisesRegex(ValueError,
|
l1.rpc.close(l2.info['id'])
|
||||||
"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')
|
|
||||||
|
|
||||||
channels = l1.rpc.listpeers()['peers'][0]['channels']
|
channels = l1.rpc.listpeers()['peers'][0]['channels']
|
||||||
assert len(channels) == 3
|
assert len(channels) == 3
|
||||||
|
Loading…
Reference in New Issue
Block a user