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

Function param_recurrence_paywindow

plugins/offers_offer.c:194–226  ·  view source on GitHub ↗

-time+time[%] */

Source from the content-addressed store, hash-verified

192
193/* -time+time[%] */
194static struct command_result *param_recurrence_paywindow(struct command *cmd,
195 const char *name,
196 const char *buffer,
197 const jsmntok_t *tok,
198 struct tlv_offer_recurrence_paywindow
199 **paywindow)
200{
201 jsmntok_t t, before, after;
202
203 *paywindow = tal(cmd, struct tlv_offer_recurrence_paywindow);
204 t = *tok;
205 if (json_tok_endswith(buffer, &t, "%")) {
206 (*paywindow)->proportional_amount = true;
207 t.end--;
208 } else
209 (*paywindow)->proportional_amount = false;
210
211 if (!json_tok_startswith(buffer, &t, "-"))
212 return command_fail_badparam(cmd, name, buffer, tok,
213 "expected -time+time[%]");
214 t.start++;
215 if (!split_tok(buffer, &t, '+', &before, &after))
216 return command_fail_badparam(cmd, name, buffer, tok,
217 "expected -time+time[%]");
218
219 if (!json_to_u32(buffer, &before, &(*paywindow)->seconds_before))
220 return command_fail_badparam(cmd, name, buffer, &before,
221 "expected number of seconds");
222 if (!json_to_u32(buffer, &after, &(*paywindow)->seconds_after))
223 return command_fail_badparam(cmd, name, buffer, &after,
224 "expected number of seconds");
225 return NULL;
226}
227
228static struct command_result *param_invoice_payment_hash(struct command *cmd,
229 const char *name,

Callers

nothing calls this directly

Calls 5

json_tok_endswithFunction · 0.85
command_fail_badparamFunction · 0.85
split_tokFunction · 0.85
json_tok_startswithFunction · 0.50
json_to_u32Function · 0.50

Tested by

no test coverage detected