core-lightning/tests/plugins/all_notifications.py
Rusty Russell 279b3aa7e8 pyln: add ability to subscribe to all notifications.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-13 18:59:37 +09:30

18 lines
371 B
Python
Executable File

#!/usr/bin/env python3
from pyln.client import Plugin
import sys
plugin = Plugin()
@plugin.subscribe("*")
def on_any_notification(request, **kwargs):
plugin.log("notification {}: {}".format(request.method, kwargs))
if request.method == 'shutdown':
# A plugin which subscribes to shutdown is expected to exit itself.
sys.exit(0)
plugin.run()