plugin: Fix the custommsg hook not to include the internal prefix

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.
This commit is contained in:
Christian Decker
2021-02-23 11:36:56 +01:00
committed by Rusty Russell
parent 804c2c2c20
commit ebb1b19c65
9 changed files with 31 additions and 18 deletions

View File

@@ -2284,10 +2284,10 @@ def test_sendcustommsg(node_factory):
)
l1.daemon.wait_for_log(r'\[IN\] {}'.format(serialized))
l1.daemon.wait_for_logs([
r'Got custommessage_a {serialized} from peer {peer_id}'.format(
serialized=serialized, peer_id=l2.info['id']),
r'Got custommessage_b {serialized} from peer {peer_id}'.format(
serialized=serialized, peer_id=l2.info['id'])
r'Got custommessage_a {msg} from peer {peer_id}'.format(
msg=msg, peer_id=l2.info['id']),
r'Got custommessage_b {msg} from peer {peer_id}'.format(
msg=msg, peer_id=l2.info['id'])
])
# This should work since the peer is currently owned by `openingd`
@@ -2299,10 +2299,10 @@ def test_sendcustommsg(node_factory):
)
l4.daemon.wait_for_log(r'\[IN\] {}'.format(serialized))
l4.daemon.wait_for_logs([
r'Got custommessage_a {serialized} from peer {peer_id}'.format(
serialized=serialized, peer_id=l2.info['id']),
r'Got custommessage_b {serialized} from peer {peer_id}'.format(
serialized=serialized, peer_id=l2.info['id']),
r'Got custommessage_a {msg} from peer {peer_id}'.format(
msg=msg, peer_id=l2.info['id']),
r'Got custommessage_b {msg} from peer {peer_id}'.format(
msg=msg, peer_id=l2.info['id']),
])