Correct lease expiration times are not necessarily used for lease maintenance spending
Lease renewal decisions, as made by _zkapauthorizer/lease_maintenance.py and renew_leases_on_server in particular, are based on the results of stat_shares as implemented by our server-side storage server wrapper.
The server looks up lease expiration information in _zkapauthorizer/_storage_server.py (get_lease_expiration). This function returns the expiration time of the first lease it comes across for the indicated storage index.
- How is "first" defined? Is it stable?
- What if the "first" lease does not belong to the particular client inspecting the lease state?
- What if the "first" lease does not belong to the particular client inspecting the lease state and it is expired already?