Skip to content

Commit ad9cdf9

Browse files
committed
Touch the oldest completed slice when marking a burrow for liquidation, again
1 parent cb4102f commit ad9cdf9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/checker.ml

+19
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,25 @@ let[@inline] entrypoint_mark_for_liquidation (state, burrow_id: checker * burrow
499499
| None -> (Ligo.failwith error_GetEntrypointOptFailureBurrowSendTezTo : LigoOp.operation) in
500500
let ops = [op] in
501501

502+
(* Touch the oldest liquidation slice (if it exists). This should help the
503+
* system keep the number of liquidation slices close to linear in many
504+
* occasions. *)
505+
let ops, state =
506+
match liquidation_auction_oldest_completed_liquidation_slice state.liquidation_auctions with
507+
| None -> (ops, state)
508+
| Some leaf ->
509+
let ops, state_liquidation_auctions, state_burrows, state_parameters, state_fa2_state =
510+
touch_liquidation_slice ops state.liquidation_auctions state.burrows state.parameters state.fa2_state leaf in
511+
( ops,
512+
{ state with
513+
liquidation_auctions = state_liquidation_auctions;
514+
burrows = state_burrows;
515+
parameters = state_parameters;
516+
fa2_state = state_fa2_state;
517+
}
518+
)
519+
in
520+
502521
assert_checker_invariants state;
503522
(ops, state)
504523

0 commit comments

Comments
 (0)