From 2e5047f74b94e2b5b8e3fd026ada900164f8ec70 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 24 Jan 2018 15:10:26 +0100 Subject: [PATCH] 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 --- tests/test_lightningd.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 2134408c7..13370c0fc 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -2995,20 +2995,23 @@ class LightningDTests(BaseLightningDTests): # Wait for route propagation. 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. l1.rpc.dev_setfees('150000') - # Wait for l1 notice l1.daemon.wait_for_log('STATUS_FAIL_PEER_BAD') # 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') # 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') assert not l1.daemon.is_in_log('... still in progress') @@ -3016,9 +3019,5 @@ class LightningDTests(BaseLightningDTests): bitcoind.generate_block(1) 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__': unittest.main(verbosity=2)