Skip to content

Commit e8545ab

Browse files
committed
Add a slot reduction update method to Account
1 parent 5f63155 commit e8545ab

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/lib/mina_base/account.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,16 @@ let liquid_balance_at_slot ~global_slot (account : t) =
911911
~vesting_period ~vesting_increment ~initial_minimum_balance ) )
912912
|> Option.value_exn
913913

914+
(** Apply the vesting parameter update to an account's timing information. See
915+
[Timing.Slot_reduction_update] for usage notes. *)
916+
let slot_reduction_update ~hardfork_slot (account : t) =
917+
let timing =
918+
account.timing |> Timing.to_record
919+
|> Timing.slot_reduction_update ~hardfork_slot
920+
|> Timing.of_record
921+
in
922+
{ account with timing }
923+
914924
let gen : t Quickcheck.Generator.t =
915925
let open Quickcheck.Let_syntax in
916926
let%bind public_key = Public_key.Compressed.gen in

src/lib/mina_base/account_timing.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,5 +516,7 @@ end
516516
if the account is not actively vesting at [hardfork_slot]. See the
517517
[Slot_reduction_update] module documentation for general usage notes. *)
518518
let slot_reduction_update ~hardfork_slot (t : as_record) =
519-
Slot_reduction_update.(
520-
t |> of_record |> hardfork_adjustment ~hardfork_slot |> to_record)
519+
if t.is_timed then
520+
Slot_reduction_update.(
521+
t |> of_record |> hardfork_adjustment ~hardfork_slot |> to_record)
522+
else t

0 commit comments

Comments
 (0)