Skip to content

Commit 6640bc6

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 dfd9e81 commit 6640bc6

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
@@ -15,7 +15,7 @@
1515
#include <unistd.h>
1616
#include <wire/bolt12_wiregen.h>
1717

18-
#define INVALID_ID UINT32_MAX
18+
#define INVALID_ID UINT64_MAX
1919

2020
#define OP_NULL NULL
2121
#define OP_CALL (void *)1
@@ -107,7 +107,7 @@ static void add_hintchan(struct payment *payment, const struct node_id *src,
107107
*/
108108

109109
struct success_data {
110-
u32 parts, created_at, groupid;
110+
u64 parts, created_at, groupid;
111111
struct amount_msat deliver_msat, sent_msat;
112112
struct preimage preimage;
113113
};
@@ -130,7 +130,7 @@ static bool success_data_from_listsendpays(const char *buf,
130130

131131
json_for_each_arr(i, t, arr)
132132
{
133-
u32 groupid;
133+
u64 groupid;
134134
struct amount_msat this_msat, this_sent;
135135

136136
const jsmntok_t *status_tok = json_get_member(buf, t, "status");
@@ -158,10 +158,10 @@ static bool success_data_from_listsendpays(const char *buf,
158158
",amount_sent_msat:%"
159159
",created_at:%"
160160
",payment_preimage:%}",
161-
JSON_SCAN(json_to_u32, &groupid),
161+
JSON_SCAN(json_to_u64, &groupid),
162162
JSON_SCAN(json_to_msat, &this_msat),
163163
JSON_SCAN(json_to_msat, &this_sent),
164-
JSON_SCAN(json_to_u32, &success->created_at),
164+
JSON_SCAN(json_to_u64, &success->created_at),
165165
JSON_SCAN(json_to_preimage, &success->preimage));
166166

167167
if (err)
@@ -941,12 +941,12 @@ static struct command_result *pendingsendpays_done(struct command *cmd,
941941
size_t i;
942942
const char *err;
943943
const jsmntok_t *t, *arr;
944-
u32 max_group_id = 0;
944+
u64 max_group_id = 0;
945945

946946
/* Data for pending payments, this will be the one
947947
* who's result gets replayed if we end up suspending. */
948-
u32 pending_group_id = INVALID_ID;
949-
u32 max_pending_partid = 0;
948+
u64 pending_group_id = INVALID_ID;
949+
u64 max_pending_partid = 0;
950950
struct amount_msat pending_sent = AMOUNT_MSAT(0),
951951
pending_msat = AMOUNT_MSAT(0);
952952

@@ -978,14 +978,14 @@ static struct command_result *pendingsendpays_done(struct command *cmd,
978978
// find if there is one pending group
979979
json_for_each_arr(i, t, arr)
980980
{
981-
u32 groupid;
981+
u64 groupid;
982982
const char *status;
983983

984984
err = json_scan(tmpctx, buf, t,
985985
"{status:%"
986986
",groupid:%}",
987987
JSON_SCAN_TAL(tmpctx, json_strdup, &status),
988-
JSON_SCAN(json_to_u32, &groupid));
988+
JSON_SCAN(json_to_u64, &groupid));
989989

990990
if (err)
991991
plugin_err(pay_plugin->plugin,
@@ -1003,7 +1003,7 @@ static struct command_result *pendingsendpays_done(struct command *cmd,
10031003
* pending sendpays. */
10041004
json_for_each_arr(i, t, arr)
10051005
{
1006-
u32 partid = 0, groupid;
1006+
u64 partid = 0, groupid;
10071007
struct amount_msat this_msat, this_sent;
10081008
const char *status;
10091009

@@ -1017,8 +1017,8 @@ static struct command_result *pendingsendpays_done(struct command *cmd,
10171017
",amount_msat:%"
10181018
",amount_sent_msat:%}",
10191019
JSON_SCAN_TAL(tmpctx, json_strdup, &status),
1020-
JSON_SCAN(json_to_u32, &partid),
1021-
JSON_SCAN(json_to_u32, &groupid),
1020+
JSON_SCAN(json_to_u64, &partid),
1021+
JSON_SCAN(json_to_u64, &groupid),
10221022
JSON_SCAN(json_to_msat, &this_msat),
10231023
JSON_SCAN(json_to_msat, &this_sent));
10241024

@@ -1066,9 +1066,9 @@ static struct command_result *pendingsendpays_done(struct command *cmd,
10661066

10671067
plugin_log(pay_plugin->plugin, LOG_DBG,
10681068
"There are pending sendpays to this invoice. "
1069-
"groupid = %" PRIu32 " "
1069+
"groupid = %" PRIu64 " "
10701070
"delivering = %s, "
1071-
"last_partid = %" PRIu32,
1071+
"last_partid = %" PRIu64,
10721072
pending_group_id,
10731073
fmt_amount_msat(tmpctx, payment->total_delivering),
10741074
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_deliver,
77
struct amount_msat amount_sent)
88
{
@@ -32,7 +32,7 @@ struct route *new_route(const tal_t *ctx, u32 groupid,
3232
* @gossmap: global gossmap
3333
* @flow: the flow to convert to route */
3434
struct route *flow_to_route(const tal_t *ctx,
35-
u32 groupid, u32 partid, struct sha256 payment_hash,
35+
u64 groupid, u64 partid, struct sha256 payment_hash,
3636
u32 final_cltv, struct gossmap *gossmap,
3737
struct flow *flow,
3838
bool blinded_destination)
@@ -83,7 +83,7 @@ struct route *flow_to_route(const tal_t *ctx,
8383
}
8484

8585
struct route **flows_to_routes(const tal_t *ctx,
86-
u32 groupid, u32 partid,
86+
u64 groupid, u64 partid,
8787
struct sha256 payment_hash, u32 final_cltv,
8888
struct gossmap *gossmap, struct flow **flows)
8989
{

plugins/renepay/route.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,19 @@ static inline bool routekey_equal(const struct route *route,
117117
HTABLE_DEFINE_NODUPS_TYPE(struct route, route_get_key, routekey_hash, routekey_equal,
118118
route_map);
119119

120-
struct route *new_route(const tal_t *ctx, u32 groupid,
121-
u32 partid, struct sha256 payment_hash,
120+
struct route *new_route(const tal_t *ctx, u64 groupid,
121+
u64 partid, struct sha256 payment_hash,
122122
struct amount_msat amount,
123123
struct amount_msat amount_sent);
124124

125125
struct route *flow_to_route(const tal_t *ctx,
126-
u32 groupid, u32 partid, struct sha256 payment_hash,
126+
u64 groupid, u64 partid, struct sha256 payment_hash,
127127
u32 final_cltv, struct gossmap *gossmap,
128128
struct flow *flow,
129129
bool blinded_destination);
130130

131131
struct route **flows_to_routes(const tal_t *ctx,
132-
u32 groupid, u32 partid,
132+
u64 groupid, u64 partid,
133133
struct sha256 payment_hash, u32 final_cltv,
134134
struct gossmap *gossmap, struct flow **flows);
135135

0 commit comments

Comments
 (0)