Skip to content

Commit 130280d

Browse files
rustyrussellcdecker
authored andcommitted
doc/PLUGINS.md: Document the onion_message and onion_message_blinded hooks.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 79f3275 commit 130280d

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

doc/PLUGINS.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,43 @@ This will ensure backward
12241224
compatibility should the semantics be changed in future.
12251225

12261226

1227+
### `onion_message` and `onion_message_blinded`
1228+
1229+
**(WARNING: experimental-offers only)**
1230+
1231+
These two hooks are almost identical, in that they are called when an
1232+
onion message is received. The former is only used for unblinded
1233+
messages (where the source knows that it is sending to this node), and
1234+
the latter for blinded messages (where the source doesn't know that
1235+
this node is the destination). The latter hook will have a
1236+
"blinding_in" field, the former never will.
1237+
1238+
These hooks are separate, because blinded messages must ensure the
1239+
sender used the correct "blinding_in", otherwise it should ignore the
1240+
message: this avoids the source trying to probe for responses without
1241+
using the designated delivery path.
1242+
1243+
The payload for a call follows this format:
1244+
1245+
```json
1246+
{
1247+
"onion_message": {
1248+
"blinding_in": "02df5ffe895c778e10f7742a6c5b8a0cefbe9465df58b92fadeb883752c8107c8f",
1249+
"reply_path": [ {"id": "02df5ffe895c778e10f7742a6c5b8a0cefbe9465df58b92fadeb883752c8107c8f",
1250+
"enctlv": "0a020d0d",
1251+
"blinding": "02df5ffe895c778e10f7742a6c5b8a0cefbe9465df58b92fadeb883752c8107c8f"} ],
1252+
"invoice_request": "0a020d0d",
1253+
"invoice": "0a020d0d",
1254+
"invoice_error": "0a020d0d",
1255+
"unknown_fields": [ {"number": 12345, "value": "0a020d0d"} ]
1256+
}
1257+
}
1258+
```
1259+
1260+
All fields shown here are optional.
1261+
1262+
We suggest just returning `{'result': 'continue'}`; any other result
1263+
will cause the message not to be handed to any other hooks.
12271264

12281265
## Bitcoin backend
12291266

0 commit comments

Comments
 (0)