MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_pay

Function json_pay

plugins/pay.c:868–1141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

866 return start_payment(cmd, p);
867}
868static struct command_result *json_pay(struct command *cmd,
869 const char *buf,
870 const jsmntok_t *params)
871{
872 struct payment *p;
873 const char *b11str;
874 struct bolt11 *b11;
875 const char *b11_fail, *b12_fail;
876 u64 *maxfee_pct_millionths;
877 u32 *maxdelay;
878 struct amount_msat *exemptfee, *msat, *maxfee, *partial;
879 const char *label, *description;
880 unsigned int *retryfor;
881 u64 *riskfactor_millionths;
882 struct shadow_route_data *shadow_route;
883 struct amount_msat *invmsat;
884 u64 invexpiry;
885 struct sha256 *local_invreq_id;
886 const struct tlv_invoice *b12;
887 struct out_req *req;
888 struct route_exclusion **exclusions;
889 bool *dev_use_shadow;
890 bool use_invstring;
891
892 /* If any of the modifiers need to add params to the JSON-RPC call we
893 * would add them to the `param()` call below, and have them be
894 * initialized directly that way. */
895 /* BOLT #4:
896 * ## `max_htlc_cltv` Selection
897 *
898 * This ... value is defined as 2016 blocks, based on historical value
899 * deployed by Lightning implementations.
900 */
901 /* FIXME: Typo in spec for CLTV in descripton! But it breaks our spelling check, so we omit it above */
902 /* We accept invstring, too (and use it in the help message) */
903 use_invstring = (!params || (params->type == JSMN_OBJECT && json_get_member(buf, params, "invstring")));
904 if (!param_check(cmd, buf, params,
905 p_req_var(use_invstring ? "invstring" : "bolt11", param_invstring, &b11str),
906 p_opt("amount_msat", param_msat, &msat),
907 p_opt("label", param_string, &label),
908 p_opt_def("riskfactor", param_millionths,
909 &riskfactor_millionths, 10000000),
910 p_opt("maxfeepercent", param_millionths,
911 &maxfee_pct_millionths),
912 p_opt_def("retry_for", param_number, &retryfor, 60),
913 p_opt_def("maxdelay", param_number, &maxdelay,
914 2016),
915 p_opt("exemptfee", param_msat, &exemptfee),
916 p_opt("localinvreqid", param_sha256, &local_invreq_id),
917 p_opt("exclude", param_route_exclusion_array, &exclusions),
918 p_opt("maxfee", param_msat, &maxfee),
919 p_opt("description", param_escaped_string, &description),
920 p_opt("partial_msat", param_msat, &partial),
921 p_opt_dev("dev_use_shadow", param_bool, &dev_use_shadow, true),
922 NULL))
923 return command_param_failed();
924
925 /* We can't just mark this command deprecated, as that prevents

Callers

nothing calls this directly

Calls 15

json_get_memberFunction · 0.85
param_checkFunction · 0.85
paymod_logFunction · 0.85
bolt12_has_prefixFunction · 0.85
bolt11_decodeFunction · 0.85
feature_offeredFunction · 0.85
invoice_decodeFunction · 0.85
node_id_from_pubkeyFunction · 0.85
gossmap_scidd_pubkeyFunction · 0.85
get_raw_gossmapFunction · 0.85
fmt_short_channel_id_dirFunction · 0.85
clock_timeFunction · 0.85

Tested by

no test coverage detected