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

Function update_tokens

gossipd/routing.c:51–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49#define TOKEN_MAX (12 * 4)
50
51static u8 update_tokens(const struct routing_state *rstate,
52 u8 tokens, u32 prev_timestamp, u32 new_timestamp)
53{
54 u64 num_tokens = tokens;
55
56 assert(new_timestamp >= prev_timestamp);
57
58 num_tokens += ((new_timestamp - prev_timestamp)
59 / GOSSIP_TOKEN_TIME(rstate->dev_fast_gossip));
60 if (num_tokens > TOKEN_MAX)
61 num_tokens = TOKEN_MAX;
62 return num_tokens;
63}
64
65static bool ratelimit(const struct routing_state *rstate,
66 u8 *tokens, u32 prev_timestamp, u32 new_timestamp)

Callers 2

ratelimitFunction · 0.85
would_ratelimit_cupdateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected