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

Function last_time_check

lightningd/runes.c:85–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85static const char *last_time_check(const struct rune *rune,
86 struct cond_info *cinfo,
87 u64 n_sec)
88{
89 u64 diff;
90 struct timeabs last_used;
91
92 if (!wallet_get_rune(tmpctx, cinfo->runes->ld->wallet, atol(rune->unique_id), &last_used)) {
93 /* Never used: update_rune_usage_time will add it. */
94 return NULL;
95 }
96 if (time_before(cinfo->now, last_used)) {
97 last_used = cinfo->now;
98 }
99
100 diff = time_to_nsec(time_between(cinfo->now, last_used));
101 if (diff < n_sec) {
102 return "too soon";
103 }
104 return NULL;
105}
106
107static const char *per_time_check(const tal_t *ctx,
108 const struct runes *runes,

Callers 2

per_time_checkFunction · 0.85
rate_limit_checkFunction · 0.85

Calls 4

wallet_get_runeFunction · 0.85
time_beforeFunction · 0.85
time_to_nsecFunction · 0.85
time_betweenFunction · 0.85

Tested by

no test coverage detected