| 982 | } |
| 983 | |
| 984 | static 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 */ |
| 1004 | static const char *canonical_method(const char *method) |
no test coverage detected