lightningd: make notifications from plugins just like native ones.
Rather than forcing them to wrap their parameters in a "payload" sub-object, copy in params directly. We include the "origin" field one level up, if they care. The next patch restores compatibility for the one place we currently use them, which is the pay plugin. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Deprecated: pyln-client: plugin custom notifications origins and payload (use parameters directly)
This commit is contained in:
@@ -6,8 +6,8 @@ plugin = Plugin()
|
||||
|
||||
|
||||
@plugin.subscribe("custom")
|
||||
def on_custom_notification(origin, payload, **kwargs):
|
||||
plugin.log("Got a custom notification {} from plugin {}".format(payload, origin))
|
||||
def on_custom_notification(origin, message, **kwargs):
|
||||
plugin.log("Got a custom notification {} from plugin {}".format(message, origin))
|
||||
|
||||
|
||||
@plugin.method("emit")
|
||||
@@ -25,23 +25,23 @@ def faulty_emit(plugin):
|
||||
|
||||
|
||||
@plugin.subscribe("pay_success")
|
||||
def on_pay_success(origin, payload, **kwargs):
|
||||
def on_pay_success(origin, payment_hash, **kwargs):
|
||||
plugin.log(
|
||||
"Got a pay_success notification from plugin {} for payment_hash {}".format(
|
||||
origin,
|
||||
payload['payment_hash']
|
||||
payment_hash
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@plugin.subscribe("pay_part_start")
|
||||
def on_pay_part_start(origin, payload, **kwargs):
|
||||
plugin.log("Got pay_part_start: {}".format(payload))
|
||||
def on_pay_part_start(origin, **kwargs):
|
||||
plugin.log("Got pay_part_start: {}".format(kwargs))
|
||||
|
||||
|
||||
@plugin.subscribe("pay_part_end")
|
||||
def on_pay_part_end(origin, payload, **kwargs):
|
||||
plugin.log("Got pay_part_end: {}".format(payload))
|
||||
def on_pay_part_end(origin, **kwargs):
|
||||
plugin.log("Got pay_part_end: {}".format(kwargs))
|
||||
|
||||
|
||||
@plugin.subscribe("ididntannouncethis")
|
||||
|
||||
Reference in New Issue
Block a user