Skip to content

Commit 47babbf

Browse files
Lagrang3ShahanaFarooqui
authored andcommitted
askrene: add LOG_TRACE to every rpc entry point
This could be helpful for debugging the interaction of renepay/xpay with askrene. Changelog-None Signed-off-by: Lagrang3 <[email protected]>
1 parent 0de781d commit 47babbf

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

plugins/askrene/askrene.c

+26
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,8 @@ static struct command_result *json_getroutes(struct command *cmd,
812812
maxdelay_allowed),
813813
NULL))
814814
return command_param_failed();
815+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
816+
json_tok_full_len(params), json_tok_full(buffer, params));
815817

816818
if (amount_msat_is_zero(*info->amount)) {
817819
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
@@ -857,6 +859,8 @@ static struct command_result *json_askrene_reserve(struct command *cmd,
857859
p_req("path", param_reserve_path, &path),
858860
NULL))
859861
return command_param_failed();
862+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
863+
json_tok_full_len(params), json_tok_full(buffer, params));
860864

861865
for (size_t i = 0; i < tal_count(path); i++)
862866
reserve_add(askrene->reserved, &path[i], cmd->id);
@@ -877,6 +881,8 @@ static struct command_result *json_askrene_unreserve(struct command *cmd,
877881
p_req("path", param_reserve_path, &path),
878882
NULL))
879883
return command_param_failed();
884+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
885+
json_tok_full_len(params), json_tok_full(buffer, params));
880886

881887
for (size_t i = 0; i < tal_count(path); i++) {
882888
if (!reserve_remove(askrene->reserved, &path[i])) {
@@ -901,6 +907,8 @@ static struct command_result *json_askrene_listreservations(struct command *cmd,
901907
if (!param(cmd, buffer, params,
902908
NULL))
903909
return command_param_failed();
910+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
911+
json_tok_full_len(params), json_tok_full(buffer, params));
904912

905913
response = jsonrpc_stream_success(cmd);
906914
json_add_reservations(response, askrene->reserved, "reservations");
@@ -925,6 +933,8 @@ static struct command_result *json_askrene_create_channel(struct command *cmd,
925933
p_req("capacity_msat", param_msat, &capacity),
926934
NULL))
927935
return command_param_failed();
936+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
937+
json_tok_full_len(params), json_tok_full(buffer, params));
928938

929939
if (layer_find_local_channel(layer, *scid)) {
930940
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
@@ -963,6 +973,8 @@ static struct command_result *json_askrene_update_channel(struct command *cmd,
963973
p_opt("cltv_expiry_delta", param_u16, &delay),
964974
NULL))
965975
return command_param_failed();
976+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
977+
json_tok_full_len(params), json_tok_full(buffer, params));
966978

967979
layer_add_update_channel(layer, scidd,
968980
enabled,
@@ -1017,6 +1029,8 @@ static struct command_result *json_askrene_inform_channel(struct command *cmd,
10171029
p_req("inform", param_inform, &inform),
10181030
NULL))
10191031
return command_param_failed();
1032+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
1033+
json_tok_full_len(params), json_tok_full(buffer, params));
10201034

10211035
switch (*inform) {
10221036
case INFORM_CONSTRAINED:
@@ -1092,6 +1106,8 @@ static struct command_result *json_askrene_bias_channel(struct command *cmd,
10921106
p_opt("description", param_string, &description),
10931107
NULL))
10941108
return command_param_failed();
1109+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
1110+
json_tok_full_len(params), json_tok_full(buffer, params));
10951111

10961112
b = layer_set_bias(layer, scidd, description, *bias);
10971113
response = jsonrpc_stream_success(cmd);
@@ -1115,6 +1131,8 @@ static struct command_result *json_askrene_disable_node(struct command *cmd,
11151131
p_req("node", param_node_id, &node),
11161132
NULL))
11171133
return command_param_failed();
1134+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
1135+
json_tok_full_len(params), json_tok_full(buffer, params));
11181136

11191137
/* We save this in the layer, because they want us to disable all the channels
11201138
* to the node at *use* time (a new channel might be gossiped!). */
@@ -1139,6 +1157,8 @@ static struct command_result *json_askrene_create_layer(struct command *cmd,
11391157
p_opt_def("persistent", param_bool, &persistent, false),
11401158
NULL))
11411159
return command_param_failed();
1160+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
1161+
json_tok_full_len(params), json_tok_full(buffer, params));
11421162

11431163
if (strstarts(layername, "auto."))
11441164
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
@@ -1173,6 +1193,8 @@ static struct command_result *json_askrene_remove_layer(struct command *cmd,
11731193
p_req("layer", param_known_layer, &layer),
11741194
NULL))
11751195
return command_param_failed();
1196+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
1197+
json_tok_full_len(params), json_tok_full(buffer, params));
11761198

11771199
remove_layer(layer);
11781200

@@ -1192,6 +1214,8 @@ static struct command_result *json_askrene_listlayers(struct command *cmd,
11921214
p_opt("layer", param_known_layer, &layer),
11931215
NULL))
11941216
return command_param_failed();
1217+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
1218+
json_tok_full_len(params), json_tok_full(buffer, params));
11951219

11961220
response = jsonrpc_stream_success(cmd);
11971221
json_add_layers(response, askrene, "layers", layer);
@@ -1212,6 +1236,8 @@ static struct command_result *json_askrene_age(struct command *cmd,
12121236
p_req("cutoff", param_u64, &cutoff),
12131237
NULL))
12141238
return command_param_failed();
1239+
plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__,
1240+
json_tok_full_len(params), json_tok_full(buffer, params));
12151241

12161242
num_removed = layer_trim_constraints(layer, *cutoff);
12171243

0 commit comments

Comments
 (0)