mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
bolt12: allow first_node_id in blinded path to be a scid.
We don't actually support it yet, but this threads through the type change, puts it in "decode" etc. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
1b9b160108
commit
cb2c4963f2
40 changed files with 615 additions and 331 deletions
18
.msggen.json
18
.msggen.json
|
@ -785,6 +785,8 @@
|
|||
"DecodeOffer_paths": {
|
||||
"Decode.offer_paths[].blinding": 2,
|
||||
"Decode.offer_paths[].first_node_id": 1,
|
||||
"Decode.offer_paths[].first_scid": 5,
|
||||
"Decode.offer_paths[].first_scid_dir": 4,
|
||||
"Decode.offer_paths[].path[]": 3
|
||||
},
|
||||
"DecodeOffer_recurrencePaywindow": {
|
||||
|
@ -3410,6 +3412,14 @@
|
|||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Decode.invoice_paths[].first_scid": {
|
||||
"added": "v23.05",
|
||||
"deprecated": false
|
||||
},
|
||||
"Decode.invoice_paths[].first_scid_dir": {
|
||||
"added": "v23.05",
|
||||
"deprecated": false
|
||||
},
|
||||
"Decode.invoice_paths[].path[]": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
|
@ -3550,6 +3560,14 @@
|
|||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Decode.offer_paths[].first_scid": {
|
||||
"added": "v23.05",
|
||||
"deprecated": false
|
||||
},
|
||||
"Decode.offer_paths[].first_scid_dir": {
|
||||
"added": "v23.05",
|
||||
"deprecated": false
|
||||
},
|
||||
"Decode.offer_paths[].path[]": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
|
|
4
cln-grpc/proto/node.proto
generated
4
cln-grpc/proto/node.proto
generated
|
@ -1526,8 +1526,10 @@ message DecodeResponse {
|
|||
}
|
||||
|
||||
message DecodeOffer_paths {
|
||||
bytes first_node_id = 1;
|
||||
optional bytes first_node_id = 1;
|
||||
bytes blinding = 2;
|
||||
optional uint32 first_scid_dir = 4;
|
||||
optional string first_scid = 5;
|
||||
}
|
||||
|
||||
message DecodeOffer_recurrencePaywindow {
|
||||
|
|
4
cln-grpc/src/convert.rs
generated
4
cln-grpc/src/convert.rs
generated
|
@ -1385,7 +1385,9 @@ impl From<responses::DecodeOffer_paths> for pb::DecodeOfferPaths {
|
|||
fn from(c: responses::DecodeOffer_paths) -> Self {
|
||||
Self {
|
||||
blinding: c.blinding.serialize().to_vec(), // Rule #2 for type pubkey
|
||||
first_node_id: c.first_node_id.serialize().to_vec(), // Rule #2 for type pubkey
|
||||
first_node_id: c.first_node_id.map(|v| v.serialize().to_vec()), // Rule #2 for type pubkey?
|
||||
first_scid: c.first_scid.map(|v| v.to_string()), // Rule #2 for type short_channel_id?
|
||||
first_scid_dir: c.first_scid_dir, // Rule #2 for type u32?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
7
cln-rpc/src/model.rs
generated
7
cln-rpc/src/model.rs
generated
|
@ -5716,8 +5716,13 @@ pub mod responses {
|
|||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct DecodeOffer_paths {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub first_node_id: Option<PublicKey>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub first_scid: Option<ShortChannelId>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub first_scid_dir: Option<u32>,
|
||||
pub blinding: PublicKey,
|
||||
pub first_node_id: PublicKey,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
|
|
|
@ -10,15 +10,31 @@ json_to_blinded_path(const tal_t *ctx, const char *buffer, const jsmntok_t *tok)
|
|||
const jsmntok_t *hops, *t;
|
||||
size_t i;
|
||||
const char *err;
|
||||
struct pubkey first_node_id;
|
||||
struct short_channel_id_dir first_scidd;
|
||||
|
||||
rpath = tal(ctx, struct blinded_path);
|
||||
err = json_scan(tmpctx, buffer, tok, "{blinding:%,first_node_id:%}",
|
||||
|
||||
/* It will give us either scid or node_id */
|
||||
memset(&first_scidd, 0, sizeof(first_scidd));
|
||||
err = json_scan(tmpctx, buffer, tok,
|
||||
"{blinding:%,"
|
||||
"first_node_id?:%,"
|
||||
"first_scid?:%,"
|
||||
"first_scid_dir?:%}",
|
||||
JSON_SCAN(json_to_pubkey, &rpath->blinding),
|
||||
JSON_SCAN(json_to_pubkey, &rpath->first_node_id),
|
||||
JSON_SCAN(json_to_pubkey, &first_node_id),
|
||||
JSON_SCAN(json_to_short_channel_id, &first_scidd.scid),
|
||||
JSON_SCAN(json_to_int, &first_scidd.dir),
|
||||
NULL);
|
||||
if (err)
|
||||
return tal_free(rpath);
|
||||
|
||||
if (first_scidd.scid.u64 != 0)
|
||||
sciddir_or_pubkey_from_scidd(&rpath->first_node_id, &first_scidd);
|
||||
else
|
||||
sciddir_or_pubkey_from_pubkey(&rpath->first_node_id, &first_node_id);
|
||||
|
||||
hops = json_get_member(buffer, tok, "hops");
|
||||
if (!hops || hops->size < 1)
|
||||
return tal_free(rpath);
|
||||
|
|
|
@ -58,6 +58,10 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
|||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for towire_amount_msat */
|
||||
void towire_amount_msat(u8 **pptr UNNEEDED, const struct amount_msat msat UNNEEDED)
|
||||
{ fprintf(stderr, "towire_amount_msat called!\n"); abort(); }
|
||||
|
@ -70,6 +74,10 @@ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id U
|
|||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
static void json_strfield(const char *name, const char *val)
|
||||
|
|
|
@ -68,6 +68,10 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
|||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for new_onionreply */
|
||||
struct onionreply *new_onionreply(const tal_t *ctx UNNEEDED, const u8 *contents TAKES UNNEEDED)
|
||||
{ fprintf(stderr, "new_onionreply called!\n"); abort(); }
|
||||
|
@ -86,6 +90,10 @@ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id U
|
|||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
static void json_strfield(const char *name, const char *val)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <common/bolt12.c>
|
||||
#include <common/bolt12_merkle.h>
|
||||
#include <common/features.c>
|
||||
#include <common/sciddir_or_pubkey.c>
|
||||
#include <common/setup.h>
|
||||
#include <inttypes.h>
|
||||
#include <wire/bolt12_wiregen.c>
|
||||
|
@ -61,6 +62,9 @@ struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max
|
|||
/* Generated stub for merkle_tlv */
|
||||
void merkle_tlv(const struct tlv_field *fields UNNEEDED, struct sha256 *merkle UNNEEDED)
|
||||
{ fprintf(stderr, "merkle_tlv called!\n"); abort(); }
|
||||
/* Generated stub for pubkey_from_node_id */
|
||||
bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); }
|
||||
/* Generated stub for sighash_from_merkle */
|
||||
void sighash_from_merkle(const char *messagename UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
|
@ -221,7 +225,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
offer->offer_paths = tal_arr(offer, struct blinded_path *, 1);
|
||||
offer->offer_paths[0] = tal(offer->offer_paths, struct blinded_path);
|
||||
assert(pubkey_from_secret(&bob, &offer->offer_paths[0]->first_node_id));
|
||||
offer->offer_paths[0]->first_node_id.is_pubkey = true;
|
||||
assert(pubkey_from_secret(&bob, &offer->offer_paths[0]->first_node_id.pubkey));
|
||||
/* Random blinding secret. */
|
||||
assert(pubkey_from_hexstr("020202020202020202020202020202020202020202020202020202020202020202", 66, &offer->offer_paths[0]->blinding));
|
||||
offer->offer_paths[0]->path = tal_arr(offer->offer_paths[0],
|
||||
|
@ -240,7 +245,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
tal_resize(&offer->offer_paths, 2);
|
||||
offer->offer_paths[1] = tal(offer->offer_paths, struct blinded_path);
|
||||
assert(pubkey_from_secret(&carol, &offer->offer_paths[1]->first_node_id));
|
||||
offer->offer_paths[1]->first_node_id.is_pubkey = true;
|
||||
assert(pubkey_from_secret(&carol, &offer->offer_paths[1]->first_node_id.pubkey));
|
||||
/* Random blinding secret. */
|
||||
assert(pubkey_from_hexstr("020202020202020202020202020202020202020202020202020202020202020202", 66, &offer->offer_paths[1]->blinding));
|
||||
offer->offer_paths[1]->path = tal_arr(offer->offer_paths[1],
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "../features.c"
|
||||
#include "../json_parse.c"
|
||||
#include "../json_parse_simple.c"
|
||||
#include "../sciddir_or_pubkey.c"
|
||||
#include <ccan/array_size/array_size.h>
|
||||
#include <ccan/tal/grab_file/grab_file.h>
|
||||
#include <ccan/tal/path/path.h>
|
||||
|
@ -68,6 +69,9 @@ bool parse_amount_msat(struct amount_msat *msat UNNEEDED, const char *s UNNEEDED
|
|||
/* Generated stub for parse_amount_sat */
|
||||
bool parse_amount_sat(struct amount_sat *sat UNNEEDED, const char *s UNNEEDED, size_t slen UNNEEDED)
|
||||
{ fprintf(stderr, "parse_amount_sat called!\n"); abort(); }
|
||||
/* Generated stub for pubkey_from_node_id */
|
||||
bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); }
|
||||
/* Generated stub for sighash_from_merkle */
|
||||
void sighash_from_merkle(const char *messagename UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_tlv */
|
||||
bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
@ -31,6 +35,10 @@ bool json_filter_ok(const struct json_filter *filter UNNEEDED, const char *membe
|
|||
/* Generated stub for json_filter_up */
|
||||
bool json_filter_up(struct json_filter **filter UNNEEDED)
|
||||
{ fprintf(stderr, "json_filter_up called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for towire_tlv */
|
||||
void towire_tlv(u8 **pptr UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
|
|
@ -29,6 +29,10 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
|||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for new_onionreply */
|
||||
struct onionreply *new_onionreply(const tal_t *ctx UNNEEDED, const u8 *contents TAKES UNNEEDED)
|
||||
{ fprintf(stderr, "new_onionreply called!\n"); abort(); }
|
||||
|
@ -47,6 +51,10 @@ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id U
|
|||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
static bool comma;
|
||||
|
|
|
@ -70,6 +70,10 @@ void ecdh(const struct pubkey *point UNNEEDED, struct secret *ss UNNEEDED)
|
|||
/* Generated stub for fromwire_amount_msat */
|
||||
struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_amount_msat called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_tlv */
|
||||
bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
@ -100,6 +104,10 @@ size_t tlv_field_offset(const u8 *tlvstream UNNEEDED, size_t tlvlen UNNEEDED, u6
|
|||
/* Generated stub for towire_amount_msat */
|
||||
void towire_amount_msat(u8 **pptr UNNEEDED, const struct amount_msat msat UNNEEDED)
|
||||
{ fprintf(stderr, "towire_amount_msat called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for towire_tlv */
|
||||
void towire_tlv(u8 **pptr UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
|
|
@ -67,6 +67,10 @@ bool command_dev_apis(const struct command *cmd UNNEEDED)
|
|||
/* Generated stub for command_filter_ptr */
|
||||
struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED)
|
||||
{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_tlv */
|
||||
bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
@ -76,6 +80,10 @@ bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
|||
/* Generated stub for to_canonical_invstr */
|
||||
const char *to_canonical_invstr(const tal_t *ctx UNNEEDED, const char *invstring UNNEEDED)
|
||||
{ fprintf(stderr, "to_canonical_invstr called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for towire_tlv */
|
||||
void towire_tlv(u8 **pptr UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for mvt_tag_str */
|
||||
const char *mvt_tag_str(enum mvt_tag tag UNNEEDED)
|
||||
{ fprintf(stderr, "mvt_tag_str called!\n"); abort(); }
|
||||
|
@ -37,6 +41,10 @@ bool node_id_from_hexstr(const char *str UNNEEDED, size_t slen UNNEEDED, struct
|
|||
/* Generated stub for pubkey_from_node_id */
|
||||
bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
#if 0
|
||||
|
@ -111,10 +119,12 @@ int main(int argc, char *argv[])
|
|||
JSON_SCAN(json_to_u32, &path_fee_base_msat),
|
||||
JSON_SCAN(json_to_u32, &path_fee_proportional_millionths),
|
||||
JSON_SCAN(json_to_u32, &path_cltv_delta),
|
||||
JSON_SCAN(json_to_pubkey, &bpath->first_node_id),
|
||||
JSON_SCAN(json_to_pubkey, &bpath->first_node_id.pubkey),
|
||||
JSON_SCAN(json_to_pubkey, &bpath->blinding),
|
||||
JSON_SCAN(json_to_tok, &hops_tok)) == NULL);
|
||||
|
||||
/* FIXME: Test scid as well! */
|
||||
bpath->first_node_id.is_pubkey = true;
|
||||
bpath->path = tal_arr(bpath, struct onionmsg_hop *, hops_tok->size);
|
||||
json_for_each_arr(i, t, hops_tok) {
|
||||
bpath->path[i] = tal(bpath->path, struct onionmsg_hop);
|
||||
|
|
|
@ -27,6 +27,10 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
|||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for node_id_from_hexstr */
|
||||
bool node_id_from_hexstr(const char *str UNNEEDED, size_t slen UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "node_id_from_hexstr called!\n"); abort(); }
|
||||
|
@ -36,6 +40,10 @@ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id U
|
|||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
static struct tlv_encrypted_data_tlv_payment_constraints *
|
||||
|
|
|
@ -74,6 +74,10 @@ struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max
|
|||
/* Generated stub for fromwire_bigsize */
|
||||
bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_bigsize called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_tlv */
|
||||
bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
@ -92,6 +96,10 @@ void towire_amount_msat(u8 **pptr UNNEEDED, const struct amount_msat msat UNNEED
|
|||
/* Generated stub for towire_bigsize */
|
||||
void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED)
|
||||
{ fprintf(stderr, "towire_bigsize called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for towire_tlv */
|
||||
void towire_tlv(u8 **pptr UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
|
|
@ -68,6 +68,7 @@ CONNECTD_COMMON_OBJS := \
|
|||
common/per_peer_state.o \
|
||||
common/psbt_open.o \
|
||||
common/pseudorand.o \
|
||||
common/sciddir_or_pubkey.o \
|
||||
common/setup.o \
|
||||
common/sphinx.o \
|
||||
common/status.o \
|
||||
|
|
|
@ -5664,7 +5664,6 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"first_node_id",
|
||||
"blinding",
|
||||
"path"
|
||||
],
|
||||
|
@ -5676,6 +5675,16 @@
|
|||
"The (presumably well-known) public key of the start of the path."
|
||||
]
|
||||
},
|
||||
"first_scid": {
|
||||
"added": "v23.05",
|
||||
"type": "short_channel_id",
|
||||
"description": "the short channel id of the start of the path (alternative to first_n ode_id)"
|
||||
},
|
||||
"first_scid_dir": {
|
||||
"added": "v23.05",
|
||||
"type": "u32",
|
||||
"description": "which end of the first_scid is the start of the path"
|
||||
},
|
||||
"blinding": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
|
@ -6042,7 +6051,6 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"first_node_id",
|
||||
"blinding",
|
||||
"path"
|
||||
],
|
||||
|
@ -6054,6 +6062,16 @@
|
|||
"The (presumably well-known) public key of the start of the path."
|
||||
]
|
||||
},
|
||||
"first_scid": {
|
||||
"added": "v23.05",
|
||||
"type": "short_channel_id",
|
||||
"description": "the short channel id of the start of the path (alternative to first_n ode_id)"
|
||||
},
|
||||
"first_scid_dir": {
|
||||
"added": "v23.05",
|
||||
"type": "u32",
|
||||
"description": "which end of the first_scid is the start of the path"
|
||||
},
|
||||
"blinding": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
|
@ -6517,7 +6535,6 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"first_node_id",
|
||||
"blinding",
|
||||
"path"
|
||||
],
|
||||
|
@ -6529,6 +6546,16 @@
|
|||
"The (presumably well-known) public key of the start of the path."
|
||||
]
|
||||
},
|
||||
"first_scid": {
|
||||
"added": "v23.05",
|
||||
"type": "short_channel_id",
|
||||
"description": "the short channel id of the start of the path (alternative to first_n ode_id)"
|
||||
},
|
||||
"first_scid_dir": {
|
||||
"added": "v23.05",
|
||||
"type": "u32",
|
||||
"description": "which end of the first_scid is the start of the path"
|
||||
},
|
||||
"blinding": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
|
@ -6720,7 +6747,6 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"first_node_id",
|
||||
"blinding",
|
||||
"payinfo",
|
||||
"path"
|
||||
|
@ -6733,6 +6759,16 @@
|
|||
"The (presumably well-known) public key of the start of the path."
|
||||
]
|
||||
},
|
||||
"first_scid": {
|
||||
"added": "v23.05",
|
||||
"type": "short_channel_id",
|
||||
"description": "the short channel id of the start of the path (alternative to first_n ode_id)"
|
||||
},
|
||||
"first_scid_dir": {
|
||||
"added": "v23.05",
|
||||
"type": "u32",
|
||||
"description": "which end of the first_scid is the start of the path"
|
||||
},
|
||||
"blinding": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1094,6 +1094,8 @@ def decode_invoice_paths2py(m):
|
|||
return remove_default({
|
||||
"blinding": hexlify(m.blinding), # PrimitiveField in generate_composite
|
||||
"first_node_id": hexlify(m.first_node_id), # PrimitiveField in generate_composite
|
||||
"first_scid": m.first_scid, # PrimitiveField in generate_composite
|
||||
"first_scid_dir": m.first_scid_dir, # PrimitiveField in generate_composite
|
||||
"path": [decode_invoice_paths_path2py(i) for i in m.path], # ArrayField[composite] in generate_composite
|
||||
})
|
||||
|
||||
|
@ -1110,6 +1112,8 @@ def decode_offer_paths2py(m):
|
|||
"path": [decode_offer_paths_path2py(i) for i in m.path], # ArrayField[composite] in generate_composite
|
||||
"blinding": hexlify(m.blinding), # PrimitiveField in generate_composite
|
||||
"first_node_id": hexlify(m.first_node_id), # PrimitiveField in generate_composite
|
||||
"first_scid": m.first_scid, # PrimitiveField in generate_composite
|
||||
"first_scid_dir": m.first_scid_dir, # PrimitiveField in generate_composite
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -610,15 +610,18 @@ The payload for a call follows this format:
|
|||
{
|
||||
"onion_message": {
|
||||
"pathsecret": "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"reply_first_node": "02df5ffe895c778e10f7742a6c5b8a0cefbe9465df58b92fadeb883752c8107c8f",
|
||||
"reply_blinding": "02df5ffe895c778e10f7742a6c5b8a0cefbe9465df58b92fadeb883752c8107c8f",
|
||||
"reply_path": [
|
||||
{
|
||||
"id": "02df5ffe895c778e10f7742a6c5b8a0cefbe9465df58b92fadeb883752c8107c8f",
|
||||
"encrypted_recipient_data": "0a020d0d",
|
||||
"blinding": "02df5ffe895c778e10f7742a6c5b8a0cefbe9465df58b92fadeb883752c8107c8f"
|
||||
}
|
||||
],
|
||||
"reply_blindedpath": {
|
||||
"first_node_id": "02df5ffe895c778e10f7742a6c5b8a0cefbe9465df58b92fadeb883752c8107c8f",
|
||||
"first_scid": "100x200x300",
|
||||
"first_scid_dir": 1,
|
||||
"blinding": "02df5ffe895c778e10f7742a6c5b8a0cefbe9465df58b92fadeb883752c8107c8f",
|
||||
"hops": [
|
||||
{
|
||||
"blinded_node_id": "02df5ffe895c778e10f7742a6c5b8a0cefbe9465df58b92fadeb883752c8107c8f",
|
||||
"encrypted_recipient_data": "0a020d0d"
|
||||
}
|
||||
]
|
||||
},
|
||||
"invoice_request": "0a020d0d",
|
||||
"invoice": "0a020d0d",
|
||||
"invoice_error": "0a020d0d",
|
||||
|
@ -632,6 +635,6 @@ The payload for a call follows this format:
|
|||
}
|
||||
```
|
||||
|
||||
All fields shown here are optional.
|
||||
All fields shown here are optional: in particular, only one of "first_node_id" or the pair "first_scid" and "first_scid_dir" is present.
|
||||
|
||||
We suggest just returning `{"result": "continue"}`; any other result will cause the message not to be handed to any other hooks.
|
||||
|
|
|
@ -175,7 +175,6 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"first_node_id",
|
||||
"blinding",
|
||||
"path"
|
||||
],
|
||||
|
@ -187,6 +186,16 @@
|
|||
"The (presumably well-known) public key of the start of the path."
|
||||
]
|
||||
},
|
||||
"first_scid": {
|
||||
"added": "v23.05",
|
||||
"type": "short_channel_id",
|
||||
"description": "the short channel id of the start of the path (alternative to first_n ode_id)"
|
||||
},
|
||||
"first_scid_dir": {
|
||||
"added": "v23.05",
|
||||
"type": "u32",
|
||||
"description": "which end of the first_scid is the start of the path"
|
||||
},
|
||||
"blinding": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
|
@ -553,7 +562,6 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"first_node_id",
|
||||
"blinding",
|
||||
"path"
|
||||
],
|
||||
|
@ -565,6 +573,16 @@
|
|||
"The (presumably well-known) public key of the start of the path."
|
||||
]
|
||||
},
|
||||
"first_scid": {
|
||||
"added": "v23.05",
|
||||
"type": "short_channel_id",
|
||||
"description": "the short channel id of the start of the path (alternative to first_n ode_id)"
|
||||
},
|
||||
"first_scid_dir": {
|
||||
"added": "v23.05",
|
||||
"type": "u32",
|
||||
"description": "which end of the first_scid is the start of the path"
|
||||
},
|
||||
"blinding": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
|
@ -1028,7 +1046,6 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"first_node_id",
|
||||
"blinding",
|
||||
"path"
|
||||
],
|
||||
|
@ -1040,6 +1057,16 @@
|
|||
"The (presumably well-known) public key of the start of the path."
|
||||
]
|
||||
},
|
||||
"first_scid": {
|
||||
"added": "v23.05",
|
||||
"type": "short_channel_id",
|
||||
"description": "the short channel id of the start of the path (alternative to first_n ode_id)"
|
||||
},
|
||||
"first_scid_dir": {
|
||||
"added": "v23.05",
|
||||
"type": "u32",
|
||||
"description": "which end of the first_scid is the start of the path"
|
||||
},
|
||||
"blinding": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
|
@ -1231,7 +1258,6 @@
|
|||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"first_node_id",
|
||||
"blinding",
|
||||
"payinfo",
|
||||
"path"
|
||||
|
@ -1244,6 +1270,16 @@
|
|||
"The (presumably well-known) public key of the start of the path."
|
||||
]
|
||||
},
|
||||
"first_scid": {
|
||||
"added": "v23.05",
|
||||
"type": "short_channel_id",
|
||||
"description": "the short channel id of the start of the path (alternative to first_n ode_id)"
|
||||
},
|
||||
"first_scid_dir": {
|
||||
"added": "v23.05",
|
||||
"type": "u32",
|
||||
"description": "which end of the first_scid is the start of the path"
|
||||
},
|
||||
"blinding": {
|
||||
"type": "pubkey",
|
||||
"description": [
|
||||
|
|
|
@ -36,6 +36,7 @@ In particular, we set feature bit 19. The spec says we should set feature bit 1
|
|||
#include <common/ecdh.h>
|
||||
#include <common/json_stream.h>
|
||||
#include <common/onionreply.h>
|
||||
#include <common/sciddir_or_pubkey.h>
|
||||
#include <common/setup.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -55,6 +56,14 @@ bool blinding_next_pubkey(const struct pubkey *pk UNNEEDED,
|
|||
const struct sha256 *h UNNEEDED,
|
||||
struct pubkey *next UNNEEDED)
|
||||
{ fprintf(stderr, "blinding_next_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
@ -48,6 +48,10 @@ struct peer *first_random_peer(struct daemon *daemon UNNEEDED,
|
|||
/* Generated stub for fromwire_gossipd_dev_set_max_scids_encode_size */
|
||||
bool fromwire_gossipd_dev_set_max_scids_encode_size(const void *p UNNEEDED, u32 *max UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossipd_dev_set_max_scids_encode_size called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for gossmap_chan_byidx */
|
||||
struct gossmap_chan *gossmap_chan_byidx(const struct gossmap *map UNNEEDED, u32 idx UNNEEDED)
|
||||
{ fprintf(stderr, "gossmap_chan_byidx called!\n"); abort(); }
|
||||
|
@ -131,6 +135,10 @@ void status_fmt(enum log_level level UNNEEDED,
|
|||
const char *fmt UNNEEDED, ...)
|
||||
|
||||
{ fprintf(stderr, "status_fmt called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for towire_warningfmt */
|
||||
u8 *towire_warningfmt(const tal_t *ctx UNNEEDED,
|
||||
const struct channel_id *channel UNNEEDED,
|
||||
|
|
|
@ -52,6 +52,10 @@ struct peer *first_random_peer(struct daemon *daemon UNNEEDED,
|
|||
/* Generated stub for fromwire_gossipd_dev_set_max_scids_encode_size */
|
||||
bool fromwire_gossipd_dev_set_max_scids_encode_size(const void *p UNNEEDED, u32 *max UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossipd_dev_set_max_scids_encode_size called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for gossmap_chan_byidx */
|
||||
struct gossmap_chan *gossmap_chan_byidx(const struct gossmap *map UNNEEDED, u32 idx UNNEEDED)
|
||||
{ fprintf(stderr, "gossmap_chan_byidx called!\n"); abort(); }
|
||||
|
@ -129,6 +133,10 @@ void queue_peer_msg(struct daemon *daemon UNNEEDED,
|
|||
const struct node_id *peer UNNEEDED,
|
||||
const u8 *msg TAKES UNNEEDED)
|
||||
{ fprintf(stderr, "queue_peer_msg called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for towire_warningfmt */
|
||||
u8 *towire_warningfmt(const tal_t *ctx UNNEEDED,
|
||||
const struct channel_id *channel UNNEEDED,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <common/ecdh.h>
|
||||
#include <common/json_stream.h>
|
||||
#include <common/onionreply.h>
|
||||
#include <common/sciddir_or_pubkey.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/wireaddr.h>
|
||||
#include <stdio.h>
|
||||
|
@ -33,6 +34,10 @@ struct peer *find_peer(struct daemon *daemon UNNEEDED, const struct node_id *id
|
|||
struct peer *first_random_peer(struct daemon *daemon UNNEEDED,
|
||||
struct peer_node_id_map_iter *it UNNEEDED)
|
||||
{ fprintf(stderr, "first_random_peer called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for gossmap_chan_get_update_details */
|
||||
void gossmap_chan_get_update_details(const struct gossmap *map UNNEEDED,
|
||||
const struct gossmap_chan *chan UNNEEDED,
|
||||
|
@ -119,6 +124,10 @@ void status_fmt(enum log_level level UNNEEDED,
|
|||
const char *fmt UNNEEDED, ...)
|
||||
|
||||
{ fprintf(stderr, "status_fmt called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
static void test_block_range(struct seeker *seeker,
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <common/ecdh.h>
|
||||
#include <common/json_stream.h>
|
||||
#include <common/onionreply.h>
|
||||
#include <common/sciddir_or_pubkey.h>
|
||||
#include <common/setup.h>
|
||||
#include <gossipd/gossip_store.h>
|
||||
#include <gossipd/queries.h>
|
||||
|
@ -28,6 +29,14 @@ bool blinding_next_pubkey(const struct pubkey *pk UNNEEDED,
|
|||
const struct sha256 *h UNNEEDED,
|
||||
struct pubkey *next UNNEEDED)
|
||||
{ fprintf(stderr, "blinding_next_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_sciddir_or_pubkey */
|
||||
void fromwire_sciddir_or_pubkey(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* Generated stub for towire_sciddir_or_pubkey */
|
||||
void towire_sciddir_or_pubkey(u8 **pptr UNNEEDED,
|
||||
const struct sciddir_or_pubkey *sciddpk UNNEEDED)
|
||||
{ fprintf(stderr, "towire_sciddir_or_pubkey called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
|
|
@ -1636,10 +1636,12 @@ static void add_stub_blindedpath(const tal_t *ctx,
|
|||
struct blinded_path *path;
|
||||
struct privkey blinding;
|
||||
struct tlv_encrypted_data_tlv *tlv;
|
||||
struct pubkey me;
|
||||
|
||||
path = tal(NULL, struct blinded_path);
|
||||
if (!pubkey_from_node_id(&path->first_node_id, &ld->id))
|
||||
if (!pubkey_from_node_id(&me, &ld->id))
|
||||
abort();
|
||||
sciddir_or_pubkey_from_pubkey(&path->first_node_id, &me);
|
||||
randombytes_buf(&blinding, sizeof(blinding));
|
||||
if (!pubkey_from_privkey(&blinding, &path->blinding))
|
||||
abort();
|
||||
|
@ -1656,7 +1658,7 @@ static void add_stub_blindedpath(const tal_t *ctx,
|
|||
path->path[0]->encrypted_recipient_data
|
||||
= encrypt_tlv_encrypted_data(path->path[0],
|
||||
&blinding,
|
||||
&path->first_node_id,
|
||||
&path->first_node_id.pubkey,
|
||||
tlv,
|
||||
NULL,
|
||||
&path->path[0]->blinded_node_id);
|
||||
|
|
|
@ -24,7 +24,12 @@ static void json_add_blindedpath(struct json_stream *stream,
|
|||
const struct blinded_path *path)
|
||||
{
|
||||
json_object_start(stream, fieldname);
|
||||
json_add_pubkey(stream, "first_node_id", &path->first_node_id);
|
||||
if (path->first_node_id.is_pubkey) {
|
||||
json_add_pubkey(stream, "first_node_id", &path->first_node_id.pubkey);
|
||||
} else {
|
||||
json_add_short_channel_id(stream, "first_scid", path->first_node_id.scidd.scid);
|
||||
json_add_u32(stream, "first_scid_dir", path->first_node_id.scidd.dir);
|
||||
}
|
||||
json_add_pubkey(stream, "blinding", &path->blinding);
|
||||
json_array_start(stream, "hops");
|
||||
for (size_t i = 0; i < tal_count(path->path); i++) {
|
||||
|
@ -190,6 +195,7 @@ static struct command_result *json_sendonionmessage(struct command *cmd,
|
|||
struct secret *path_secrets;
|
||||
size_t onion_size;
|
||||
|
||||
/* FIXME: Support using scid for first hop! */
|
||||
if (!param_check(cmd, buffer, params,
|
||||
p_req("first_id", param_node_id, &first_id),
|
||||
p_req("blinding", param_pubkey, &blinding),
|
||||
|
|
|
@ -191,7 +191,7 @@ ALL_PROGRAMS += $(C_PLUGINS)
|
|||
# Make all plugins depend on all plugin headers, for simplicity.
|
||||
$(PLUGIN_ALL_OBJS): $(PLUGIN_ALL_HEADER)
|
||||
|
||||
plugins/pay: $(PLUGIN_PAY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/gossmap.o common/fp16.o common/route.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o wire/bolt12_wiregen.o bitcoin/block.o common/blindedpay.o common/blindedpath.o common/hmac.o common/blinding.o common/onion_encode.o common/gossmods_listpeerchannels.o wire/onion_wiregen.o
|
||||
plugins/pay: $(PLUGIN_PAY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/gossmap.o common/fp16.o common/route.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o wire/bolt12_wiregen.o bitcoin/block.o common/blindedpay.o common/blindedpath.o common/hmac.o common/blinding.o common/onion_encode.o common/gossmods_listpeerchannels.o common/sciddir_or_pubkey.o wire/onion_wiregen.o
|
||||
|
||||
plugins/autoclean: $(PLUGIN_AUTOCLEAN_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
|
||||
|
||||
|
@ -207,7 +207,7 @@ plugins/txprepare: $(PLUGIN_TXPREPARE_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_O
|
|||
|
||||
plugins/bcli: $(PLUGIN_BCLI_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
|
||||
|
||||
plugins/keysend: wire/tlvstream.o wire/onion_wiregen.o $(PLUGIN_KEYSEND_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/gossmap.o common/fp16.o common/route.o common/dijkstra.o common/blindedpay.o common/blindedpath.o common/hmac.o common/blinding.o common/onion_encode.o common/gossmods_listpeerchannels.o
|
||||
plugins/keysend: wire/tlvstream.o wire/onion_wiregen.o $(PLUGIN_KEYSEND_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) common/gossmap.o common/fp16.o common/route.o common/dijkstra.o common/blindedpay.o common/blindedpath.o common/hmac.o common/blinding.o common/onion_encode.o common/gossmods_listpeerchannels.o common/sciddir_or_pubkey.o
|
||||
$(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER)
|
||||
|
||||
plugins/spenderp: bitcoin/block.o bitcoin/preimage.o bitcoin/psbt.o common/psbt_open.o common/json_channel_type.o common/channel_type.o common/features.o wire/peer_wiregen.o $(PLUGIN_SPENDER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
|
||||
|
|
|
@ -608,7 +608,7 @@ static struct blinded_path *blinded_path(const tal_t *ctx,
|
|||
nhops = tal_count(ids);
|
||||
|
||||
assert(nhops > 0);
|
||||
path->first_node_id = ids[0];
|
||||
sciddir_or_pubkey_from_pubkey(&path->first_node_id, &ids[0]);
|
||||
assert(pubkey_eq(&ids[nhops-1], &local_id));
|
||||
|
||||
randombytes_buf(&first_blinding, sizeof(first_blinding));
|
||||
|
|
|
@ -1809,12 +1809,14 @@ static void payment_add_blindedpath(const tal_t *ctx,
|
|||
const u8 *cursor = tlvs[i];
|
||||
size_t max = tal_bytelen(tlvs[i]);
|
||||
/* First one has to use real node_id */
|
||||
if (i == 0)
|
||||
if (i == 0) {
|
||||
assert(bpath->first_node_id.is_pubkey);
|
||||
node_id_from_pubkey(&hops[i].pubkey,
|
||||
&bpath->first_node_id);
|
||||
else
|
||||
&bpath->first_node_id.pubkey);
|
||||
} else {
|
||||
node_id_from_pubkey(&hops[i].pubkey,
|
||||
&bpath->path[i]->blinded_node_id);
|
||||
}
|
||||
|
||||
/* Length is prepended, discard that first! */
|
||||
fromwire_bigsize(&cursor, &max);
|
||||
|
|
|
@ -63,7 +63,8 @@ send_onion_reply(struct command *cmd,
|
|||
req = jsonrpc_request_start(cmd->plugin, cmd, "sendonionmessage",
|
||||
finished, sendonionmessage_error, NULL);
|
||||
|
||||
json_add_pubkey(req->js, "first_id", &reply_path->first_node_id);
|
||||
assert(reply_path->first_node_id.is_pubkey);
|
||||
json_add_pubkey(req->js, "first_id", &reply_path->first_node_id.pubkey);
|
||||
json_add_pubkey(req->js, "blinding", &reply_path->blinding);
|
||||
json_array_start(req->js, "hops");
|
||||
|
||||
|
@ -110,6 +111,13 @@ static struct command_result *onion_message_modern_call(struct command *cmd,
|
|||
plugin_err(cmd->plugin, "Invalid reply path %.*s?",
|
||||
json_tok_full_len(replytok),
|
||||
json_tok_full(buf, replytok));
|
||||
|
||||
/* FIXME: support this! */
|
||||
if (!reply_path->first_node_id.is_pubkey) {
|
||||
plugin_log(cmd->plugin, LOG_DBG,
|
||||
"reply_blindedpath uses scid");
|
||||
return command_hook_success(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
invreqtok = json_get_member(buf, om, "invoice_request");
|
||||
|
@ -316,7 +324,15 @@ static bool json_add_blinded_paths(struct json_stream *js,
|
|||
json_array_start(js, fieldname);
|
||||
for (size_t i = 0; i < tal_count(paths); i++) {
|
||||
json_object_start(js, NULL);
|
||||
json_add_pubkey(js, "first_node_id", &paths[i]->first_node_id);
|
||||
if (paths[i]->first_node_id.is_pubkey) {
|
||||
json_add_pubkey(js, "first_node_id",
|
||||
&paths[i]->first_node_id.pubkey);
|
||||
} else {
|
||||
json_add_short_channel_id(js, "first_scid",
|
||||
paths[i]->first_node_id.scidd.scid);
|
||||
json_add_u32(js, "first_scid_dir",
|
||||
paths[i]->first_node_id.scidd.dir);
|
||||
}
|
||||
json_add_pubkey(js, "blinding", &paths[i]->blinding);
|
||||
|
||||
/* Don't crash if we're short a payinfo! */
|
||||
|
|
|
@ -373,7 +373,8 @@ static struct command_result *listincoming_done(struct command *cmd,
|
|||
|
||||
ir->inv->invoice_paths = tal_arr(ir->inv, struct blinded_path *, 1);
|
||||
ir->inv->invoice_paths[0] = tal(ir->inv->invoice_paths, struct blinded_path);
|
||||
ir->inv->invoice_paths[0]->first_node_id = best->id;
|
||||
sciddir_or_pubkey_from_pubkey(&ir->inv->invoice_paths[0]->first_node_id,
|
||||
&best->id);
|
||||
if (!pubkey_from_privkey(&blinding,
|
||||
&ir->inv->invoice_paths[0]->blinding))
|
||||
abort();
|
||||
|
|
|
@ -1191,10 +1191,15 @@ static struct command_result *json_pay(struct command *cmd,
|
|||
/* FIXME: do MPP across these! We choose first one. */
|
||||
p->blindedpath = tal_steal(p, b12->invoice_paths[0]);
|
||||
p->blindedpay = tal_steal(p, b12->invoice_blindedpay[0]);
|
||||
/* FIXME: support this! */
|
||||
if (!p->blindedpath->first_node_id.is_pubkey) {
|
||||
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"First hop of blinding is an scid: not supported!");
|
||||
}
|
||||
p->min_final_cltv_expiry = p->blindedpay->cltv_expiry_delta;
|
||||
|
||||
/* Set destination to introduction point */
|
||||
node_id_from_pubkey(p->destination, &p->blindedpath->first_node_id);
|
||||
node_id_from_pubkey(p->destination, &p->blindedpath->first_node_id.pubkey);
|
||||
p->payment_metadata = NULL;
|
||||
p->routes = NULL;
|
||||
/* BOLT-offers #12:
|
||||
|
|
|
@ -42,6 +42,6 @@ ALL_C_HEADERS += $(PLUGIN_RENEPAY_HDRS)
|
|||
# Make all plugins depend on all plugin headers, for simplicity.
|
||||
$(PLUGIN_RENEPAY_OBJS): $(PLUGIN_RENEPAY_HDRS)
|
||||
|
||||
plugins/cln-renepay: $(PLUGIN_RENEPAY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) bitcoin/chainparams.o common/gossmap.o common/gossmods_listpeerchannels.o common/fp16.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o wire/bolt12_wiregen.o wire/onion_wiregen.o
|
||||
plugins/cln-renepay: $(PLUGIN_RENEPAY_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) bitcoin/chainparams.o common/gossmap.o common/gossmods_listpeerchannels.o common/fp16.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o common/sciddir_or_pubkey.o wire/bolt12_wiregen.o wire/onion_wiregen.o
|
||||
|
||||
include plugins/renepay/test/Makefile
|
||||
|
|
|
@ -51,6 +51,7 @@ FUZZ_COMMON_OBJS := \
|
|||
common/node_id.o \
|
||||
common/psbt_keypath.o \
|
||||
common/wireaddr.o \
|
||||
common/sciddir_or_pubkey.o \
|
||||
common/setup.o \
|
||||
common/status.o \
|
||||
common/status_wire.o \
|
||||
|
|
|
@ -95,7 +95,7 @@ wire/peer_wiregen.h_args := --include='common/channel_id.h' --include='bitcoin/t
|
|||
wire/peer_wiregen.c_args := -s --expose-tlv-type=tlv_n1 --expose-tlv-type=tlv_n2
|
||||
|
||||
# The payload isn't parsed in a fromwire, so we need to expose it.
|
||||
wire/onion_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='bitcoin/privkey.h' --include='common/bigsize.h' --include='common/amount.h' --include='common/node_id.h' --include='bitcoin/block.h' -s --expose-tlv-type=tlv_payload
|
||||
wire/onion_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='bitcoin/privkey.h' --include='common/bigsize.h' --include='common/amount.h' --include='common/node_id.h' --include='bitcoin/block.h' --include='common/sciddir_or_pubkey.h' -s --expose-tlv-type=tlv_payload
|
||||
|
||||
wire/onion_wiregen.c_args := -s --expose-tlv-type=tlv_payload
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#ifndef LIGHTNING_WIRE_ONION_DEFS_H
|
||||
#define LIGHTNING_WIRE_ONION_DEFS_H
|
||||
#include "config.h"
|
||||
#include <common/sciddir_or_pubkey.h>
|
||||
|
||||
/* BOLT #4:
|
||||
*
|
||||
|
|
|
@ -95,7 +95,7 @@ tlvdata,onionmsg_tlv,invoice,invoice,byte,...
|
|||
tlvtype,onionmsg_tlv,invoice_error,68
|
||||
tlvdata,onionmsg_tlv,invoice_error,invoice_error,byte,...
|
||||
subtype,blinded_path
|
||||
subtypedata,blinded_path,first_node_id,point,
|
||||
subtypedata,blinded_path,first_node_id,sciddir_or_pubkey,
|
||||
subtypedata,blinded_path,blinding,point,
|
||||
subtypedata,blinded_path,num_hops,byte,
|
||||
subtypedata,blinded_path,path,onionmsg_hop,num_hops
|
||||
|
|
|
Loading…
Add table
Reference in a new issue