mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
plugins/fetchinvoice: remove obsolete string-based API.
Generate the payload in the callers. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -43,12 +43,10 @@ static struct command_result *sendonionmessage_error(struct command *cmd,
|
||||
return command_hook_success(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,
|
||||
const char *replyfield,
|
||||
const u8 *replydata)
|
||||
struct tlv_onionmsg_payload *payload)
|
||||
{
|
||||
struct out_req *req;
|
||||
size_t nhops;
|
||||
@@ -68,18 +66,14 @@ send_onion_reply(struct command *cmd,
|
||||
json_object_start(req->js, NULL);
|
||||
json_add_pubkey(req->js, "id", &reply_path->path[i]->node_id);
|
||||
|
||||
omp = tlv_onionmsg_payload_new(tmpctx);
|
||||
/* Put payload in last hop. */
|
||||
if (i == nhops - 1)
|
||||
omp = payload;
|
||||
else
|
||||
omp = tlv_onionmsg_payload_new(tmpctx);
|
||||
|
||||
omp->encrypted_data_tlv = reply_path->path[i]->encrypted_recipient_data;
|
||||
|
||||
/* Put payload in last hop. */
|
||||
if (i == nhops - 1) {
|
||||
if (streq(replyfield, "invoice")) {
|
||||
omp->invoice = cast_const(u8 *, replydata);
|
||||
} else {
|
||||
assert(streq(replyfield, "invoice_error"));
|
||||
omp->invoice_error = cast_const(u8 *, replydata);
|
||||
}
|
||||
}
|
||||
tlv = tal_arr(tmpctx, u8, 0);
|
||||
towire_tlv_onionmsg_payload(&tlv, omp);
|
||||
json_add_hex_talarr(req->js, "tlv", tlv);
|
||||
|
||||
Reference in New Issue
Block a user