| 971 | } |
| 972 | |
| 973 | static struct command_result *json_pay(struct command *cmd, |
| 974 | const char *buf, |
| 975 | const jsmntok_t *params) |
| 976 | { |
| 977 | struct payment *p; |
| 978 | const char *b11str; |
| 979 | struct bolt11 *b11; |
| 980 | char *b11_fail, *b12_fail; |
| 981 | u64 *maxfee_pct_millionths; |
| 982 | u32 *maxdelay; |
| 983 | struct amount_msat *exemptfee, *msat, *maxfee; |
| 984 | const char *label, *description; |
| 985 | unsigned int *retryfor; |
| 986 | u64 *riskfactor_millionths; |
| 987 | struct shadow_route_data *shadow_route; |
| 988 | struct amount_msat *invmsat; |
| 989 | u64 invexpiry; |
| 990 | struct sha256 *local_offer_id; |
| 991 | const struct tlv_invoice *b12; |
| 992 | struct out_req *req; |
| 993 | struct route_exclusion **exclusions; |
| 994 | #if DEVELOPER |
| 995 | bool *use_shadow; |
| 996 | #endif |
| 997 | |
| 998 | /* If any of the modifiers need to add params to the JSON-RPC call we |
| 999 | * would add them to the `param()` call below, and have them be |
| 1000 | * initialized directly that way. */ |
| 1001 | if (!param(cmd, buf, params, |
| 1002 | /* FIXME: parameter should be invstring now */ |
| 1003 | p_req("bolt11", param_string, &b11str), |
| 1004 | p_opt("amount_msat|msatoshi", param_msat, &msat), |
| 1005 | p_opt("label", param_string, &label), |
| 1006 | p_opt_def("riskfactor", param_millionths, |
| 1007 | &riskfactor_millionths, 10000000), |
| 1008 | p_opt("maxfeepercent", param_millionths, |
| 1009 | &maxfee_pct_millionths), |
| 1010 | p_opt_def("retry_for", param_number, &retryfor, 60), |
| 1011 | p_opt_def("maxdelay", param_number, &maxdelay, |
| 1012 | maxdelay_default), |
| 1013 | p_opt("exemptfee", param_msat, &exemptfee), |
| 1014 | p_opt("localofferid", param_sha256, &local_offer_id), |
| 1015 | p_opt("exclude", param_route_exclusion_array, &exclusions), |
| 1016 | p_opt("maxfee", param_msat, &maxfee), |
| 1017 | p_opt("description", param_string, &description), |
| 1018 | #if DEVELOPER |
| 1019 | p_opt_def("use_shadow", param_bool, &use_shadow, true), |
| 1020 | #endif |
| 1021 | NULL)) |
| 1022 | return command_param_failed(); |
| 1023 | |
| 1024 | p = payment_new(cmd, cmd, NULL /* No parent */, paymod_mods); |
| 1025 | p->invstring = tal_steal(p, b11str); |
| 1026 | p->description = tal_steal(p, description); |
| 1027 | |
| 1028 | if (!bolt12_has_prefix(b11str)) { |
| 1029 | b11 = |
| 1030 | bolt11_decode(tmpctx, b11str, plugin_feature_set(cmd->plugin), |
nothing calls this directly
no test coverage detected