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

Function rate_limit_check

lightningd/runes.c:142–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142static const char *rate_limit_check(const tal_t *ctx,
143 const struct runes *runes,
144 const struct rune *rune,
145 const struct rune_altern *alt,
146 struct cond_info *cinfo)
147{
148 unsigned long r;
149 char *endp;
150 if (alt->condition != '=')
151 return "rate operator must be =";
152
153 r = strtoul(alt->value, &endp, 10);
154 if (endp == alt->value || *endp || r == 0 || r >= UINT32_MAX)
155 return "malformed rate";
156
157 return last_time_check(rune, cinfo, 60 * sec_per_nsec / r);
158}
159
160/* We need to initialize master runes secret early, so db can use rune_is_ours */
161struct runes *runes_early_init(struct lightningd *ld)

Callers 1

check_conditionFunction · 0.85

Calls 1

last_time_checkFunction · 0.85

Tested by

no test coverage detected