tests/test_pay.py: Add test to replicate #3757.

This commit is contained in:
ZmnSCPxj jxPCSnmZ
2020-06-22 15:55:37 +08:00
committed by Rusty Russell
parent 5db69f1b41
commit a25af262e9
2 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python3
from pyln.client import Plugin
plugin = Plugin()
@plugin.hook("htlc_accepted")
def on_htlc_accepted(onion, plugin, **kwargs):
plugin.log("Failing htlc on purpose with invalid onion failure")
plugin.log("onion: %r" % (onion))
# WIRE_TEMPORARY_CHANNEL_FAILURE = 0x1007
# This failure code should be followed by a
# `channel_update`; we deliberately return
# a 0-length `channel_update` to trigger
# issue #3757 reported by @sumBTC.
return {"result": "fail", "failure_message": "10070000"}
plugin.run()