common: update to latest onion message spec.

Mainly, field name changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: Protocol: Support for forwarding blinded payments (as per latest draft)
This commit is contained in:
Rusty Russell
2022-10-17 11:14:39 +10:30
parent 67b8fadf02
commit 5cf86a1a2e
24 changed files with 196 additions and 229 deletions

View File

@@ -647,15 +647,15 @@ struct wally_psbt *json_to_psbt(const tal_t *ctx, const char *buffer,
return psbt_from_b64(ctx, buffer + tok->start, tok->end - tok->start);
}
struct tlv_onionmsg_payload_reply_path *
json_to_reply_path(const tal_t *ctx, const char *buffer, const jsmntok_t *tok)
struct blinded_path *
json_to_blinded_path(const tal_t *ctx, const char *buffer, const jsmntok_t *tok)
{
struct tlv_onionmsg_payload_reply_path *rpath;
struct blinded_path *rpath;
const jsmntok_t *hops, *t;
size_t i;
const char *err;
rpath = tal(ctx, struct tlv_onionmsg_payload_reply_path);
rpath = tal(ctx, struct blinded_path);
err = json_scan(tmpctx, buffer, tok, "{blinding:%,first_node_id:%}",
JSON_SCAN(json_to_pubkey, &rpath->blinding),
JSON_SCAN(json_to_pubkey, &rpath->first_node_id),
@@ -667,12 +667,12 @@ json_to_reply_path(const tal_t *ctx, const char *buffer, const jsmntok_t *tok)
if (!hops || hops->size < 1)
return tal_free(rpath);
rpath->path = tal_arr(rpath, struct onionmsg_path *, hops->size);
rpath->path = tal_arr(rpath, struct onionmsg_hop *, hops->size);
json_for_each_arr(i, t, hops) {
rpath->path[i] = tal(rpath->path, struct onionmsg_path);
err = json_scan(tmpctx, buffer, t, "{id:%,encrypted_recipient_data:%}",
rpath->path[i] = tal(rpath->path, struct onionmsg_hop);
err = json_scan(tmpctx, buffer, t, "{blinded_node_id:%,encrypted_recipient_data:%}",
JSON_SCAN(json_to_pubkey,
&rpath->path[i]->node_id),
&rpath->path[i]->blinded_node_id),
JSON_SCAN_TAL(rpath->path[i],
json_tok_bin_from_hex,
&rpath->path[i]->encrypted_recipient_data));