Use node_id everywhere for nodes.

I tried to just do gossipd, but it was uncontainable, so this ended up being
a complete sweep.

We didn't get much space saving in gossipd, even though we should save
24 bytes per node.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-04-08 19:28:32 +09:30
committed by neil saitug
parent b4455d517c
commit a2fa699e0e
63 changed files with 685 additions and 578 deletions

View File

@@ -110,7 +110,7 @@ void delete_channel(struct channel *channel)
}
void get_channel_basepoints(struct lightningd *ld,
const struct pubkey *peer_id,
const struct node_id *peer_id,
const u64 dbid,
struct basepoints *local_basepoints,
struct pubkey *local_funding_pubkey)
@@ -197,7 +197,9 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
if (!log) {
/* FIXME: update log prefix when we get scid */
/* FIXME: Use minimal unique pubkey prefix for logs! */
const char *idname = type_to_string(peer, struct pubkey, &peer->id);
const char *idname = type_to_string(peer,
struct node_id,
&peer->id);
channel->log = new_log(channel,
peer->log_book, "%s chan #%"PRIu64":",
idname, dbid);
@@ -286,7 +288,7 @@ struct channel *peer_normal_channel(struct peer *peer)
}
struct channel *active_channel_by_id(struct lightningd *ld,
const struct pubkey *id,
const struct node_id *id,
struct uncommitted_channel **uc)
{
struct peer *peer = peer_by_id(ld, id);

View File

@@ -189,7 +189,7 @@ struct channel *peer_normal_channel(struct peer *peer);
/* Get active channel for peer, optionally any uncommitted_channel. */
struct channel *active_channel_by_id(struct lightningd *ld,
const struct pubkey *id,
const struct node_id *id,
struct uncommitted_channel **uc);
struct channel *channel_by_dbid(struct lightningd *ld, const u64 dbid);
@@ -227,7 +227,7 @@ static inline bool channel_active(const struct channel *channel)
}
void get_channel_basepoints(struct lightningd *ld,
const struct pubkey *peer_id,
const struct node_id *peer_id,
const u64 dbid,
struct basepoints *local_basepoints,
struct pubkey *local_funding_pubkey);

View File

@@ -1,4 +1,3 @@
#include <bitcoin/pubkey.h>
#include <ccan/err/err.h>
#include <ccan/fdpass/fdpass.h>
#include <ccan/list/list.h>
@@ -8,6 +7,7 @@
#include <common/json_helpers.h>
#include <common/jsonrpc_errors.h>
#include <common/memleak.h>
#include <common/node_id.h>
#include <common/param.h>
#include <common/pseudorand.h>
#include <common/timeout.h>
@@ -32,7 +32,7 @@
struct connect {
struct list_node list;
struct pubkey id;
struct node_id id;
struct command *cmd;
};
@@ -42,7 +42,7 @@ static void destroy_connect(struct connect *c)
}
static struct connect *new_connect(struct lightningd *ld,
const struct pubkey *id,
const struct node_id *id,
struct command *cmd)
{
struct connect *c = tal(cmd, struct connect);
@@ -55,23 +55,23 @@ static struct connect *new_connect(struct lightningd *ld,
/* Finds first command which matches. */
static struct connect *find_connect(struct lightningd *ld,
const struct pubkey *id)
const struct node_id *id)
{
struct connect *i;
list_for_each(&ld->connects, i, list) {
if (pubkey_eq(&i->id, id))
if (node_id_eq(&i->id, id))
return i;
}
return NULL;
}
static struct command_result *connect_cmd_succeed(struct command *cmd,
const struct pubkey *id)
const struct node_id *id)
{
struct json_stream *response = json_stream_success(cmd);
json_object_start(response, NULL);
json_add_pubkey(response, "id", id);
json_add_node_id(response, "id", id);
json_object_end(response);
return command_success(cmd, response);
}
@@ -83,7 +83,7 @@ static struct command_result *json_connect(struct command *cmd,
{
u32 *port;
jsmntok_t *idtok;
struct pubkey id;
struct node_id id;
char *id_str;
char *atptr;
char *ataddr = NULL;
@@ -110,7 +110,7 @@ static struct command_result *json_connect(struct command *cmd,
idtok->end = idtok->start + atidx;
}
if (!json_to_pubkey(buffer, idtok, &id)) {
if (!json_to_node_id(buffer, idtok, &id)) {
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"id %.*s not valid",
json_tok_full_len(idtok),
@@ -231,7 +231,7 @@ void delay_then_reconnect(struct channel *channel, u32 seconds_delay,
static void connect_failed(struct lightningd *ld, const u8 *msg)
{
struct pubkey id;
struct node_id id;
char *err;
struct connect *c;
u32 seconds_to_delay;
@@ -255,7 +255,7 @@ static void connect_failed(struct lightningd *ld, const u8 *msg)
delay_then_reconnect(channel, seconds_to_delay, addrhint);
}
void connect_succeeded(struct lightningd *ld, const struct pubkey *id)
void connect_succeeded(struct lightningd *ld, const struct node_id *id)
{
struct connect *c;
@@ -268,7 +268,7 @@ void connect_succeeded(struct lightningd *ld, const struct pubkey *id)
static void peer_please_disconnect(struct lightningd *ld, const u8 *msg)
{
struct pubkey id;
struct node_id id;
struct channel *c;
struct uncommitted_channel *uc;

View File

@@ -12,7 +12,7 @@ void connectd_activate(struct lightningd *ld);
void delay_then_reconnect(struct channel *channel, u32 seconds_delay,
const struct wireaddr_internal *addrhint TAKES);
void connect_succeeded(struct lightningd *ld, const struct pubkey *id);
void connect_succeeded(struct lightningd *ld, const struct node_id *id);
void gossip_connect_result(struct lightningd *ld, const u8 *msg);
#endif /* LIGHTNING_LIGHTNINGD_CONNECT_CONTROL_H */

View File

@@ -185,24 +185,6 @@ void gossipd_notify_spend(struct lightningd *ld,
subd_send_msg(ld->gossip, msg);
}
/* Gossipd shouldn't give us bad pubkeys, but don't abort if they do */
static void json_add_raw_pubkey(struct json_stream *response,
const char *fieldname,
const u8 raw_pubkey[sizeof(struct pubkey)])
{
secp256k1_pubkey pubkey;
u8 der[PUBKEY_CMPR_LEN];
size_t outlen = PUBKEY_CMPR_LEN;
memcpy(&pubkey, raw_pubkey, sizeof(pubkey));
if (!secp256k1_ec_pubkey_serialize(secp256k1_ctx, der, &outlen,
&pubkey,
SECP256K1_EC_COMPRESSED))
json_add_string(response, fieldname, "INVALID PUBKEY");
else
json_add_hex(response, fieldname, der, sizeof(der));
}
static void json_getnodes_reply(struct subd *gossip UNUSED, const u8 *reply,
const int *fds UNUSED,
struct command *cmd)
@@ -225,7 +207,7 @@ static void json_getnodes_reply(struct subd *gossip UNUSED, const u8 *reply,
struct json_escaped *esc;
json_object_start(response, NULL);
json_add_raw_pubkey(response, "nodeid", nodes[i]->nodeid);
json_add_node_id(response, "nodeid", &nodes[i]->nodeid);
if (nodes[i]->last_timestamp < 0) {
json_object_end(response);
continue;
@@ -262,10 +244,10 @@ static struct command_result *json_listnodes(struct command *cmd,
const jsmntok_t *params)
{
u8 *req;
struct pubkey *id;
struct node_id *id;
if (!param(cmd, buffer, params,
p_opt("id", param_pubkey, &id),
p_opt("id", param_node_id, &id),
NULL))
return command_param_failed();
@@ -308,8 +290,8 @@ static struct command_result *json_getroute(struct command *cmd,
const jsmntok_t *params)
{
struct lightningd *ld = cmd->ld;
struct pubkey *destination;
struct pubkey *source;
struct node_id *destination;
struct node_id *source;
const jsmntok_t *excludetok;
struct amount_msat *msat;
unsigned *cltv;
@@ -325,11 +307,11 @@ static struct command_result *json_getroute(struct command *cmd,
double *fuzz;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &destination),
p_req("id", param_node_id, &destination),
p_req("msatoshi", param_msat, &msat),
p_req("riskfactor", param_double, &riskfactor),
p_opt_def("cltv", param_number, &cltv, 9),
p_opt_def("fromid", param_pubkey, &source, ld->id),
p_opt_def("fromid", param_node_id, &source, ld->id),
p_opt_def("fuzzpercent", param_percent, &fuzz, 5.0),
p_opt("exclude", param_array, &excludetok),
p_opt_def("maxhops", param_number, &max_hops,
@@ -404,9 +386,10 @@ static void json_listchannels_reply(struct subd *gossip UNUSED, const u8 *reply,
json_array_start(response, "channels");
for (i = 0; i < tal_count(entries); i++) {
json_object_start(response, NULL);
json_add_raw_pubkey(response, "source", entries[i].source);
json_add_raw_pubkey(response, "destination",
entries[i].destination);
json_add_node_id(response, "source",
&entries[i].source);
json_add_node_id(response, "destination",
&entries[i].destination);
json_add_string(response, "short_channel_id",
type_to_string(reply, struct short_channel_id,
&entries[i].short_channel_id));
@@ -442,11 +425,11 @@ static struct command_result *json_listchannels(struct command *cmd,
{
u8 *req;
struct short_channel_id *id;
struct pubkey *source;
struct node_id *source;
if (!param(cmd, buffer, params,
p_opt("short_channel_id", param_short_channel_id, &id),
p_opt("source", param_pubkey, &source),
p_opt("source", param_node_id, &source),
NULL))
return command_param_failed();
@@ -500,12 +483,12 @@ static struct command_result *json_dev_query_scids(struct command *cmd,
u8 *msg;
const jsmntok_t *scidstok;
const jsmntok_t *t;
struct pubkey *id;
struct node_id *id;
struct short_channel_id *scids;
size_t i;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &id),
p_req("id", param_node_id, &id),
p_req("scids", param_array, &scidstok),
NULL))
return command_param_failed();
@@ -542,11 +525,11 @@ json_dev_send_timestamp_filter(struct command *cmd,
const jsmntok_t *params)
{
u8 *msg;
struct pubkey *id;
struct node_id *id;
u32 *first, *range;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &id),
p_req("id", param_node_id, &id),
p_req("first", param_number, &first),
p_req("range", param_number, &range),
NULL))
@@ -612,11 +595,11 @@ static struct command_result *json_dev_query_channel_range(struct command *cmd,
const jsmntok_t *params)
{
u8 *msg;
struct pubkey *id;
struct node_id *id;
u32 *first, *num;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &id),
p_req("id", param_node_id, &id),
p_req("first", param_number, &first),
p_req("num", param_number, &num),
NULL))

View File

@@ -12,7 +12,7 @@ struct gossip_getnodes_entry *fromwire_gossip_getnodes_entry(const tal_t *ctx,
u16 flen;
entry = tal(ctx, struct gossip_getnodes_entry);
fromwire(pptr, max, entry->nodeid, sizeof(entry->nodeid));
fromwire_node_id(pptr, max, &entry->nodeid);
entry->last_timestamp = fromwire_u64(pptr, max);
if (entry->last_timestamp < 0) {
@@ -43,7 +43,7 @@ struct gossip_getnodes_entry *fromwire_gossip_getnodes_entry(const tal_t *ctx,
void towire_gossip_getnodes_entry(u8 **pptr,
const struct gossip_getnodes_entry *entry)
{
towire(pptr, entry->nodeid, sizeof(entry->nodeid));
towire_node_id(pptr, &entry->nodeid);
towire_u64(pptr, entry->last_timestamp);
if (entry->last_timestamp < 0)
@@ -62,7 +62,7 @@ void towire_gossip_getnodes_entry(u8 **pptr,
void fromwire_route_hop(const u8 **pptr, size_t *max, struct route_hop *entry)
{
fromwire_pubkey(pptr, max, &entry->nodeid);
fromwire_node_id(pptr, max, &entry->nodeid);
fromwire_short_channel_id(pptr, max, &entry->channel_id);
entry->direction = fromwire_u8(pptr, max);
entry->amount = fromwire_amount_msat(pptr, max);
@@ -71,7 +71,7 @@ void fromwire_route_hop(const u8 **pptr, size_t *max, struct route_hop *entry)
void towire_route_hop(u8 **pptr, const struct route_hop *entry)
{
towire_pubkey(pptr, &entry->nodeid);
towire_node_id(pptr, &entry->nodeid);
towire_short_channel_id(pptr, &entry->channel_id);
towire_u8(pptr, entry->direction);
towire_amount_msat(pptr, entry->amount);
@@ -80,7 +80,7 @@ void towire_route_hop(u8 **pptr, const struct route_hop *entry)
void fromwire_route_info(const u8 **pptr, size_t *max, struct route_info *entry)
{
fromwire_pubkey(pptr, max, &entry->pubkey);
fromwire_node_id(pptr, max, &entry->pubkey);
fromwire_short_channel_id(pptr, max, &entry->short_channel_id);
entry->fee_base_msat = fromwire_u32(pptr, max);
entry->fee_proportional_millionths = fromwire_u32(pptr, max);
@@ -89,7 +89,7 @@ void fromwire_route_info(const u8 **pptr, size_t *max, struct route_info *entry)
void towire_route_info(u8 **pptr, const struct route_info *entry)
{
towire_pubkey(pptr, &entry->pubkey);
towire_node_id(pptr, &entry->pubkey);
towire_short_channel_id(pptr, &entry->short_channel_id);
towire_u32(pptr, entry->fee_base_msat);
towire_u32(pptr, entry->fee_proportional_millionths);
@@ -100,8 +100,8 @@ void fromwire_gossip_getchannels_entry(const u8 **pptr, size_t *max,
struct gossip_getchannels_entry *entry)
{
fromwire_short_channel_id(pptr, max, &entry->short_channel_id);
fromwire(pptr, max, entry->source, sizeof(entry->source));
fromwire(pptr, max, entry->destination, sizeof(entry->destination));
fromwire_node_id(pptr, max, &entry->source);
fromwire_node_id(pptr, max, &entry->destination);
entry->sat = fromwire_amount_sat(pptr, max);
entry->message_flags = fromwire_u8(pptr, max);
entry->channel_flags = fromwire_u8(pptr, max);
@@ -117,8 +117,8 @@ void towire_gossip_getchannels_entry(u8 **pptr,
const struct gossip_getchannels_entry *entry)
{
towire_short_channel_id(pptr, &entry->short_channel_id);
towire(pptr, entry->source, sizeof(entry->source));
towire(pptr, entry->destination, sizeof(entry->destination));
towire_node_id(pptr, &entry->source);
towire_node_id(pptr, &entry->destination);
towire_amount_sat(pptr, entry->sat);
towire_u8(pptr, entry->message_flags);
towire_u8(pptr, entry->channel_flags);

View File

@@ -12,8 +12,7 @@ struct peer_features {
};
struct gossip_getnodes_entry {
/* This is raw to optimize marshaling: be careful! */
u8 nodeid[sizeof(struct pubkey)];
struct node_id nodeid;
s64 last_timestamp; /* -1 means never: following fields ignored */
u8 *globalfeatures;
struct wireaddr *addresses;
@@ -22,8 +21,7 @@ struct gossip_getnodes_entry {
};
struct gossip_getchannels_entry {
/* These are raw to optimize marshaling: be careful! */
u8 source[sizeof(struct pubkey)], destination[sizeof(struct pubkey)];
struct node_id source, destination;
struct amount_sat sat;
struct short_channel_id short_channel_id;
u8 message_flags;

View File

@@ -21,7 +21,7 @@
#include <wire/wire_sync.h>
static int hsm_get_fd(struct lightningd *ld,
const struct pubkey *id,
const struct node_id *id,
u64 dbid,
int capabilities)
{
@@ -43,7 +43,7 @@ static int hsm_get_fd(struct lightningd *ld,
}
int hsm_get_client_fd(struct lightningd *ld,
const struct pubkey *id,
const struct node_id *id,
u64 dbid,
int capabilities)
{
@@ -61,7 +61,7 @@ static unsigned int hsm_msg(struct subd *hsmd,
const u8 *msg, const int *fds UNUSED)
{
/* We only expect one thing from the HSM that's not a STATUS message */
struct pubkey client_id;
struct node_id client_id;
u8 *bad_msg;
char *desc;
@@ -71,7 +71,7 @@ static unsigned int hsm_msg(struct subd *hsmd,
/* This should, of course, never happen. */
log_broken(hsmd->log, "client %s %s (request %s)",
type_to_string(tmpctx, struct pubkey, &client_id),
type_to_string(tmpctx, struct node_id, &client_id),
desc, tal_hex(tmpctx, bad_msg));
return 0;
}

View File

@@ -7,11 +7,11 @@
#include <stdbool.h>
struct lightningd;
struct pubkey;
struct node_id;
/* Ask HSM for a new fd for a subdaemon to use. */
int hsm_get_client_fd(struct lightningd *ld,
const struct pubkey *id,
const struct node_id *id,
u64 dbid,
int capabilities);

View File

@@ -334,7 +334,7 @@ static struct route_info *unpack_route(const tal_t *ctx,
"fee_proportional_millionths");
cltv = json_get_member(buffer, t, "cltv_expiry_delta");
if (!json_to_pubkey(buffer, pubkey, &r->pubkey)
if (!json_to_node_id(buffer, pubkey, &r->pubkey)
|| !json_to_short_channel_id(buffer, scid,
&r->short_channel_id,
deprecated_apis)
@@ -811,7 +811,7 @@ static struct command_result *json_decodepay(struct command *cmd,
json_add_string(response, "currency", b11->chain->bip173_name);
json_add_u64(response, "created_at", b11->timestamp);
json_add_u64(response, "expiry", b11->expiry);
json_add_pubkey(response, "payee", &b11->receiver_id);
json_add_node_id(response, "payee", &b11->receiver_id);
if (b11->msat)
json_add_amount_msat(response, *b11->msat,
"msatoshi", "amount_msat");
@@ -841,8 +841,8 @@ static struct command_result *json_decodepay(struct command *cmd,
json_array_start(response, NULL);
for (n = 0; n < tal_count(b11->routes[i]); n++) {
json_object_start(response, NULL);
json_add_pubkey(response, "pubkey",
&b11->routes[i][n].pubkey);
json_add_node_id(response, "pubkey",
&b11->routes[i][n].pubkey);
json_add_short_channel_id(response,
"short_channel_id",
&b11->routes[i][n]

View File

@@ -29,7 +29,7 @@ json_add_route_hop(struct json_stream *r, char const *n,
{
/* Imitate what getroute/sendpay use */
json_object_start(r, n);
json_add_pubkey(r, "id", &h->nodeid);
json_add_node_id(r, "id", &h->nodeid);
json_add_short_channel_id(r, "channel",
&h->channel_id);
json_add_num(r, "direction", h->direction);

View File

@@ -803,7 +803,7 @@ int main(int argc, char *argv[])
* so it can use tal_bytelen() to get the length. */
log_info(ld->log, "--------------------------------------------------");
log_info(ld->log, "Server started with public key %s, alias %s (color #%s) and lightningd %s",
type_to_string(tmpctx, struct pubkey, &ld->id),
type_to_string(tmpctx, struct node_id, &ld->id),
json_escape(tmpctx, (const char *)ld->alias)->s,
tal_hex(tmpctx, ld->rgb), version());

View File

@@ -105,7 +105,7 @@ struct lightningd {
const char *logfile;
/* This is us. */
struct pubkey id;
struct node_id id;
/* My name is... my favorite color is... */
u8 *alias; /* At least 32 bytes (zero-filled) */

View File

@@ -14,22 +14,22 @@ bool notifications_have_topic(const char *topic)
return false;
}
void notify_connect(struct lightningd *ld, struct pubkey *nodeid,
void notify_connect(struct lightningd *ld, struct node_id *nodeid,
struct wireaddr_internal *addr)
{
struct jsonrpc_notification *n =
jsonrpc_notification_start(NULL, notification_topics[0]);
json_add_pubkey(n->stream, "id", nodeid);
json_add_node_id(n->stream, "id", nodeid);
json_add_address_internal(n->stream, "address", addr);
jsonrpc_notification_end(n);
plugins_notify(ld->plugins, take(n));
}
void notify_disconnect(struct lightningd *ld, struct pubkey *nodeid)
void notify_disconnect(struct lightningd *ld, struct node_id *nodeid)
{
struct jsonrpc_notification *n =
jsonrpc_notification_start(NULL, notification_topics[1]);
json_add_pubkey(n->stream, "id", nodeid);
json_add_node_id(n->stream, "id", nodeid);
jsonrpc_notification_end(n);
plugins_notify(ld->plugins, take(n));
}

View File

@@ -7,8 +7,8 @@
bool notifications_have_topic(const char *topic);
void notify_connect(struct lightningd *ld, struct pubkey *nodeid,
void notify_connect(struct lightningd *ld, struct node_id *nodeid,
struct wireaddr_internal *addr);
void notify_disconnect(struct lightningd *ld, struct pubkey *nodeid);
void notify_disconnect(struct lightningd *ld, struct node_id *nodeid);
#endif /* LIGHTNING_LIGHTNINGD_NOTIFICATION_H */

View File

@@ -638,7 +638,7 @@ new_uncommitted_channel(struct peer *peer)
uc->transient_billboard = NULL;
uc->dbid = wallet_get_channel_dbid(ld->wallet);
idname = type_to_string(uc, struct pubkey, &uc->peer->id);
idname = type_to_string(uc, struct node_id, &uc->peer->id);
uc->log = new_log(uc, uc->peer->log_book, "%s chan #%"PRIu64":",
idname, uc->dbid);
tal_free(idname);
@@ -833,7 +833,7 @@ static struct command_result *json_fund_channel(struct command *cmd,
{
struct command_result *res;
struct funding_channel * fc = tal(cmd, struct funding_channel);
struct pubkey *id;
struct node_id *id;
struct peer *peer;
struct channel *channel;
u32 *feerate_per_kw, *minconf, maxheight;
@@ -847,7 +847,7 @@ static struct command_result *json_fund_channel(struct command *cmd,
fc->uc = NULL;
wtx_init(cmd, &fc->wtx, max_funding_satoshi);
if (!param(fc->cmd, buffer, params,
p_req("id", param_pubkey, &id),
p_req("id", param_node_id, &id),
p_req("satoshi", param_wtx, &fc->wtx),
p_opt("feerate", param_feerate, &feerate_per_kw),
p_opt_def("announce", param_bool, &announce_channel, true),
@@ -894,7 +894,7 @@ static struct command_result *json_fund_channel(struct command *cmd,
if (!*announce_channel) {
fc->channel_flags &= ~CHANNEL_FLAGS_ANNOUNCE_CHANNEL;
log_info(peer->ld->log, "Will open private channel with node %s",
type_to_string(fc, struct pubkey, id));
type_to_string(fc, struct node_id, id));
}
maxheight = minconf_to_maxheight(*minconf, cmd->ld);

View File

@@ -845,19 +845,16 @@ static const char *codename_noun[]
void setup_color_and_alias(struct lightningd *ld)
{
u8 der[PUBKEY_CMPR_LEN];
pubkey_to_der(der, &ld->id);
if (!ld->rgb)
/* You can't get much red by default */
ld->rgb = tal_dup_arr(ld, u8, der, 3, 0);
ld->rgb = tal_dup_arr(ld, u8, ld->id.k, 3, 0);
if (!ld->alias) {
u64 adjective, noun;
char *name;
memcpy(&adjective, der+3, sizeof(adjective));
memcpy(&noun, der+3+sizeof(adjective), sizeof(noun));
memcpy(&adjective, ld->id.k+3, sizeof(adjective));
memcpy(&noun, ld->id.k+3+sizeof(adjective), sizeof(noun));
noun %= ARRAY_SIZE(codename_noun);
adjective %= ARRAY_SIZE(codename_adjective);

View File

@@ -22,7 +22,7 @@
struct routing_failure {
unsigned int erring_index;
enum onion_type failcode;
struct pubkey erring_node;
struct node_id erring_node;
struct short_channel_id erring_channel;
int channel_dir;
};
@@ -77,7 +77,7 @@ json_add_payment_fields(struct json_stream *response,
{
json_add_u64(response, "id", t->id);
json_add_hex(response, "payment_hash", &t->payment_hash, sizeof(t->payment_hash));
json_add_pubkey(response, "destination", &t->destination);
json_add_node_id(response, "destination", &t->destination);
json_add_amount_msat(response, t->msatoshi,
"msatoshi", "amount_msat");
json_add_amount_msat(response, t->msatoshi_sent,
@@ -126,7 +126,7 @@ static void
json_add_routefail_info(struct json_stream *js,
unsigned int erring_index,
enum onion_type failcode,
const struct pubkey *erring_node,
const struct node_id *erring_node,
const struct short_channel_id *erring_channel,
int channel_dir)
{
@@ -138,7 +138,7 @@ json_add_routefail_info(struct json_stream *js,
/* FIXME: Better way to detect this? */
if (!strstarts(failcodename, "INVALID "))
json_add_string(js, "failcodename", failcodename);
json_add_pubkey(js, "erring_node", erring_node);
json_add_node_id(js, "erring_node", erring_node);
json_add_short_channel_id(js, "erring_channel", erring_channel);
json_add_num(js, "erring_direction", channel_dir);
json_object_end(js);
@@ -248,7 +248,7 @@ immediate_routing_failure(const tal_t *ctx,
const struct lightningd *ld,
enum onion_type failcode,
const struct short_channel_id *channel0,
const struct pubkey *dstid)
const struct node_id *dstid)
{
struct routing_failure *routing_failure;
@@ -259,7 +259,7 @@ immediate_routing_failure(const tal_t *ctx,
routing_failure->failcode = failcode;
routing_failure->erring_node = ld->id;
routing_failure->erring_channel = *channel0;
routing_failure->channel_dir = pubkey_idx(&ld->id, dstid);
routing_failure->channel_dir = node_id_idx(&ld->id, dstid);
return routing_failure;
}
@@ -281,8 +281,8 @@ local_routing_failure(const tal_t *ctx,
routing_failure->failcode = hout->failcode;
routing_failure->erring_node = ld->id;
routing_failure->erring_channel = payment->route_channels[0];
routing_failure->channel_dir = pubkey_idx(&ld->id,
&payment->route_nodes[0]);
routing_failure->channel_dir = node_id_idx(&ld->id,
&payment->route_nodes[0]);
log_debug(hout->key.channel->log, "local_routing_failure: %u (%s)",
hout->failcode, onion_type_name(hout->failcode));
@@ -300,8 +300,8 @@ remote_routing_failure(const tal_t *ctx,
{
enum onion_type failcode = fromwire_peektype(failure->msg);
struct routing_failure *routing_failure;
const struct pubkey *route_nodes;
const struct pubkey *erring_node;
const struct node_id *route_nodes;
const struct node_id *erring_node;
const struct short_channel_id *route_channels;
const struct short_channel_id *erring_channel;
int origin_index;
@@ -320,11 +320,11 @@ remote_routing_failure(const tal_t *ctx,
erring_channel = &route_channels[origin_index];
/* Single hop? */
if (origin_index == 0)
dir = pubkey_idx(&ld->id,
&route_nodes[origin_index]);
dir = node_id_idx(&ld->id,
&route_nodes[origin_index]);
else
dir = pubkey_idx(&route_nodes[origin_index - 1],
&route_nodes[origin_index]);
dir = node_id_idx(&route_nodes[origin_index - 1],
&route_nodes[origin_index]);
/* BOLT #4:
*
@@ -346,8 +346,8 @@ remote_routing_failure(const tal_t *ctx,
/* Report the *next* channel as failing. */
erring_channel = &route_channels[origin_index + 1];
dir = pubkey_idx(&route_nodes[origin_index],
&route_nodes[origin_index+1]);
dir = node_id_idx(&route_nodes[origin_index],
&route_nodes[origin_index+1]);
/* If the error is a BADONION, then it's on behalf of the
* following node. */
@@ -511,7 +511,7 @@ static struct command_result *wait_payment(struct lightningd *ld,
bool faildestperm;
int failindex;
enum onion_type failcode;
struct pubkey *failnode;
struct node_id *failnode;
struct short_channel_id *failchannel;
u8 *failupdate;
char *faildetail;
@@ -596,7 +596,8 @@ send_payment(struct lightningd *ld,
enum onion_type failcode;
size_t i, n_hops = tal_count(route);
struct hop_data *hop_data = tal_arr(tmpctx, struct hop_data, n_hops);
struct pubkey *ids = tal_arr(tmpctx, struct pubkey, n_hops);
struct pubkey *path = tal_arr(tmpctx, struct pubkey, n_hops);
struct node_id *ids = tal_arr(tmpctx, struct node_id, n_hops);
struct wallet_payment *payment = NULL;
struct htlc_out *hout;
struct short_channel_id *channels;
@@ -606,9 +607,19 @@ send_payment(struct lightningd *ld,
/* Expiry for HTLCs is absolute. And add one to give some margin. */
base_expiry = get_block_height(ld->topology) + 1;
/* Extract IDs for each hop: create_onionpacket wants array. */
for (i = 0; i < n_hops; i++)
/* Extract IDs for each hop: create_onionpacket wants array of *keys*,
* and wallet wants continuous array of node_ids */
for (i = 0; i < n_hops; i++) {
ids[i] = route[i].nodeid;
/* JSON parsing checked these were valid, so Shouldn't Happen */
if (!pubkey_from_node_id(&path[i], &ids[i])) {
return command_fail(cmd, PAY_RHASH_ALREADY_USED,
"Invalid nodeid %s",
type_to_string(tmpctx,
struct node_id,
&ids[i]));
}
}
/* Copy hop_data[n] from route[n+1] (ie. where it goes next) */
for (i = 0; i < n_hops - 1; i++) {
@@ -645,11 +656,11 @@ send_payment(struct lightningd *ld,
struct amount_msat,
&payment->msatoshi));
}
if (!pubkey_eq(&payment->destination, &ids[n_hops-1])) {
if (!node_id_eq(&payment->destination, &ids[n_hops-1])) {
return command_fail(cmd, PAY_RHASH_ALREADY_USED,
"Already succeeded to %s",
type_to_string(tmpctx,
struct pubkey,
struct node_id,
&payment->destination));
}
return sendpay_success(cmd, payment);
@@ -666,14 +677,14 @@ send_payment(struct lightningd *ld,
json_add_routefail_info(data, 0, WIRE_UNKNOWN_NEXT_PEER,
&ld->id, &route[0].channel_id,
pubkey_idx(&ld->id, &route[0].nodeid));
node_id_idx(&ld->id, &route[0].nodeid));
return command_failed(cmd, data);
}
randombytes_buf(&sessionkey, sizeof(sessionkey));
/* Onion will carry us from first peer onwards. */
packet = create_onionpacket(tmpctx, ids, hop_data, sessionkey, rhash->u.u8,
packet = create_onionpacket(tmpctx, path, hop_data, sessionkey, rhash->u.u8,
sizeof(struct sha256), &path_secrets);
onion = serialize_onionpacket(tmpctx, packet);
@@ -799,7 +810,7 @@ static struct command_result *json_sendpay(struct command *cmd,
route = tal_arr(cmd, struct route_hop, routetok->size);
json_for_each_arr(i, t, routetok) {
struct amount_msat *msat, *amount_msat;
struct pubkey *id;
struct node_id *id;
struct short_channel_id *channel;
unsigned *delay, *direction;
@@ -808,7 +819,7 @@ static struct command_result *json_sendpay(struct command *cmd,
p_opt("msatoshi", param_msat, &msat),
p_opt("amount_msat", param_msat, &amount_msat),
/* These three actually required */
p_opt("id", param_pubkey, &id),
p_opt("id", param_node_id, &id),
p_opt("delay", param_number, &delay),
p_opt("channel", param_short_channel_id, &channel),
p_opt("direction", param_number, &direction),

View File

@@ -98,7 +98,7 @@ static void peer_update_features(struct peer *peer,
}
struct peer *new_peer(struct lightningd *ld, u64 dbid,
const struct pubkey *id,
const struct node_id *id,
const struct wireaddr_internal *addr)
{
/* We are owned by our channels, and freed manually by destroy_channel */
@@ -111,7 +111,7 @@ struct peer *new_peer(struct lightningd *ld, u64 dbid,
peer->addr = *addr;
peer->globalfeatures = peer->localfeatures = NULL;
list_head_init(&peer->channels);
peer->direction = get_channel_direction(&peer->ld->id, &peer->id);
peer->direction = node_id_idx(&peer->ld->id, &peer->id);
#if DEVELOPER
peer->ignore_htlcs = false;
@@ -162,12 +162,12 @@ struct peer *find_peer_by_dbid(struct lightningd *ld, u64 dbid)
return NULL;
}
struct peer *peer_by_id(struct lightningd *ld, const struct pubkey *id)
struct peer *peer_by_id(struct lightningd *ld, const struct node_id *id)
{
struct peer *p;
list_for_each(&ld->peers, p, list)
if (pubkey_eq(&p->id, id))
if (node_id_eq(&p->id, id))
return p;
return NULL;
}
@@ -176,9 +176,9 @@ struct peer *peer_from_json(struct lightningd *ld,
const char *buffer,
const jsmntok_t *peeridtok)
{
struct pubkey peerid;
struct node_id peerid;
if (!json_to_pubkey(buffer, peeridtok, &peerid))
if (!json_to_node_id(buffer, peeridtok, &peerid))
return NULL;
return peer_by_id(ld, &peerid);
@@ -526,7 +526,7 @@ static void json_add_channel(struct lightningd *ld,
json_add_short_channel_id(response, "short_channel_id",
channel->scid);
json_add_num(response, "direction",
pubkey_idx(&ld->id, &channel->peer->id));
node_id_idx(&ld->id, &channel->peer->id));
}
derive_channel_id(&cid, &channel->funding_txid,
@@ -542,12 +542,12 @@ static void json_add_channel(struct lightningd *ld,
// are implemented
json_object_start(response, "funding_allocation_msat");
if (channel->funder == LOCAL) {
json_add_u64(response, pubkey_to_hexstr(tmpctx, &p->id), 0);
json_add_u64(response, pubkey_to_hexstr(tmpctx, &ld->id),
json_add_u64(response, node_id_to_hexstr(tmpctx, &p->id), 0);
json_add_u64(response, node_id_to_hexstr(tmpctx, &ld->id),
channel->funding.satoshis * 1000); /* Raw: raw JSON field */
} else {
json_add_u64(response, pubkey_to_hexstr(tmpctx, &ld->id), 0);
json_add_u64(response, pubkey_to_hexstr(tmpctx, &p->id),
json_add_u64(response, node_id_to_hexstr(tmpctx, &ld->id), 0);
json_add_u64(response, node_id_to_hexstr(tmpctx, &p->id),
channel->funding.satoshis * 1000); /* Raw: raw JSON field */
}
json_object_end(response);
@@ -555,17 +555,17 @@ static void json_add_channel(struct lightningd *ld,
json_object_start(response, "funding_msat");
if (channel->funder == LOCAL) {
json_add_sat_only(response,
pubkey_to_hexstr(tmpctx, &p->id),
node_id_to_hexstr(tmpctx, &p->id),
AMOUNT_SAT(0));
json_add_sat_only(response,
pubkey_to_hexstr(tmpctx, &ld->id),
node_id_to_hexstr(tmpctx, &ld->id),
channel->funding);
} else {
json_add_sat_only(response,
pubkey_to_hexstr(tmpctx, &ld->id),
node_id_to_hexstr(tmpctx, &ld->id),
AMOUNT_SAT(0));
json_add_sat_only(response,
pubkey_to_hexstr(tmpctx, &p->id),
node_id_to_hexstr(tmpctx, &p->id),
channel->funding);
}
json_object_end(response);
@@ -682,7 +682,7 @@ peer_connected_serialize(struct peer_connected_hook_payload *payload,
{
const struct peer *p = payload->peer;
json_object_start(stream, "peer");
json_add_pubkey(stream, "id", &p->id);
json_add_node_id(stream, "id", &p->id);
json_add_string(
stream, "addr",
type_to_string(stream, struct wireaddr_internal, &payload->addr));
@@ -819,7 +819,7 @@ REGISTER_PLUGIN_HOOK(peer_connected, peer_connected_hook_cb,
void peer_connected(struct lightningd *ld, const u8 *msg,
int peer_fd, int gossip_fd)
{
struct pubkey id;
struct node_id id;
u8 *globalfeatures, *localfeatures;
struct peer *peer;
struct peer_connected_hook_payload *hook_payload;
@@ -948,7 +948,7 @@ static void json_add_peer(struct lightningd *ld,
struct channel *channel;
json_object_start(response, NULL);
json_add_pubkey(response, "id", &p->id);
json_add_node_id(response, "id", &p->id);
/* Channel is also connected if uncommitted channel */
if (p->uncommitted_channel)
@@ -999,12 +999,12 @@ static struct command_result *json_listpeers(struct command *cmd,
const jsmntok_t *params)
{
enum log_level *ll;
struct pubkey *specific_id;
struct node_id *specific_id;
struct peer *peer;
struct json_stream *response;
if (!param(cmd, buffer, params,
p_opt("id", param_pubkey, &specific_id),
p_opt("id", param_node_id, &specific_id),
p_opt("level", param_loglevel, &ll),
NULL))
return command_param_failed();
@@ -1229,13 +1229,13 @@ static struct command_result *json_disconnect(struct command *cmd,
const jsmntok_t *obj UNNEEDED,
const jsmntok_t *params)
{
struct pubkey *id;
struct node_id *id;
struct peer *peer;
struct channel *channel;
bool *force;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &id),
p_req("id", param_node_id, &id),
p_opt_def("force", param_bool, &force, false),
NULL))
return command_param_failed();
@@ -1285,7 +1285,7 @@ static struct command_result *json_getinfo(struct command *cmd,
response = json_stream_success(cmd);
json_object_start(response, NULL);
json_add_pubkey(response, "id", &cmd->ld->id);
json_add_node_id(response, "id", &cmd->ld->id);
json_add_string(response, "alias", (const char *)cmd->ld->alias);
json_add_hex_talarr(response, "color", cmd->ld->rgb);
@@ -1425,7 +1425,7 @@ static void set_channel_fees(struct command *cmd, struct channel *channel,
/* write JSON response entry */
derive_channel_id(&cid, &channel->funding_txid, channel->funding_outnum);
json_object_start(response, NULL);
json_add_pubkey(response, "peer_id", &channel->peer->id);
json_add_node_id(response, "peer_id", &channel->peer->id);
json_add_string(response, "channel_id",
type_to_string(tmpctx, struct channel_id, &cid));
if (channel->scid)
@@ -1508,14 +1508,14 @@ static struct command_result *json_sign_last_tx(struct command *cmd,
const jsmntok_t *obj UNNEEDED,
const jsmntok_t *params)
{
struct pubkey *peerid;
struct node_id *peerid;
struct peer *peer;
struct json_stream *response;
u8 *linear;
struct channel *channel;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &peerid),
p_req("id", param_node_id, &peerid),
NULL))
return command_param_failed();
@@ -1555,12 +1555,12 @@ static struct command_result *json_dev_fail(struct command *cmd,
const jsmntok_t *obj UNNEEDED,
const jsmntok_t *params)
{
struct pubkey *peerid;
struct node_id *peerid;
struct peer *peer;
struct channel *channel;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &peerid),
p_req("id", param_node_id, &peerid),
NULL))
return command_param_failed();
@@ -1600,13 +1600,13 @@ static struct command_result *json_dev_reenable_commit(struct command *cmd,
const jsmntok_t *obj UNNEEDED,
const jsmntok_t *params)
{
struct pubkey *peerid;
struct node_id *peerid;
struct peer *peer;
u8 *msg;
struct channel *channel;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &peerid),
p_req("id", param_node_id, &peerid),
NULL))
return command_param_failed();
@@ -1688,7 +1688,7 @@ static struct command_result *json_dev_forget_channel(struct command *cmd,
const jsmntok_t *obj UNNEEDED,
const jsmntok_t *params)
{
struct pubkey *peerid;
struct node_id *peerid;
struct peer *peer;
struct channel *channel;
struct short_channel_id *scid;
@@ -1697,7 +1697,7 @@ static struct command_result *json_dev_forget_channel(struct command *cmd,
bool *force;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &peerid),
p_req("id", param_node_id, &peerid),
p_opt("short_channel_id", param_short_channel_id, &scid),
p_opt_def("force", param_bool, &force, false),
NULL))

View File

@@ -7,6 +7,7 @@
#include <common/channel_config.h>
#include <common/htlc.h>
#include <common/json.h>
#include <common/node_id.h>
#include <common/wireaddr.h>
#include <lightningd/channel.h>
#include <lightningd/channel_state.h>
@@ -27,7 +28,7 @@ struct peer {
u64 dbid;
/* ID of peer */
struct pubkey id;
struct node_id id;
/* Our channels */
struct list_head channels;
@@ -56,13 +57,13 @@ struct peer {
struct peer *find_peer_by_dbid(struct lightningd *ld, u64 dbid);
struct peer *new_peer(struct lightningd *ld, u64 dbid,
const struct pubkey *id,
const struct node_id *id,
const struct wireaddr_internal *addr);
/* Last one out deletes peer. Also removes from db. */
void maybe_delete_peer(struct peer *peer);
struct peer *peer_by_id(struct lightningd *ld, const struct pubkey *id);
struct peer *peer_by_id(struct lightningd *ld, const struct node_id *id);
struct peer *peer_from_json(struct lightningd *ld,
const char *buffer,
const jsmntok_t *peeridtok);

View File

@@ -493,7 +493,7 @@ static void forward_htlc(struct htlc_in *hin,
u32 cltv_expiry,
struct amount_msat amt_to_forward,
u32 outgoing_cltv_value,
const struct pubkey *next_hop,
const struct node_id *next_hop,
const u8 next_onion[TOTAL_PACKET_SIZE])
{
enum onion_type failcode;
@@ -591,7 +591,7 @@ struct gossip_resolve {
static void channel_resolve_reply(struct subd *gossip, const u8 *msg,
const int *fds UNUSED, struct gossip_resolve *gr)
{
struct pubkey *peer_id;
struct node_id *peer_id;
if (!fromwire_gossip_get_channel_peer_reply(msg, msg, &peer_id)) {
log_broken(gossip->log,
@@ -1755,7 +1755,7 @@ static void fixup_hout(struct lightningd *ld, struct htlc_out *hout)
" is missing a resolution: %s.",
hout->key.id, htlc_state_name(hout->hstate),
type_to_string(tmpctx, struct amount_msat, &hout->msat),
type_to_string(tmpctx, struct pubkey,
type_to_string(tmpctx, struct node_id,
&hout->key.channel->peer->id),
fix);
}
@@ -1852,12 +1852,12 @@ static struct command_result *json_dev_ignore_htlcs(struct command *cmd,
const jsmntok_t *obj UNNEEDED,
const jsmntok_t *params)
{
struct pubkey *peerid;
struct node_id *peerid;
struct peer *peer;
bool *ignore;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &peerid),
p_req("id", param_node_id, &peerid),
p_req("ignore", param_bool, &ignore),
NULL))
return command_param_failed();

View File

@@ -16,17 +16,17 @@
struct ping_command {
struct list_node list;
struct pubkey id;
struct node_id id;
struct command *cmd;
};
static struct ping_command *find_ping_cmd(struct lightningd *ld,
const struct pubkey *id)
const struct node_id *id)
{
struct ping_command *i;
list_for_each(&ld->ping_commands, i, list) {
if (pubkey_eq(id, &i->id))
if (node_id_eq(id, &i->id))
return i;
}
return NULL;
@@ -39,7 +39,7 @@ static void destroy_ping_command(struct ping_command *pc)
static struct ping_command *new_ping_command(const tal_t *ctx,
struct lightningd *ld,
const struct pubkey *peer_id,
const struct node_id *peer_id,
struct command *cmd)
{
struct ping_command *pc = tal(ctx, struct ping_command);
@@ -56,7 +56,7 @@ void ping_reply(struct subd *subd, const u8 *msg)
{
u16 totlen;
bool ok, sent = true;
struct pubkey id;
struct node_id id;
struct ping_command *pc;
log_debug(subd->ld->log, "Got ping reply!");
@@ -87,10 +87,10 @@ static struct command_result *json_ping(struct command *cmd,
{
u8 *msg;
unsigned int *len, *pongbytes;
struct pubkey *id;
struct node_id *id;
if (!param(cmd, buffer, params,
p_req("id", param_pubkey, &id),
p_req("id", param_node_id, &id),
p_opt_def("len", param_number, &len, 128),
p_opt_def("pongbytes", param_number, &pongbytes, 128),
NULL))

View File

@@ -67,7 +67,7 @@ struct command_result *command_success(struct command *cmd UNNEEDED,
{ fprintf(stderr, "command_success called!\n"); abort(); }
/* Generated stub for connect_succeeded */
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct pubkey *id UNNEEDED)
void connect_succeeded(struct lightningd *ld UNNEEDED, const struct node_id *id UNNEEDED)
{ fprintf(stderr, "connect_succeeded called!\n"); abort(); }
/* Generated stub for delay_then_reconnect */
void delay_then_reconnect(struct channel *channel UNNEEDED, u32 seconds_delay UNNEEDED,
@@ -80,7 +80,7 @@ void fatal(const char *fmt UNNEEDED, ...)
bool fromwire_channel_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNEEDED)
{ fprintf(stderr, "fromwire_channel_dev_memleak_reply called!\n"); abort(); }
/* Generated stub for fromwire_connect_peer_connected */
bool fromwire_connect_peer_connected(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct pubkey *id UNNEEDED, struct wireaddr_internal *addr UNNEEDED, struct crypto_state *crypto_state UNNEEDED, u8 **globalfeatures UNNEEDED, u8 **localfeatures UNNEEDED)
bool fromwire_connect_peer_connected(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct node_id *id UNNEEDED, struct wireaddr_internal *addr UNNEEDED, struct crypto_state *crypto_state UNNEEDED, u8 **globalfeatures UNNEEDED, u8 **localfeatures UNNEEDED)
{ fprintf(stderr, "fromwire_connect_peer_connected called!\n"); abort(); }
/* Generated stub for fromwire_gossip_get_incoming_channels_reply */
bool fromwire_gossip_get_incoming_channels_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct route_info **route_info UNNEEDED)
@@ -160,15 +160,15 @@ void json_add_log(struct json_stream *result UNNEEDED,
void json_add_member(struct json_stream *js UNNEEDED, const char *fieldname UNNEEDED,
const char *fmt UNNEEDED, ...)
{ fprintf(stderr, "json_add_member called!\n"); abort(); }
/* Generated stub for json_add_node_id */
void json_add_node_id(struct json_stream *response UNNEEDED,
const char *fieldname UNNEEDED,
const struct node_id *id UNNEEDED)
{ fprintf(stderr, "json_add_node_id called!\n"); abort(); }
/* Generated stub for json_add_num */
void json_add_num(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
unsigned int value UNNEEDED)
{ fprintf(stderr, "json_add_num called!\n"); abort(); }
/* Generated stub for json_add_pubkey */
void json_add_pubkey(struct json_stream *response UNNEEDED,
const char *fieldname UNNEEDED,
const struct pubkey *key UNNEEDED)
{ fprintf(stderr, "json_add_pubkey called!\n"); abort(); }
/* Generated stub for json_add_short_channel_id */
void json_add_short_channel_id(struct json_stream *response UNNEEDED,
const char *fieldname UNNEEDED,
@@ -219,10 +219,10 @@ enum address_parse_result json_tok_address_scriptpubkey(const tal_t *ctx UNNEEDE
bool json_tok_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct channel_id *cid UNNEEDED)
{ fprintf(stderr, "json_tok_channel_id called!\n"); abort(); }
/* Generated stub for json_to_pubkey */
bool json_to_pubkey(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct pubkey *pubkey UNNEEDED)
{ fprintf(stderr, "json_to_pubkey called!\n"); abort(); }
/* Generated stub for json_to_node_id */
bool json_to_node_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct node_id *id UNNEEDED)
{ fprintf(stderr, "json_to_node_id called!\n"); abort(); }
/* Generated stub for json_to_short_channel_id */
bool json_to_short_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct short_channel_id *scid UNNEEDED,
@@ -260,12 +260,18 @@ struct oneshot *new_reltimer_(struct timers *timers UNNEEDED,
struct timerel expire UNNEEDED,
void (*cb)(void *) UNNEEDED, void *arg UNNEEDED)
{ fprintf(stderr, "new_reltimer_ called!\n"); abort(); }
/* Generated stub for node_id_cmp */
int node_id_cmp(const struct node_id *a UNNEEDED, const struct node_id *b UNNEEDED)
{ fprintf(stderr, "node_id_cmp called!\n"); abort(); }
/* Generated stub for node_id_to_hexstr */
char *node_id_to_hexstr(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED)
{ fprintf(stderr, "node_id_to_hexstr called!\n"); abort(); }
/* Generated stub for notify_connect */
void notify_connect(struct lightningd *ld UNNEEDED, struct pubkey *nodeid UNNEEDED,
void notify_connect(struct lightningd *ld UNNEEDED, struct node_id *nodeid UNNEEDED,
struct wireaddr_internal *addr UNNEEDED)
{ fprintf(stderr, "notify_connect called!\n"); abort(); }
/* Generated stub for notify_disconnect */
void notify_disconnect(struct lightningd *ld UNNEEDED, struct pubkey *nodeid UNNEEDED)
void notify_disconnect(struct lightningd *ld UNNEEDED, struct node_id *nodeid UNNEEDED)
{ fprintf(stderr, "notify_disconnect called!\n"); abort(); }
/* Generated stub for null_response */
struct json_stream *null_response(struct command *cmd UNNEEDED)
@@ -316,16 +322,18 @@ struct command_result *param_msat(struct command *cmd UNNEEDED, const char *name
const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct amount_msat **msat UNNEEDED)
{ fprintf(stderr, "param_msat called!\n"); abort(); }
/* Generated stub for param_node_id */
struct command_result *param_node_id(struct command *cmd UNNEEDED,
const char *name UNNEEDED,
const char *buffer UNNEEDED,
const jsmntok_t *tok UNNEEDED,
struct node_id **id UNNEEDED)
{ fprintf(stderr, "param_node_id called!\n"); abort(); }
/* Generated stub for param_number */
struct command_result *param_number(struct command *cmd UNNEEDED, const char *name UNNEEDED,
const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
unsigned int **num UNNEEDED)
{ fprintf(stderr, "param_number called!\n"); abort(); }
/* Generated stub for param_pubkey */
struct command_result *param_pubkey(struct command *cmd UNNEEDED, const char *name UNNEEDED,
const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct pubkey **pubkey UNNEEDED)
{ fprintf(stderr, "param_pubkey called!\n"); abort(); }
/* Generated stub for param_short_channel_id */
struct command_result *param_short_channel_id(struct command *cmd UNNEEDED,
const char *name UNNEEDED,
@@ -413,10 +421,10 @@ u8 *towire_channel_send_shutdown(const tal_t *ctx UNNEEDED)
u8 *towire_channel_specific_feerates(const tal_t *ctx UNNEEDED, u32 feerate_base UNNEEDED, u32 feerate_ppm UNNEEDED)
{ fprintf(stderr, "towire_channel_specific_feerates called!\n"); abort(); }
/* Generated stub for towire_connectctl_connect_to_peer */
u8 *towire_connectctl_connect_to_peer(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED, u32 seconds_waited UNNEEDED, const struct wireaddr_internal *addrhint UNNEEDED)
u8 *towire_connectctl_connect_to_peer(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED, u32 seconds_waited UNNEEDED, const struct wireaddr_internal *addrhint UNNEEDED)
{ fprintf(stderr, "towire_connectctl_connect_to_peer called!\n"); abort(); }
/* Generated stub for towire_connectctl_peer_disconnected */
u8 *towire_connectctl_peer_disconnected(const tal_t *ctx UNNEEDED, const struct pubkey *id UNNEEDED)
u8 *towire_connectctl_peer_disconnected(const tal_t *ctx UNNEEDED, const struct node_id *id UNNEEDED)
{ fprintf(stderr, "towire_connectctl_peer_disconnected called!\n"); abort(); }
/* Generated stub for towire_errorfmt */
u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
@@ -427,10 +435,10 @@ u8 *towire_errorfmt(const tal_t *ctx UNNEEDED,
u8 *towire_gossip_get_incoming_channels(const tal_t *ctx UNNEEDED, const bool *private_too UNNEEDED)
{ fprintf(stderr, "towire_gossip_get_incoming_channels called!\n"); abort(); }
/* Generated stub for towire_hsm_get_channel_basepoints */
u8 *towire_hsm_get_channel_basepoints(const tal_t *ctx UNNEEDED, const struct pubkey *peerid UNNEEDED, u64 dbid UNNEEDED)
u8 *towire_hsm_get_channel_basepoints(const tal_t *ctx UNNEEDED, const struct node_id *peerid UNNEEDED, u64 dbid UNNEEDED)
{ fprintf(stderr, "towire_hsm_get_channel_basepoints called!\n"); abort(); }
/* Generated stub for towire_hsm_sign_commitment_tx */
u8 *towire_hsm_sign_commitment_tx(const tal_t *ctx UNNEEDED, const struct pubkey *peer_id UNNEEDED, u64 channel_dbid UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const struct pubkey *remote_funding_key UNNEEDED, struct amount_sat funding_amount UNNEEDED)
u8 *towire_hsm_sign_commitment_tx(const tal_t *ctx UNNEEDED, const struct node_id *peer_id UNNEEDED, u64 channel_dbid UNNEEDED, const struct bitcoin_tx *tx UNNEEDED, const struct pubkey *remote_funding_key UNNEEDED, struct amount_sat funding_amount UNNEEDED)
{ fprintf(stderr, "towire_hsm_sign_commitment_tx called!\n"); abort(); }
/* Generated stub for towire_hsm_sign_invoice */
u8 *towire_hsm_sign_invoice(const tal_t *ctx UNNEEDED, const u8 *u5bytes UNNEEDED, const u8 *hrp UNNEEDED)
@@ -597,13 +605,14 @@ static void add_peer(struct lightningd *ld, int n, enum channel_state state,
list_add_tail(&peer->channels, &c->list);
}
/* There *is* padding in this structure, at the end. */
STRUCTEQ_DEF(route_info, ALIGNOF(struct route_info) - sizeof(u16),
/* There *is* padding in this structure, after pubkey and after cltv_expiry_delta. */
STRUCTEQ_DEF(route_info,
ALIGNOF(struct short_channel_id) - 1 - sizeof(u16),
pubkey,
cltv_expiry_delta,
short_channel_id,
fee_base_msat,
fee_proportional_millionths,
cltv_expiry_delta);
fee_proportional_millionths);
int main(void)
{