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

Function offer_period_start

common/bolt12.c:329–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329u64 offer_period_start(u64 basetime, size_t n,
330 const struct tlv_offer_recurrence *recur)
331{
332 /* BOLT-offers-recurrence #12:
333 * 1. A `time_unit` defining 0 (seconds), 1 (days), 2 (months),
334 * 3 (years).
335 */
336 switch (recur->time_unit) {
337 case 0:
338 return basetime + recur->period * n;
339 case 1:
340 return time_change(basetime, recur->period * n, add_days, false);
341 case 2:
342 return time_change(basetime, recur->period * n, add_months, true);
343 case 3:
344 return time_change(basetime, recur->period * n, add_years, true);
345 default:
346 /* This is our offer, how did we get here? */
347 return 0;
348 }
349}
350
351void offer_period_paywindow(const struct tlv_offer_recurrence *recurrence,
352 const struct tlv_offer_recurrence_paywindow *recurrence_paywindow,

Callers 4

offer_period_paywindowFunction · 0.85
mainFunction · 0.85
check_periodFunction · 0.85
handle_invreq_responseFunction · 0.85

Calls 1

time_changeFunction · 0.85

Tested by 1

mainFunction · 0.68