From d8cecf03dd06c9a4cab0403ef80cec92cedda7ac Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 16 Mar 2018 10:38:09 +1030 Subject: [PATCH] test_lightningd.py: add test to trigger crash bug. Signed-off-by: Rusty Russell --- tests/test_lightningd.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 5a3d43c51..cf056d106 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -1366,6 +1366,7 @@ class LightningDTests(BaseLightningDTests): # Note: for this test we leave onchaind running, so we can detect # any leaks! + @unittest.skip("Expected failure") @unittest.skipIf(not DEVELOPER, "needs DEVELOPER=1") def test_onchain_dust_out(self): """Onchain handling of outgoing dust htlcs (they should fail)""" @@ -1404,6 +1405,11 @@ class LightningDTests(BaseLightningDTests): l1.daemon.wait_for_log('WIRE_PERMANENT_CHANNEL_FAILURE: missing in commitment tx') + # Retry payment, this should fail (and, as a side-effect, tickle a + # bug). + self.assertRaisesRegex(ValueError, 'WIRE_UNKNOWN_NEXT_PEER', + l1.rpc.sendpay, to_json([routestep]), rhash) + # 6 later, l1 should collect its to-self payment. bitcoind.generate_block(6) l1.daemon.wait_for_log('Broadcasting OUR_DELAYED_RETURN_TO_WALLET .* to resolve OUR_UNILATERAL/DELAYED_OUTPUT_TO_US') @@ -1413,6 +1419,10 @@ class LightningDTests(BaseLightningDTests): bitcoind.generate_block(94) l2.daemon.wait_for_log('onchaind complete, forgetting peer') + # Restart l1, it should not crash! + l1.stop() + l1.daemon.start() + # Now, 100 blocks and l1 should be done. bitcoind.generate_block(6) l1.daemon.wait_for_log('onchaind complete, forgetting peer')