Skip to content

Commit

Permalink
test_lightningd.py: add test to trigger crash bug.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Mar 16, 2018
1 parent e6de41b commit d8cecf0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_lightningd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,7 @@ def test_onchain_unwatch(self):
# 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)"""
Expand Down Expand Up @@ -1404,6 +1405,11 @@ def test_onchain_dust_out(self):

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')
Expand All @@ -1413,6 +1419,10 @@ def test_onchain_dust_out(self):
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')
Expand Down

0 comments on commit d8cecf0

Please sign in to comment.