mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-20 13:34:26 +01:00
plugin: Make unannounced notification topics no longer fatal
Since plugins will start sending them soon, and they are likely to get it wrong sometimes, be a bit more lenient, warn them in the logs instead and then make sure it doesn't accidentally work anyway.
This commit is contained in:
committed by
Rusty Russell
parent
c8c0c4dc99
commit
98aa3c3da7
@@ -17,5 +17,19 @@ def emit(plugin):
|
||||
plugin.notify("custom", "Hello world")
|
||||
|
||||
|
||||
@plugin.method("faulty-emit")
|
||||
def faulty_emit(plugin):
|
||||
"""Emit a simple string notification to topic "custom"
|
||||
"""
|
||||
plugin.notify("ididntannouncethis", "Hello world")
|
||||
|
||||
|
||||
@plugin.subscribe("ididntannouncethis")
|
||||
def on_faulty_emit(origin, payload, **kwargs):
|
||||
"""We should never receive this as it gets dropped.
|
||||
"""
|
||||
plugin.log("Got the ididntannouncethis event")
|
||||
|
||||
|
||||
plugin.add_notification_topic("custom")
|
||||
plugin.run()
|
||||
|
||||
Reference in New Issue
Block a user