2024-05-06 09:45:12 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
"""Plugin that breaks the node if a fail notification is received.
|
|
|
|
"""
|
|
|
|
|
2024-05-06 10:13:45 +01:00
|
|
|
from pyln.client import Plugin
|
2024-05-06 09:45:12 +01:00
|
|
|
import os
|
|
|
|
|
|
|
|
plugin = Plugin()
|
|
|
|
|
|
|
|
|
|
|
|
@plugin.init()
|
|
|
|
def init(plugin, options, configuration):
|
|
|
|
plugin.log("no_fail initialized")
|
|
|
|
|
|
|
|
|
|
|
|
@plugin.subscribe("sendpay_failure")
|
|
|
|
def channel_opened(plugin, sendpay_failure, **kwargs):
|
|
|
|
os._exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
@plugin.method("nofail")
|
|
|
|
def nofail(plugin):
|
2024-05-06 10:13:45 +01:00
|
|
|
"""Checks that the plugin is still running."""
|
2024-05-06 09:45:12 +01:00
|
|
|
return {"status": "active"}
|
|
|
|
|
|
|
|
|
|
|
|
plugin.run()
|