# req-035 Schist must implement the procedure described below as `is_bucket_balance_up_to_date`. Source: req-030 Satisfied by: task-001, task-006, task-054 ## is_bucket_balance_up_to_date Inputs: - A bucket, `bucket` 1. Let `cache_key = bucket.balance_cache_key`. 2. If `cache_key` is not in the format, `:`, then return FALSE. 3. Let `drip_id` be the part of `cache_key` before the `:`. 4. If there is no drip with the ID, `drip_id`, then return FALSE. 5. Let `drip` be the drip with the ID, `drip_id`. 6. If there is a drip, `drip_2`, such that `drip_2.timestamp > drip.timestamp` and `drip.bucket_id = bucket.id`, then return FALSE. 7. Let `transaction_id` be the part of `cache_key` after the `:`. 8. If there is no transaction with the ID, `transaction_id`, then return FALSE. 9. Let `transaction` be the transaction with the ID, `transaction_id`. 10. If there is a transaction, `transaction_2`, such that `transaction_2.timestamp >= transaction.timestamp` and `transaction.bucket_id = bucket.id`, then return FALSE. 11. Return TRUE.