mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
ebb1b19c65
We were always prefixing the `message` field with the internal type prefix 0x0407, followed by the length prefix. Neither is needed since the type being constant is of no interest to the plugin and the length being implicit due to the JSON-encoding. Reported-by: Ilya Evdokimov Changelog-Fixed: plugin: The `custommsg` hook no longer includes the internal type prefix and length prefix in its `payload` Changelog-Deprecated: plugin: The `message` field on the `custommsg` hook is deprecated in favor of the `payload` field, which skips the internal prefix.
17 lines
341 B
Python
Executable File
17 lines
341 B
Python
Executable File
#!/usr/bin/env python3
|
|
from pyln.client import Plugin
|
|
|
|
plugin = Plugin()
|
|
|
|
|
|
@plugin.hook('custommsg')
|
|
def on_custommsg(peer_id, payload, plugin, message=None, **kwargs):
|
|
plugin.log("Got custommessage_b {msg} from peer {peer_id}".format(
|
|
msg=payload,
|
|
peer_id=peer_id
|
|
))
|
|
return {'result': 'continue'}
|
|
|
|
|
|
plugin.run()
|