mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
pytest: Test a plugin crash while handling a hook call
This commit is contained in:
committed by
Rusty Russell
parent
7f6f324590
commit
72757933f0
20
tests/plugins/hook-crash.py
Executable file
20
tests/plugins/hook-crash.py
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from pyln.client import Plugin
|
||||
import sys
|
||||
|
||||
|
||||
plugin = Plugin()
|
||||
|
||||
|
||||
@plugin.hook('htlc_accepted')
|
||||
def on_htlc_accepted(plugin, htlc, onion, **kwargs):
|
||||
"""We die silently, i.e., without returning a response
|
||||
|
||||
`lightningd` should detect that and recover.
|
||||
"""
|
||||
plugin.log("Plugin is about to crash...")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
plugin.run()
|
||||
Reference in New Issue
Block a user