mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
pytest: Fix test_pay_disconnect
We are now too quick in disabling the channel for us to attempt a payment. We need to separate into getroute and sendpay to trigger this now. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
dafd000c2a
commit
2e5047f74b
@@ -2995,20 +2995,23 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
# Wait for route propagation.
|
# Wait for route propagation.
|
||||||
self.wait_for_routes(l1, [chanid])
|
self.wait_for_routes(l1, [chanid])
|
||||||
|
|
||||||
inv = l2.rpc.invoice(123000, 'test_pay_disconnect', 'description')['bolt11']
|
inv = l2.rpc.invoice(123000, 'test_pay_disconnect', 'description')
|
||||||
|
rhash = inv['payment_hash']
|
||||||
|
|
||||||
|
# Can't use `pay` since that'd notice that we can't route, due to disabling channel_update
|
||||||
|
route = l1.rpc.getroute(l2.info['id'], 123000, 1)["route"]
|
||||||
|
|
||||||
# Make l2 upset by asking for crazy fee.
|
# Make l2 upset by asking for crazy fee.
|
||||||
l1.rpc.dev_setfees('150000')
|
l1.rpc.dev_setfees('150000')
|
||||||
|
|
||||||
# Wait for l1 notice
|
# Wait for l1 notice
|
||||||
l1.daemon.wait_for_log('STATUS_FAIL_PEER_BAD')
|
l1.daemon.wait_for_log('STATUS_FAIL_PEER_BAD')
|
||||||
|
|
||||||
# Can't pay while its offline.
|
# Can't pay while its offline.
|
||||||
self.assertRaises(ValueError, l1.rpc.pay, inv)
|
self.assertRaises(ValueError, l1.rpc.sendpay, to_json(route), rhash)
|
||||||
l1.daemon.wait_for_log('Failing: first peer not ready: WIRE_TEMPORARY_CHANNEL_FAILURE')
|
l1.daemon.wait_for_log('Failing: first peer not ready: WIRE_TEMPORARY_CHANNEL_FAILURE')
|
||||||
|
|
||||||
# Should fail due to temporary channel fail
|
# Should fail due to temporary channel fail
|
||||||
self.assertRaises(ValueError, l1.rpc.pay, inv)
|
self.assertRaises(ValueError, l1.rpc.sendpay, to_json(route), rhash)
|
||||||
l1.daemon.wait_for_log('Failing: first peer not ready: WIRE_TEMPORARY_CHANNEL_FAILURE')
|
l1.daemon.wait_for_log('Failing: first peer not ready: WIRE_TEMPORARY_CHANNEL_FAILURE')
|
||||||
assert not l1.daemon.is_in_log('... still in progress')
|
assert not l1.daemon.is_in_log('... still in progress')
|
||||||
|
|
||||||
@@ -3016,9 +3019,5 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
bitcoind.generate_block(1)
|
bitcoind.generate_block(1)
|
||||||
l1.daemon.wait_for_log('ONCHAIND_.*_UNILATERAL')
|
l1.daemon.wait_for_log('ONCHAIND_.*_UNILATERAL')
|
||||||
|
|
||||||
self.assertRaises(ValueError, l1.rpc.pay, inv)
|
|
||||||
# Could fail with almost anything, but should fail with WIRE_PERMANENT_CHANNEL_FAILURE or unknown route. FIXME
|
|
||||||
#l1.daemon.wait_for_log('Could not find a route')
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(verbosity=2)
|
unittest.main(verbosity=2)
|
||||||
|
|||||||
Reference in New Issue
Block a user