diff --git a/src/proto/alpha/reward_storage.ml b/src/proto/alpha/reward_storage.ml index e01d00d2a..22be03d33 100644 --- a/src/proto/alpha/reward_storage.ml +++ b/src/proto/alpha/reward_storage.ml @@ -47,10 +47,11 @@ let pay_rewards_for_cycle c cycle = match c with | Error _ -> Lwt.return c | Ok c -> - Storage.Rewards.Amount.remove (c, cycle) delegate >>= fun c -> Contract_storage.credit c (Contract_repr.default_contract delegate) - amount) + amount) >>=? fun c -> + Storage.Rewards.Amount.clear (c, cycle) >>= fun c -> + return c let pay_due_rewards c = let timestamp = Raw_context.current_timestamp c in diff --git a/src/proto/alpha/roll_storage.ml b/src/proto/alpha/roll_storage.ml index 28844ed13..7ec4615d2 100644 --- a/src/proto/alpha/roll_storage.ml +++ b/src/proto/alpha/roll_storage.ml @@ -18,15 +18,9 @@ let get_contract_delegate c contract = | None -> Storage.Contract.Delegate.get_option c contract let clear_cycle c cycle = - Storage.Roll.Last_for_cycle.get c cycle >>=? fun last -> Storage.Roll.Last_for_cycle.delete c cycle >>=? fun c -> - let rec loop c roll = - if Roll_repr.(roll = last) then - return c - else - Storage.Roll.Owner_for_cycle.delete (c, cycle) roll >>=? fun c -> - loop c (Roll_repr.succ roll) in - loop c Roll_repr.first + Storage.Roll.Owner_for_cycle.clear (c, cycle) >>= fun c -> + return c let fold ctxt ~f init = Storage.Roll.Next.get ctxt >>=? fun last ->