mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
gossipd / plugin: clean up names in struct route_hop.
We're going to unify them, but the names are not the normal ones. Fix that first. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -2738,8 +2738,8 @@ struct route_hop **get_route(const tal_t *ctx, struct routing_state *rstate,
|
|||||||
int idx = half_chan_to(n, route[i]);
|
int idx = half_chan_to(n, route[i]);
|
||||||
c = &route[i]->half[idx];
|
c = &route[i]->half[idx];
|
||||||
hops[i] = tal(hops, struct route_hop);
|
hops[i] = tal(hops, struct route_hop);
|
||||||
hops[i]->channel_id = route[i]->scid;
|
hops[i]->scid = route[i]->scid;
|
||||||
hops[i]->nodeid = n->id;
|
hops[i]->node_id = n->id;
|
||||||
hops[i]->amount = total_amount;
|
hops[i]->amount = total_amount;
|
||||||
hops[i]->delay = total_delay;
|
hops[i]->delay = total_delay;
|
||||||
hops[i]->direction = idx;
|
hops[i]->direction = idx;
|
||||||
|
|||||||
@@ -324,9 +324,9 @@ get_channel(const struct routing_state *rstate,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct route_hop {
|
struct route_hop {
|
||||||
struct short_channel_id channel_id;
|
struct short_channel_id scid;
|
||||||
int direction;
|
int direction;
|
||||||
struct node_id nodeid;
|
struct node_id node_id;
|
||||||
struct amount_msat amount;
|
struct amount_msat amount;
|
||||||
u32 delay;
|
u32 delay;
|
||||||
struct pubkey *blinding;
|
struct pubkey *blinding;
|
||||||
|
|||||||
@@ -329,9 +329,8 @@ static void json_add_route_hop(struct json_stream *r, char const *n,
|
|||||||
{
|
{
|
||||||
/* Imitate what getroute/sendpay use */
|
/* Imitate what getroute/sendpay use */
|
||||||
json_object_start(r, n);
|
json_object_start(r, n);
|
||||||
json_add_node_id(r, "id", &h->nodeid);
|
json_add_node_id(r, "id", &h->node_id);
|
||||||
json_add_short_channel_id(r, "channel",
|
json_add_short_channel_id(r, "channel", &h->scid);
|
||||||
&h->channel_id);
|
|
||||||
json_add_num(r, "direction", h->direction);
|
json_add_num(r, "direction", h->direction);
|
||||||
json_add_amount_msat_compat(r, h->amount, "msatoshi", "amount_msat");
|
json_add_amount_msat_compat(r, h->amount, "msatoshi", "amount_msat");
|
||||||
json_add_num(r, "delay", h->delay);
|
json_add_num(r, "delay", h->delay);
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ struct route_hop *fromwire_route_hop(const tal_t *ctx,
|
|||||||
struct route_hop *entry = tal(ctx, struct route_hop);
|
struct route_hop *entry = tal(ctx, struct route_hop);
|
||||||
size_t enclen;
|
size_t enclen;
|
||||||
|
|
||||||
fromwire_node_id(pptr, max, &entry->nodeid);
|
fromwire_node_id(pptr, max, &entry->node_id);
|
||||||
fromwire_short_channel_id(pptr, max, &entry->channel_id);
|
fromwire_short_channel_id(pptr, max, &entry->scid);
|
||||||
entry->direction = fromwire_u8(pptr, max);
|
entry->direction = fromwire_u8(pptr, max);
|
||||||
entry->amount = fromwire_amount_msat(pptr, max);
|
entry->amount = fromwire_amount_msat(pptr, max);
|
||||||
entry->delay = fromwire_u32(pptr, max);
|
entry->delay = fromwire_u32(pptr, max);
|
||||||
@@ -82,8 +82,8 @@ struct route_hop *fromwire_route_hop(const tal_t *ctx,
|
|||||||
|
|
||||||
void towire_route_hop(u8 **pptr, const struct route_hop *entry)
|
void towire_route_hop(u8 **pptr, const struct route_hop *entry)
|
||||||
{
|
{
|
||||||
towire_node_id(pptr, &entry->nodeid);
|
towire_node_id(pptr, &entry->node_id);
|
||||||
towire_short_channel_id(pptr, &entry->channel_id);
|
towire_short_channel_id(pptr, &entry->scid);
|
||||||
towire_u8(pptr, entry->direction);
|
towire_u8(pptr, entry->direction);
|
||||||
towire_amount_msat(pptr, entry->amount);
|
towire_amount_msat(pptr, entry->amount);
|
||||||
towire_u32(pptr, entry->delay);
|
towire_u32(pptr, entry->delay);
|
||||||
|
|||||||
@@ -999,7 +999,7 @@ send_payment_core(struct lightningd *ld,
|
|||||||
if (offer_err)
|
if (offer_err)
|
||||||
return offer_err;
|
return offer_err;
|
||||||
|
|
||||||
channel = active_channel_by_id(ld, &first_hop->nodeid, NULL);
|
channel = active_channel_by_id(ld, &first_hop->node_id, NULL);
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
struct json_stream *data
|
struct json_stream *data
|
||||||
= json_stream_fail(cmd, PAY_TRY_OTHER_ROUTE,
|
= json_stream_fail(cmd, PAY_TRY_OTHER_ROUTE,
|
||||||
@@ -1007,8 +1007,9 @@ send_payment_core(struct lightningd *ld,
|
|||||||
"peer found");
|
"peer found");
|
||||||
|
|
||||||
json_add_routefail_info(data, 0, WIRE_UNKNOWN_NEXT_PEER,
|
json_add_routefail_info(data, 0, WIRE_UNKNOWN_NEXT_PEER,
|
||||||
&ld->id, &first_hop->channel_id,
|
&ld->id, &first_hop->scid,
|
||||||
node_id_idx(&ld->id, &first_hop->nodeid),
|
node_id_idx(&ld->id,
|
||||||
|
&first_hop->node_id),
|
||||||
NULL);
|
NULL);
|
||||||
json_object_end(data);
|
json_object_end(data);
|
||||||
return command_failed(cmd, data);
|
return command_failed(cmd, data);
|
||||||
@@ -1020,7 +1021,7 @@ send_payment_core(struct lightningd *ld,
|
|||||||
if (failmsg) {
|
if (failmsg) {
|
||||||
fail = immediate_routing_failure(cmd, ld,
|
fail = immediate_routing_failure(cmd, ld,
|
||||||
fromwire_peektype(failmsg),
|
fromwire_peektype(failmsg),
|
||||||
&first_hop->channel_id,
|
&first_hop->scid,
|
||||||
&channel->peer->id);
|
&channel->peer->id);
|
||||||
|
|
||||||
return sendpay_fail(
|
return sendpay_fail(
|
||||||
@@ -1115,7 +1116,7 @@ send_payment(struct lightningd *ld,
|
|||||||
path = sphinx_path_new(tmpctx, rhash->u.u8);
|
path = sphinx_path_new(tmpctx, rhash->u.u8);
|
||||||
/* Extract IDs for each hop: create_onionpacket wants array. */
|
/* Extract IDs for each hop: create_onionpacket wants array. */
|
||||||
for (i = 0; i < n_hops; i++)
|
for (i = 0; i < n_hops; i++)
|
||||||
ids[i] = route[i].nodeid;
|
ids[i] = route[i].node_id;
|
||||||
|
|
||||||
/* Create sphinx path */
|
/* Create sphinx path */
|
||||||
for (i = 0; i < n_hops - 1; i++) {
|
for (i = 0; i < n_hops - 1; i++) {
|
||||||
@@ -1125,7 +1126,7 @@ send_payment(struct lightningd *ld,
|
|||||||
sphinx_add_hop(path, &pubkey,
|
sphinx_add_hop(path, &pubkey,
|
||||||
take(onion_nonfinal_hop(NULL,
|
take(onion_nonfinal_hop(NULL,
|
||||||
should_use_tlv(route[i].style),
|
should_use_tlv(route[i].style),
|
||||||
&route[i + 1].channel_id,
|
&route[i + 1].scid,
|
||||||
route[i + 1].amount,
|
route[i + 1].amount,
|
||||||
base_expiry + route[i + 1].delay,
|
base_expiry + route[i + 1].delay,
|
||||||
route[i].blinding,
|
route[i].blinding,
|
||||||
@@ -1170,7 +1171,7 @@ send_payment(struct lightningd *ld,
|
|||||||
/* Copy channels used along the route. */
|
/* Copy channels used along the route. */
|
||||||
channels = tal_arr(tmpctx, struct short_channel_id, n_hops);
|
channels = tal_arr(tmpctx, struct short_channel_id, n_hops);
|
||||||
for (i = 0; i < n_hops; ++i)
|
for (i = 0; i < n_hops; ++i)
|
||||||
channels[i] = route[i].channel_id;
|
channels[i] = route[i].scid;
|
||||||
|
|
||||||
log_info(ld->log, "Sending %s over %zu hops to deliver %s",
|
log_info(ld->log, "Sending %s over %zu hops to deliver %s",
|
||||||
type_to_string(tmpctx, struct amount_msat, &route[0].amount),
|
type_to_string(tmpctx, struct amount_msat, &route[0].amount),
|
||||||
@@ -1218,15 +1219,15 @@ param_route_hop(struct command *cmd, const char *name, const char *buffer,
|
|||||||
/* Parsing of actual values including sanity check for all parsed
|
/* Parsing of actual values including sanity check for all parsed
|
||||||
* values. */
|
* values. */
|
||||||
if (!idtok) {
|
if (!idtok) {
|
||||||
memset(&res->nodeid, 0, sizeof(struct node_id));
|
memset(&res->node_id, 0, sizeof(struct node_id));
|
||||||
} else if (!json_to_node_id(buffer, idtok, &res->nodeid)) {
|
} else if (!json_to_node_id(buffer, idtok, &res->node_id)) {
|
||||||
return command_fail_badparam(cmd, name, buffer, idtok,
|
return command_fail_badparam(cmd, name, buffer, idtok,
|
||||||
"should be a node_id");
|
"should be a node_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!channeltok) {
|
if (!channeltok) {
|
||||||
memset(&res->channel_id, 0, sizeof(struct short_channel_id));
|
memset(&res->scid, 0, sizeof(struct short_channel_id));
|
||||||
} else if (!json_to_short_channel_id(buffer, channeltok, &res->channel_id)) {
|
} else if (!json_to_short_channel_id(buffer, channeltok, &res->scid)) {
|
||||||
return command_fail_badparam(cmd, name, buffer, channeltok,
|
return command_fail_badparam(cmd, name, buffer, channeltok,
|
||||||
"should be a short_channel_id");
|
"should be a short_channel_id");
|
||||||
}
|
}
|
||||||
@@ -1394,9 +1395,9 @@ static struct command_result *param_route_hops(struct command *cmd,
|
|||||||
default_style = ROUTE_HOP_LEGACY;
|
default_style = ROUTE_HOP_LEGACY;
|
||||||
|
|
||||||
(*hops)[i].amount = *msat;
|
(*hops)[i].amount = *msat;
|
||||||
(*hops)[i].nodeid = *id;
|
(*hops)[i].node_id = *id;
|
||||||
(*hops)[i].delay = *delay;
|
(*hops)[i].delay = *delay;
|
||||||
(*hops)[i].channel_id = *channel;
|
(*hops)[i].scid = *channel;
|
||||||
(*hops)[i].blinding = blinding;
|
(*hops)[i].blinding = blinding;
|
||||||
(*hops)[i].enctlv = enctlv;
|
(*hops)[i].enctlv = enctlv;
|
||||||
(*hops)[i].style = style ? *style : default_style;
|
(*hops)[i].style = style ? *style : default_style;
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ static void payment_exclude_most_expensive(struct payment *p)
|
|||||||
worst = fee;
|
worst = fee;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
channel_hints_update(p, e->channel_id, e->direction, false, false,
|
channel_hints_update(p, e->scid, e->direction, false, false,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ static void payment_exclude_longest_delay(struct payment *p)
|
|||||||
worst = delay;
|
worst = delay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
channel_hints_update(p, e->channel_id, e->direction, false, false,
|
channel_hints_update(p, e->scid, e->direction, false, false,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,7 +457,7 @@ static struct channel_hint *payment_chanhints_get(struct payment *p,
|
|||||||
struct channel_hint *curhint;
|
struct channel_hint *curhint;
|
||||||
for (size_t j = 0; j < tal_count(root->channel_hints); j++) {
|
for (size_t j = 0; j < tal_count(root->channel_hints); j++) {
|
||||||
curhint = &root->channel_hints[j];
|
curhint = &root->channel_hints[j];
|
||||||
if (short_channel_id_eq(&curhint->scid.scid, &h->channel_id) &&
|
if (short_channel_id_eq(&curhint->scid.scid, &h->scid) &&
|
||||||
curhint->scid.dir == h->direction) {
|
curhint->scid.dir == h->direction) {
|
||||||
return curhint;
|
return curhint;
|
||||||
}
|
}
|
||||||
@@ -700,13 +700,13 @@ static struct route_hop *route_hops_from_route(const tal_t *ctx,
|
|||||||
for (size_t i = 0; i < tal_count(hops); i++) {
|
for (size_t i = 0; i < tal_count(hops); i++) {
|
||||||
const struct gossmap_node *dst;
|
const struct gossmap_node *dst;
|
||||||
|
|
||||||
hops[i].channel_id = gossmap_chan_scid(gossmap, r[i]->c);
|
hops[i].scid = gossmap_chan_scid(gossmap, r[i]->c);
|
||||||
hops[i].direction = r[i]->dir;
|
hops[i].direction = r[i]->dir;
|
||||||
hops[i].blinding = NULL;
|
hops[i].blinding = NULL;
|
||||||
|
|
||||||
/* nodeid is nodeid of *dst* */
|
/* nodeid is nodeid of *dst* */
|
||||||
dst = gossmap_nth_node(gossmap, r[i]->c, !r[i]->dir);
|
dst = gossmap_nth_node(gossmap, r[i]->c, !r[i]->dir);
|
||||||
gossmap_node_get_id(gossmap, dst, &hops[i].nodeid);
|
gossmap_node_get_id(gossmap, dst, &hops[i].node_id);
|
||||||
if (gossmap_node_get_feature(gossmap, dst, OPT_VAR_ONION) != -1)
|
if (gossmap_node_get_feature(gossmap, dst, OPT_VAR_ONION) != -1)
|
||||||
hops[i].style = ROUTE_HOP_TLV;
|
hops[i].style = ROUTE_HOP_TLV;
|
||||||
else
|
else
|
||||||
@@ -1038,7 +1038,7 @@ static void payment_result_infer(struct route_hop *route,
|
|||||||
assert(i <= len);
|
assert(i <= len);
|
||||||
|
|
||||||
if (r->erring_node == NULL)
|
if (r->erring_node == NULL)
|
||||||
r->erring_node = &route[i-1].nodeid;
|
r->erring_node = &route[i-1].node_id;
|
||||||
|
|
||||||
/* The above assert was enough for the erring_node, but might be off
|
/* The above assert was enough for the erring_node, but might be off
|
||||||
* by one on channel and direction, in case the destination failed on
|
* by one on channel and direction, in case the destination failed on
|
||||||
@@ -1047,7 +1047,7 @@ static void payment_result_infer(struct route_hop *route,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (r->erring_channel == NULL)
|
if (r->erring_channel == NULL)
|
||||||
r->erring_channel = &route[i].channel_id;
|
r->erring_channel = &route[i].scid;
|
||||||
|
|
||||||
if (r->erring_direction == NULL)
|
if (r->erring_direction == NULL)
|
||||||
r->erring_direction = &route[i].direction;
|
r->erring_direction = &route[i].direction;
|
||||||
@@ -1059,7 +1059,7 @@ static void report_tampering(struct payment *p,
|
|||||||
size_t report_pos,
|
size_t report_pos,
|
||||||
const char *style)
|
const char *style)
|
||||||
{
|
{
|
||||||
const struct node_id *id = &p->route[report_pos].nodeid;
|
const struct node_id *id = &p->route[report_pos].node_id;
|
||||||
|
|
||||||
if (report_pos == 0) {
|
if (report_pos == 0) {
|
||||||
paymod_log(p, LOG_UNUSUAL,
|
paymod_log(p, LOG_UNUSUAL,
|
||||||
@@ -1074,7 +1074,7 @@ static void report_tampering(struct payment *p,
|
|||||||
type_to_string(tmpctx, struct node_id, id),
|
type_to_string(tmpctx, struct node_id, id),
|
||||||
report_pos,
|
report_pos,
|
||||||
type_to_string(tmpctx, struct node_id,
|
type_to_string(tmpctx, struct node_id,
|
||||||
&p->route[report_pos-1].nodeid),
|
&p->route[report_pos-1].node_id),
|
||||||
style);
|
style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1251,7 +1251,7 @@ handle_intermediate_failure(struct command *cmd,
|
|||||||
type_to_string(tmpctx, struct node_id, errnode),
|
type_to_string(tmpctx, struct node_id, errnode),
|
||||||
failcode, onion_wire_name(failcode),
|
failcode, onion_wire_name(failcode),
|
||||||
type_to_string(tmpctx, struct short_channel_id,
|
type_to_string(tmpctx, struct short_channel_id,
|
||||||
&errchan->channel_id),
|
&errchan->scid),
|
||||||
p->routetxt);
|
p->routetxt);
|
||||||
|
|
||||||
/* We use an exhaustive switch statement here so you get a compile
|
/* We use an exhaustive switch statement here so you get a compile
|
||||||
@@ -1279,7 +1279,7 @@ handle_intermediate_failure(struct command *cmd,
|
|||||||
case WIRE_UNKNOWN_NEXT_PEER:
|
case WIRE_UNKNOWN_NEXT_PEER:
|
||||||
case WIRE_REQUIRED_CHANNEL_FEATURE_MISSING:
|
case WIRE_REQUIRED_CHANNEL_FEATURE_MISSING:
|
||||||
/* All of these result in the channel being marked as disabled. */
|
/* All of these result in the channel being marked as disabled. */
|
||||||
channel_hints_update(root, errchan->channel_id,
|
channel_hints_update(root, errchan->scid,
|
||||||
errchan->direction, false, false, NULL,
|
errchan->direction, false, false, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
@@ -1287,7 +1287,7 @@ handle_intermediate_failure(struct command *cmd,
|
|||||||
case WIRE_TEMPORARY_CHANNEL_FAILURE: {
|
case WIRE_TEMPORARY_CHANNEL_FAILURE: {
|
||||||
/* These are an indication that the capacity was insufficient,
|
/* These are an indication that the capacity was insufficient,
|
||||||
* remember the amount we tried as an estimate. */
|
* remember the amount we tried as an estimate. */
|
||||||
channel_hints_update(root, errchan->channel_id,
|
channel_hints_update(root, errchan->scid,
|
||||||
errchan->direction, true, false,
|
errchan->direction, true, false,
|
||||||
&errchan->amount, NULL);
|
&errchan->amount, NULL);
|
||||||
goto error;
|
goto error;
|
||||||
@@ -1358,7 +1358,7 @@ static bool assign_blame(const struct payment *p,
|
|||||||
/* Final node *shouldn't* report BADONION, but don't assume. */
|
/* Final node *shouldn't* report BADONION, but don't assume. */
|
||||||
if (index >= tal_count(p->route)) {
|
if (index >= tal_count(p->route)) {
|
||||||
*errchan = NULL;
|
*errchan = NULL;
|
||||||
*errnode = &p->route[tal_count(p->route) - 1].nodeid;
|
*errnode = &p->route[tal_count(p->route) - 1].node_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1366,7 +1366,7 @@ static bool assign_blame(const struct payment *p,
|
|||||||
if (index == 0)
|
if (index == 0)
|
||||||
*errnode = p->local_id;
|
*errnode = p->local_id;
|
||||||
else
|
else
|
||||||
*errnode = &p->route[index - 1].nodeid;
|
*errnode = &p->route[index - 1].node_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1547,11 +1547,11 @@ static struct command_result *payment_createonion_success(struct command *cmd,
|
|||||||
json_add_hex_talarr(req->js, "onion", p->createonion_response->onion);
|
json_add_hex_talarr(req->js, "onion", p->createonion_response->onion);
|
||||||
|
|
||||||
json_object_start(req->js, "first_hop");
|
json_object_start(req->js, "first_hop");
|
||||||
json_add_short_channel_id(req->js, "channel", &first->channel_id);
|
json_add_short_channel_id(req->js, "channel", &first->scid);
|
||||||
json_add_num(req->js, "direction", first->direction);
|
json_add_num(req->js, "direction", first->direction);
|
||||||
json_add_amount_msat_only(req->js, "amount_msat", first->amount);
|
json_add_amount_msat_only(req->js, "amount_msat", first->amount);
|
||||||
json_add_num(req->js, "delay", first->delay);
|
json_add_num(req->js, "delay", first->delay);
|
||||||
json_add_node_id(req->js, "id", &first->nodeid);
|
json_add_node_id(req->js, "id", &first->node_id);
|
||||||
json_object_end(req->js);
|
json_object_end(req->js);
|
||||||
|
|
||||||
json_add_sha256(req->js, "payment_hash", p->payment_hash);
|
json_add_sha256(req->js, "payment_hash", p->payment_hash);
|
||||||
@@ -1616,7 +1616,7 @@ static void payment_add_hop_onion_payload(struct payment *p,
|
|||||||
dst->style = node->style;
|
dst->style = node->style;
|
||||||
if (force_tlv)
|
if (force_tlv)
|
||||||
dst->style = ROUTE_HOP_TLV;
|
dst->style = ROUTE_HOP_TLV;
|
||||||
dst->pubkey = node->nodeid;
|
dst->pubkey = node->node_id;
|
||||||
|
|
||||||
switch (dst->style) {
|
switch (dst->style) {
|
||||||
case ROUTE_HOP_LEGACY:
|
case ROUTE_HOP_LEGACY:
|
||||||
@@ -1624,7 +1624,7 @@ static void payment_add_hop_onion_payload(struct payment *p,
|
|||||||
dst->legacy_payload->forward_amt = next->amount;
|
dst->legacy_payload->forward_amt = next->amount;
|
||||||
|
|
||||||
if (!final)
|
if (!final)
|
||||||
dst->legacy_payload->scid = next->channel_id;
|
dst->legacy_payload->scid = next->scid;
|
||||||
else
|
else
|
||||||
dst->legacy_payload->scid = all_zero_scid;
|
dst->legacy_payload->scid = all_zero_scid;
|
||||||
|
|
||||||
@@ -1641,7 +1641,7 @@ static void payment_add_hop_onion_payload(struct payment *p,
|
|||||||
if (!final)
|
if (!final)
|
||||||
tlvstream_set_short_channel_id(fields,
|
tlvstream_set_short_channel_id(fields,
|
||||||
TLV_TLV_PAYLOAD_SHORT_CHANNEL_ID,
|
TLV_TLV_PAYLOAD_SHORT_CHANNEL_ID,
|
||||||
&next->channel_id);
|
&next->scid);
|
||||||
|
|
||||||
if (payment_secret != NULL) {
|
if (payment_secret != NULL) {
|
||||||
assert(final);
|
assert(final);
|
||||||
@@ -1692,7 +1692,7 @@ static void payment_compute_onion_payloads(struct payment *p)
|
|||||||
NULL);
|
NULL);
|
||||||
tal_append_fmt(&routetxt, "%s -> ",
|
tal_append_fmt(&routetxt, "%s -> ",
|
||||||
type_to_string(tmpctx, struct short_channel_id,
|
type_to_string(tmpctx, struct short_channel_id,
|
||||||
&p->route[i].channel_id));
|
&p->route[i].scid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Final hop */
|
/* Final hop */
|
||||||
@@ -1702,7 +1702,7 @@ static void payment_compute_onion_payloads(struct payment *p)
|
|||||||
root->payment_secret);
|
root->payment_secret);
|
||||||
tal_append_fmt(&routetxt, "%s",
|
tal_append_fmt(&routetxt, "%s",
|
||||||
type_to_string(tmpctx, struct short_channel_id,
|
type_to_string(tmpctx, struct short_channel_id,
|
||||||
&p->route[hopcount - 1].channel_id));
|
&p->route[hopcount - 1].scid));
|
||||||
|
|
||||||
paymod_log(p, LOG_DBG,
|
paymod_log(p, LOG_DBG,
|
||||||
"Created outgoing onion for route: %s", routetxt);
|
"Created outgoing onion for route: %s", routetxt);
|
||||||
@@ -2784,9 +2784,9 @@ static void routehint_step_cb(struct routehints_data *d, struct payment *p)
|
|||||||
return payment_continue(p);
|
return payment_continue(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
hop.nodeid = *route_pubkey(p, routehint, i + 1);
|
hop.node_id = *route_pubkey(p, routehint, i + 1);
|
||||||
hop.style = ROUTE_HOP_LEGACY;
|
hop.style = ROUTE_HOP_LEGACY;
|
||||||
hop.channel_id = routehint[i].short_channel_id;
|
hop.scid = routehint[i].short_channel_id;
|
||||||
hop.amount = dest_amount;
|
hop.amount = dest_amount;
|
||||||
hop.delay = route_cltv(d->final_cltv, routehint + i + 1,
|
hop.delay = route_cltv(d->final_cltv, routehint + i + 1,
|
||||||
tal_count(routehint) - i - 1);
|
tal_count(routehint) - i - 1);
|
||||||
@@ -2796,7 +2796,7 @@ static void routehint_step_cb(struct routehints_data *d, struct payment *p)
|
|||||||
* it's rather easy to compute given the two
|
* it's rather easy to compute given the two
|
||||||
* subsequent hops. */
|
* subsequent hops. */
|
||||||
hop.direction =
|
hop.direction =
|
||||||
node_id_cmp(&prev_hop->nodeid, &hop.nodeid) > 0 ? 1
|
node_id_cmp(&prev_hop->node_id, &hop.node_id) > 0 ? 1
|
||||||
: 0;
|
: 0;
|
||||||
tal_arr_expand(&p->route, hop);
|
tal_arr_expand(&p->route, hop);
|
||||||
}
|
}
|
||||||
@@ -3166,9 +3166,9 @@ static void direct_pay_override(struct payment *p) {
|
|||||||
p->route = tal_arr(p, struct route_hop, 1);
|
p->route = tal_arr(p, struct route_hop, 1);
|
||||||
p->route[0].amount = p->amount;
|
p->route[0].amount = p->amount;
|
||||||
p->route[0].delay = p->getroute->cltv;
|
p->route[0].delay = p->getroute->cltv;
|
||||||
p->route[0].channel_id = hint->scid.scid;
|
p->route[0].scid = hint->scid.scid;
|
||||||
p->route[0].direction = hint->scid.dir;
|
p->route[0].direction = hint->scid.dir;
|
||||||
p->route[0].nodeid = *p->destination;
|
p->route[0].node_id = *p->destination;
|
||||||
p->route[0].style = p->destination_has_tlv ? ROUTE_HOP_TLV : ROUTE_HOP_LEGACY;
|
p->route[0].style = p->destination_has_tlv ? ROUTE_HOP_TLV : ROUTE_HOP_LEGACY;
|
||||||
paymod_log(p, LOG_DBG,
|
paymod_log(p, LOG_DBG,
|
||||||
"Found a direct channel (%s) with sufficient "
|
"Found a direct channel (%s) with sufficient "
|
||||||
|
|||||||
@@ -1619,8 +1619,8 @@ static bool json_to_route_hop_inplace(struct route_hop *dst, const char *buffer,
|
|||||||
amounttok == NULL || delaytok == NULL || styletok == NULL)
|
amounttok == NULL || delaytok == NULL || styletok == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
json_to_node_id(buffer, idtok, &dst->nodeid);
|
json_to_node_id(buffer, idtok, &dst->node_id);
|
||||||
json_to_short_channel_id(buffer, channeltok, &dst->channel_id);
|
json_to_short_channel_id(buffer, channeltok, &dst->scid);
|
||||||
json_to_int(buffer, directiontok, &dst->direction);
|
json_to_int(buffer, directiontok, &dst->direction);
|
||||||
json_to_msat(buffer, amounttok, &dst->amount);
|
json_to_msat(buffer, amounttok, &dst->amount);
|
||||||
json_to_number(buffer, delaytok, &dst->delay);
|
json_to_number(buffer, delaytok, &dst->delay);
|
||||||
|
|||||||
@@ -346,9 +346,9 @@ enum route_hop_style {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct route_hop {
|
struct route_hop {
|
||||||
struct short_channel_id channel_id;
|
struct short_channel_id scid;
|
||||||
int direction;
|
int direction;
|
||||||
struct node_id nodeid;
|
struct node_id node_id;
|
||||||
struct amount_msat amount;
|
struct amount_msat amount;
|
||||||
u32 delay;
|
u32 delay;
|
||||||
struct pubkey *blinding;
|
struct pubkey *blinding;
|
||||||
|
|||||||
Reference in New Issue
Block a user