From 3b38720fb6dd6a939d27d392acf2dd47bb36a6e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Tue, 9 May 2017 17:35:56 +0200 Subject: [PATCH] Minor fix in contract deletion --- src/proto/alpha/roll_storage.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/proto/alpha/roll_storage.ml b/src/proto/alpha/roll_storage.ml index 171aa5840..5a3c3439d 100644 --- a/src/proto/alpha/roll_storage.ml +++ b/src/proto/alpha/roll_storage.ml @@ -188,12 +188,15 @@ module Contract = struct Storage.Roll.Contract_change.get c contract >>=? fun change -> loop c change >>=? fun (c, change) -> Lwt.return Tez_repr.(change -? amount) >>=? fun change -> - Storage.Roll.Contract_change.set c contract change + if Tez_repr.(change = zero) then + Storage.Roll.Contract_change.delete c contract + else + Storage.Roll.Contract_change.set c contract change let assert_empty c contract = - Storage.Roll.Contract_change.get c contract >>=? fun change -> + Storage.Roll.Contract_change.mem c contract >>= fun change -> Storage.Roll.Contract_roll_list.get c contract >>=? fun roll_list -> - fail_unless (Tez_repr.(change = zero) && + fail_unless (not change && match roll_list with None -> true | Some _ -> false) Deleted_contract_owning_rolls