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

Function update_rune_usage_time

lightningd/runes.c:984–1001  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

982}
983
984static void update_rune_usage_time(struct runes *runes,
985 struct rune *rune, struct timeabs now)
986{
987 u64 uid = rune_unique_id(rune);
988 struct timeabs last_used;
989
990 if (!wallet_get_rune(tmpctx, runes->ld->wallet, uid, &last_used)) {
991 log_unusual(runes->ld->log,
992 "Rune with unique_id %"PRIu64" is not in our database: adding it",
993 uid);
994 wallet_rune_insert(runes->ld->wallet, rune);
995 if (uid >= runes->next_unique_id)
996 runes->next_unique_id = uid + 1;
997 }
998
999 /* FIXME: we could batch DB access if this is too slow */
1000 wallet_rune_update_last_used(runes->ld->wallet, rune, now);
1001}
1002
1003/* invokerune and destroyrune are aliases - a rune must see the command that actually runs, or "method/createrune" is bypassed by the alias */
1004static const char *canonical_method(const char *method)

Callers 1

json_checkruneFunction · 0.85

Calls 4

wallet_get_runeFunction · 0.85
wallet_rune_insertFunction · 0.85
rune_unique_idFunction · 0.70

Tested by

no test coverage detected