Skip to content

Commit d0fafa0

Browse files
Lagrang3rustyrussell
authored andcommitted
renepay: bugfix: read groupids as u64
Changelog-Fixed: renepay: read groupids as u64 integers. Signed-off-by: Lagrang3 <[email protected]>
1 parent 1820423 commit d0fafa0

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

plugins/renepay/mods.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <plugins/renepay/routetracker.h>
1515
#include <unistd.h>
1616

17-
#define INVALID_ID UINT32_MAX
17+
#define INVALID_ID UINT64_MAX
1818

1919
#define OP_NULL NULL
2020
#define OP_CALL (void *)1
@@ -99,7 +99,7 @@ static struct command_result *payment_rpc_failure(struct command *cmd,
9999
*/
100100

101101
struct success_data {
102-
u32 parts, created_at, groupid;
102+
u64 parts, created_at, groupid;
103103
struct amount_msat deliver_msat, sent_msat;
104104
struct preimage preimage;
105105
};
@@ -122,7 +122,7 @@ static bool success_data_from_listsendpays(const char *buf,
122122

123123
json_for_each_arr(i, t, arr)
124124
{
125-
u32 groupid;
125+
u64 groupid;
126126
struct amount_msat this_msat, this_sent;
127127

128128
const jsmntok_t *status_tok = json_get_member(buf, t, "status");
@@ -150,10 +150,10 @@ static bool success_data_from_listsendpays(const char *buf,
150150
",amount_sent_msat:%"
151151
",created_at:%"
152152
",payment_preimage:%}",
153-
JSON_SCAN(json_to_u32, &groupid),
153+
JSON_SCAN(json_to_u64, &groupid),
154154
JSON_SCAN(json_to_msat, &this_msat),
155155
JSON_SCAN(json_to_msat, &this_sent),
156-
JSON_SCAN(json_to_u32, &success->created_at),
156+
JSON_SCAN(json_to_u64, &success->created_at),
157157
JSON_SCAN(json_to_preimage, &success->preimage));
158158

159159
if (err)
@@ -920,12 +920,12 @@ static struct command_result *pendingsendpays_done(struct command *cmd,
920920
size_t i;
921921
const char *err;
922922
const jsmntok_t *t, *arr;
923-
u32 max_group_id = 0;
923+
u64 max_group_id = 0;
924924

925925
/* Data for pending payments, this will be the one
926926
* who's result gets replayed if we end up suspending. */
927-
u32 pending_group_id = INVALID_ID;
928-
u32 max_pending_partid = 0;
927+
u64 pending_group_id = INVALID_ID;
928+
u64 max_pending_partid = 0;
929929
struct amount_msat pending_sent = AMOUNT_MSAT(0),
930930
pending_msat = AMOUNT_MSAT(0);
931931

@@ -957,14 +957,14 @@ static struct command_result *pendingsendpays_done(struct command *cmd,
957957
// find if there is one pending group
958958
json_for_each_arr(i, t, arr)
959959
{
960-
u32 groupid;
960+
u64 groupid;
961961
const char *status;
962962

963963
err = json_scan(tmpctx, buf, t,
964964
"{status:%"
965965
",groupid:%}",
966966
JSON_SCAN_TAL(tmpctx, json_strdup, &status),
967-
JSON_SCAN(json_to_u32, &groupid));
967+
JSON_SCAN(json_to_u64, &groupid));
968968

969969
if (err)
970970
plugin_err(pay_plugin->plugin,
@@ -982,7 +982,7 @@ static struct command_result *pendingsendpays_done(struct command *cmd,
982982
* pending sendpays. */
983983
json_for_each_arr(i, t, arr)
984984
{
985-
u32 partid = 0, groupid;
985+
u64 partid = 0, groupid;
986986
struct amount_msat this_msat, this_sent;
987987
const char *status;
988988

@@ -996,8 +996,8 @@ static struct command_result *pendingsendpays_done(struct command *cmd,
996996
",amount_msat:%"
997997
",amount_sent_msat:%}",
998998
JSON_SCAN_TAL(tmpctx, json_strdup, &status),
999-
JSON_SCAN(json_to_u32, &partid),
1000-
JSON_SCAN(json_to_u32, &groupid),
999+
JSON_SCAN(json_to_u64, &partid),
1000+
JSON_SCAN(json_to_u64, &groupid),
10011001
JSON_SCAN(json_to_msat, &this_msat),
10021002
JSON_SCAN(json_to_msat, &this_sent));
10031003

@@ -1045,9 +1045,9 @@ static struct command_result *pendingsendpays_done(struct command *cmd,
10451045

10461046
plugin_log(pay_plugin->plugin, LOG_DBG,
10471047
"There are pending sendpays to this invoice. "
1048-
"groupid = %" PRIu32 " "
1048+
"groupid = %" PRIu64 " "
10491049
"delivering = %s, "
1050-
"last_partid = %" PRIu32,
1050+
"last_partid = %" PRIu64,
10511051
pending_group_id,
10521052
fmt_amount_msat(tmpctx, payment->total_delivering),
10531053
max_pending_partid);

plugins/renepay/route.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include "config.h"
22
#include <plugins/renepay/route.h>
33

4-
struct route *new_route(const tal_t *ctx, u32 groupid,
5-
u32 partid, struct sha256 payment_hash,
4+
struct route *new_route(const tal_t *ctx, u64 groupid,
5+
u64 partid, struct sha256 payment_hash,
66
struct amount_msat amount,
77
struct amount_msat amount_sent)
88
{
@@ -30,7 +30,7 @@ struct route *new_route(const tal_t *ctx, u32 groupid,
3030
* @gossmap: global gossmap
3131
* @flow: the flow to convert to route */
3232
struct route *flow_to_route(const tal_t *ctx,
33-
u32 groupid, u32 partid, struct sha256 payment_hash,
33+
u64 groupid, u64 partid, struct sha256 payment_hash,
3434
u32 final_cltv, struct gossmap *gossmap,
3535
struct flow *flow)
3636
{
@@ -74,7 +74,7 @@ struct route *flow_to_route(const tal_t *ctx,
7474
}
7575

7676
struct route **flows_to_routes(const tal_t *ctx,
77-
u32 groupid, u32 partid,
77+
u64 groupid, u64 partid,
7878
struct sha256 payment_hash, u32 final_cltv,
7979
struct gossmap *gossmap, struct flow **flows)
8080
{

plugins/renepay/route.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,18 @@ static inline bool routekey_equal(const struct route *route,
109109
HTABLE_DEFINE_NODUPS_TYPE(struct route, route_get_key, routekey_hash, routekey_equal,
110110
route_map);
111111

112-
struct route *new_route(const tal_t *ctx, u32 groupid,
113-
u32 partid, struct sha256 payment_hash,
112+
struct route *new_route(const tal_t *ctx, u64 groupid,
113+
u64 partid, struct sha256 payment_hash,
114114
struct amount_msat amount,
115115
struct amount_msat amount_sent);
116116

117117
struct route *flow_to_route(const tal_t *ctx,
118-
u32 groupid, u32 partid, struct sha256 payment_hash,
118+
u64 groupid, u64 partid, struct sha256 payment_hash,
119119
u32 final_cltv, struct gossmap *gossmap,
120120
struct flow *flow);
121121

122122
struct route **flows_to_routes(const tal_t *ctx,
123-
u32 groupid, u32 partid,
123+
u64 groupid, u64 partid,
124124
struct sha256 payment_hash, u32 final_cltv,
125125
struct gossmap *gossmap, struct flow **flows);
126126

0 commit comments

Comments
 (0)