12 lines
717 B
SQL
12 lines
717 B
SQL
-- A token is claimed by the enrolment presenting it, and spent only when that enrolment has
|
|
-- written everything it needs (novox/hq 04-ISSUES/083).
|
|
--
|
|
-- Spending came first and the node's keys after, in another database: a store that went away
|
|
-- between the two left a spent token and a node with no key, and the host — which makes new keys
|
|
-- on every attempt — could not try again. The claim holds the token for one presenter for a short
|
|
-- lease, so an attempt that failed part-way can be made again by the same presenter, and a second
|
|
-- presenter cannot interleave with the first.
|
|
|
|
alter table enrolment_token add column claimed_by text;
|
|
alter table enrolment_token add column claimed_until timestamptz;
|