mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 15:44:21 +01:00
common: rename current onion message structures to obs2_.
Yes, we changed the spec again. Hopefully for the last time! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -639,14 +639,14 @@ struct sending {
|
||||
|
||||
static struct command_result *
|
||||
send_modern_message(struct command *cmd,
|
||||
struct tlv_onionmsg_payload_reply_path *reply_path,
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *reply_path,
|
||||
struct sending *sending)
|
||||
{
|
||||
struct sent *sent = sending->sent;
|
||||
struct privkey blinding_iter;
|
||||
struct pubkey fwd_blinding, *node_alias;
|
||||
size_t nhops = tal_count(sent->path);
|
||||
struct tlv_onionmsg_payload **payloads;
|
||||
struct tlv_obs2_onionmsg_payload **payloads;
|
||||
struct out_req *req;
|
||||
|
||||
/* Now create enctlvs for *forward* path. */
|
||||
@@ -658,29 +658,29 @@ send_modern_message(struct command *cmd,
|
||||
&blinding_iter));
|
||||
|
||||
/* We overallocate: this node (0) doesn't have payload or alias */
|
||||
payloads = tal_arr(cmd, struct tlv_onionmsg_payload *, nhops);
|
||||
payloads = tal_arr(cmd, struct tlv_obs2_onionmsg_payload *, nhops);
|
||||
node_alias = tal_arr(cmd, struct pubkey, nhops);
|
||||
|
||||
for (size_t i = 1; i < nhops - 1; i++) {
|
||||
payloads[i] = tlv_onionmsg_payload_new(payloads);
|
||||
payloads[i]->enctlv = create_enctlv(payloads[i],
|
||||
&blinding_iter,
|
||||
&sent->path[i],
|
||||
&sent->path[i+1],
|
||||
/* FIXME: Pad? */
|
||||
0,
|
||||
NULL,
|
||||
&blinding_iter,
|
||||
&node_alias[i]);
|
||||
payloads[i] = tlv_obs2_onionmsg_payload_new(payloads);
|
||||
payloads[i]->enctlv = create_obs2_enctlv(payloads[i],
|
||||
&blinding_iter,
|
||||
&sent->path[i],
|
||||
&sent->path[i+1],
|
||||
/* FIXME: Pad? */
|
||||
0,
|
||||
NULL,
|
||||
&blinding_iter,
|
||||
&node_alias[i]);
|
||||
}
|
||||
/* Final payload contains the actual data. */
|
||||
payloads[nhops-1] = tlv_onionmsg_payload_new(payloads);
|
||||
payloads[nhops-1] = tlv_obs2_onionmsg_payload_new(payloads);
|
||||
|
||||
/* We don't include enctlv in final, but it gives us final alias */
|
||||
if (!create_final_enctlv(tmpctx, &blinding_iter, &sent->path[nhops-1],
|
||||
/* FIXME: Pad? */ 0,
|
||||
NULL,
|
||||
&node_alias[nhops-1])) {
|
||||
if (!create_obs2_final_enctlv(tmpctx, &blinding_iter, &sent->path[nhops-1],
|
||||
/* FIXME: Pad? */ 0,
|
||||
NULL,
|
||||
&node_alias[nhops-1])) {
|
||||
/* Should not happen! */
|
||||
return command_fail(cmd, LIGHTNINGD,
|
||||
"Could create final enctlv");
|
||||
@@ -709,7 +709,7 @@ send_modern_message(struct command *cmd,
|
||||
json_object_start(req->js, NULL);
|
||||
json_add_pubkey(req->js, "id", &node_alias[i]);
|
||||
tlv = tal_arr(tmpctx, u8, 0);
|
||||
towire_onionmsg_payload(&tlv, payloads[i]);
|
||||
towire_obs2_onionmsg_payload(&tlv, payloads[i]);
|
||||
json_add_hex_talarr(req->js, "tlv", tlv);
|
||||
json_object_end(req->js);
|
||||
}
|
||||
@@ -724,10 +724,10 @@ static struct command_result *use_reply_path(struct command *cmd,
|
||||
const jsmntok_t *result,
|
||||
struct sending *sending)
|
||||
{
|
||||
struct tlv_onionmsg_payload_reply_path *rpath;
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *rpath;
|
||||
|
||||
rpath = json_to_reply_path(cmd, buf,
|
||||
json_get_member(buf, result, "blindedpath"));
|
||||
rpath = json_to_obs2_reply_path(cmd, buf,
|
||||
json_get_member(buf, result, "blindedpath"));
|
||||
if (!rpath)
|
||||
plugin_err(cmd->plugin,
|
||||
"could not parse reply path %.*s?",
|
||||
|
||||
@@ -43,7 +43,7 @@ static struct command_result *sendonionmessage_error(struct command *cmd,
|
||||
/* FIXME: replyfield string interface is to accomodate obsolete API */
|
||||
struct command_result *
|
||||
send_onion_reply(struct command *cmd,
|
||||
struct tlv_onionmsg_payload_reply_path *reply_path,
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *reply_path,
|
||||
const char *replyfield,
|
||||
const u8 *replydata)
|
||||
{
|
||||
@@ -57,13 +57,13 @@ send_onion_reply(struct command *cmd,
|
||||
json_add_pubkey(req->js, "blinding", &reply_path->blinding);
|
||||
json_array_start(req->js, "hops");
|
||||
for (size_t i = 0; i < nhops; i++) {
|
||||
struct tlv_onionmsg_payload *omp;
|
||||
struct tlv_obs2_onionmsg_payload *omp;
|
||||
u8 *tlv;
|
||||
|
||||
json_object_start(req->js, NULL);
|
||||
json_add_pubkey(req->js, "id", &reply_path->path[i]->node_id);
|
||||
|
||||
omp = tlv_onionmsg_payload_new(tmpctx);
|
||||
omp = tlv_obs2_onionmsg_payload_new(tmpctx);
|
||||
omp->enctlv = reply_path->path[i]->enctlv;
|
||||
|
||||
/* Put payload in last hop. */
|
||||
@@ -76,7 +76,7 @@ send_onion_reply(struct command *cmd,
|
||||
}
|
||||
}
|
||||
tlv = tal_arr(tmpctx, u8, 0);
|
||||
towire_onionmsg_payload(&tlv, omp);
|
||||
towire_obs2_onionmsg_payload(&tlv, omp);
|
||||
json_add_hex_talarr(req->js, "tlv", tlv);
|
||||
json_object_end(req->js);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ static struct command_result *onion_message_modern_call(struct command *cmd,
|
||||
const jsmntok_t *params)
|
||||
{
|
||||
const jsmntok_t *om, *replytok, *invreqtok, *invtok;
|
||||
struct tlv_onionmsg_payload_reply_path *reply_path;
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *reply_path;
|
||||
|
||||
if (!offers_enabled)
|
||||
return command_hook_success(cmd);
|
||||
@@ -97,7 +97,7 @@ static struct command_result *onion_message_modern_call(struct command *cmd,
|
||||
om = json_get_member(buf, params, "onion_message");
|
||||
replytok = json_get_member(buf, om, "reply_blindedpath");
|
||||
if (replytok) {
|
||||
reply_path = json_to_reply_path(cmd, buf, replytok);
|
||||
reply_path = json_to_obs2_reply_path(cmd, buf, replytok);
|
||||
if (!reply_path)
|
||||
plugin_err(cmd->plugin, "Invalid reply path %.*s?",
|
||||
json_tok_full_len(replytok),
|
||||
|
||||
@@ -9,7 +9,7 @@ struct command;
|
||||
/* Helper to send a reply */
|
||||
struct command_result *WARN_UNUSED_RESULT
|
||||
send_onion_reply(struct command *cmd,
|
||||
struct tlv_onionmsg_payload_reply_path *reply_path,
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *reply_path,
|
||||
const char *replyfield,
|
||||
const u8 *replydata);
|
||||
#endif /* LIGHTNING_PLUGINS_OFFERS_H */
|
||||
|
||||
@@ -11,7 +11,7 @@ struct inv {
|
||||
struct tlv_invoice *inv;
|
||||
|
||||
/* May be NULL */
|
||||
struct tlv_onionmsg_payload_reply_path *reply_path;
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *reply_path;
|
||||
|
||||
/* The offer, once we've looked it up. */
|
||||
struct tlv_offer *offer;
|
||||
@@ -313,7 +313,7 @@ static struct command_result *listoffers_error(struct command *cmd,
|
||||
|
||||
struct command_result *handle_invoice(struct command *cmd,
|
||||
const u8 *invbin,
|
||||
struct tlv_onionmsg_payload_reply_path *reply_path STEALS)
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *reply_path STEALS)
|
||||
{
|
||||
size_t len = tal_count(invbin);
|
||||
struct inv *inv = tal(cmd, struct inv);
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
/* We got an onionmessage with an invoice! reply_path could be NULL. */
|
||||
struct command_result *handle_invoice(struct command *cmd,
|
||||
const u8 *invbin,
|
||||
struct tlv_onionmsg_payload_reply_path *reply_path STEALS);
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *reply_path STEALS);
|
||||
#endif /* LIGHTNING_PLUGINS_OFFERS_INV_HOOK_H */
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/* We need to keep the reply path around so we can reply with invoice */
|
||||
struct invreq {
|
||||
struct tlv_invoice_request *invreq;
|
||||
struct tlv_onionmsg_payload_reply_path *reply_path;
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *reply_path;
|
||||
|
||||
/* The offer, once we've looked it up. */
|
||||
struct tlv_offer *offer;
|
||||
@@ -830,7 +830,7 @@ static struct command_result *handle_offerless_request(struct command *cmd,
|
||||
|
||||
struct command_result *handle_invoice_request(struct command *cmd,
|
||||
const u8 *invreqbin,
|
||||
struct tlv_onionmsg_payload_reply_path *reply_path)
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *reply_path)
|
||||
{
|
||||
size_t len = tal_count(invreqbin);
|
||||
struct invreq *ir = tal(cmd, struct invreq);
|
||||
|
||||
@@ -8,5 +8,5 @@ extern u32 cltv_final;
|
||||
/* We got an onionmessage with an invreq! */
|
||||
struct command_result *handle_invoice_request(struct command *cmd,
|
||||
const u8 *invreqbin,
|
||||
struct tlv_onionmsg_payload_reply_path *reply_path STEALS);
|
||||
struct tlv_obs2_onionmsg_payload_reply_path *reply_path STEALS);
|
||||
#endif /* LIGHTNING_PLUGINS_OFFERS_INVREQ_HOOK_H */
|
||||
|
||||
Reference in New Issue
Block a user