Skip to content

Commit f0fad43

Browse files
committed
renepay: change of variable name for clarity
Changing route.amount to route.amount_deliver for clarity. This variable hold the value that the route delivers to destination. Changelog-None Signed-off-by: Lagrang3 <[email protected]>
1 parent 99c3653 commit f0fad43

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

plugins/renepay/json.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct route *tal_route_from_json(const tal_t *ctx, const char *buf,
5050
goto fail;
5151
if (!json_to_sha256(buf, hashtok, &route->key.payment_hash))
5252
goto fail;
53-
if (!json_to_msat(buf, amttok, &route->amount))
53+
if (!json_to_msat(buf, amttok, &route->amount_deliver))
5454
goto fail;
5555
if (!json_to_msat(buf, senttok, &route->amount_sent))
5656
goto fail;

plugins/renepay/route.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
struct route *new_route(const tal_t *ctx, u32 groupid,
55
u32 partid, struct sha256 payment_hash,
6-
struct amount_msat amount,
6+
struct amount_msat amount_deliver,
77
struct amount_msat amount_sent)
88
{
99
struct route *route = tal(ctx, struct route);
@@ -17,7 +17,7 @@ struct route *new_route(const tal_t *ctx, u32 groupid,
1717
route->success_prob = 0.0;
1818
route->result = NULL;
1919

20-
route->amount = amount;
20+
route->amount_deliver = amount_deliver;
2121
route->amount_sent = amount_sent;
2222
route->path_num = -1;
2323
return route;
@@ -67,7 +67,7 @@ struct route *flow_to_route(const tal_t *ctx,
6767
goto function_fail;
6868
}
6969
route->success_prob = flow->success_prob;
70-
route->amount = route->hops[pathlen - 1].amount;
70+
route->amount_deliver = route->hops[pathlen - 1].amount;
7171
route->amount_sent = route->hops[0].amount;
7272

7373
if (blinded_destination) {

plugins/renepay/route.h

+5-7
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ struct route {
6060
struct route_hop *hops;
6161

6262
/* amounts are redundant here if we know the hops, however sometimes we
63-
* don't know the hops, eg. by calling listsendpays */
64-
struct amount_msat amount, amount_sent;
63+
* don't know the hops, eg. by calling listsendpays, or if we have
64+
* blinded paths */
65+
struct amount_msat amount_sent;
66+
struct amount_msat amount_deliver;
6567

6668
/* Probability estimate (0-1) */
6769
double success_prob;
@@ -142,11 +144,7 @@ const char *fmt_route_path(const tal_t *ctx, const struct route *route);
142144
static inline struct amount_msat route_delivers(const struct route *route)
143145
{
144146
assert(route);
145-
if (route->hops && tal_count(route->hops) > 0)
146-
assert(amount_msat_eq(
147-
route->amount,
148-
route->hops[tal_count(route->hops) - 1].amount));
149-
return route->amount;
147+
return route->amount_deliver;
150148
}
151149
static inline struct amount_msat route_sends(const struct route *route)
152150
{

plugins/renepay/routebuilder.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ route_check_constraints(struct route *route, struct gossmap *gossmap,
6565
assert(route);
6666
assert(route->hops);
6767
const size_t pathlen = tal_count(route->hops);
68-
if (!amount_msat_eq(route->amount, route->hops[pathlen - 1].amount))
68+
if (!amount_msat_eq(route->amount_deliver,
69+
route->hops[pathlen - 1].amount))
6970
return RENEPAY_PRECONDITION_ERROR;
7071
if (!amount_msat_eq(route->amount_sent, route->hops[0].amount))
7172
return RENEPAY_PRECONDITION_ERROR;

0 commit comments

Comments
 (0)