Alpha: fix contract deletion.
This commit is contained in:
parent
09d959be04
commit
800f4b555d
@ -188,17 +188,15 @@ module Contract = struct
|
|||||||
Storage.Roll.Contract_change.get c contract >>=? fun change ->
|
Storage.Roll.Contract_change.get c contract >>=? fun change ->
|
||||||
loop c change >>=? fun (c, change) ->
|
loop c change >>=? fun (c, change) ->
|
||||||
Lwt.return Tez_repr.(change -? amount) >>=? fun change ->
|
Lwt.return Tez_repr.(change -? amount) >>=? fun change ->
|
||||||
if Tez_repr.(change = zero) then
|
Storage.Roll.Contract_roll_list.mem c contract >>= fun rolls ->
|
||||||
|
if Tez_repr.(change = zero) && not rolls then
|
||||||
Storage.Roll.Contract_change.delete c contract
|
Storage.Roll.Contract_change.delete c contract
|
||||||
else
|
else
|
||||||
Storage.Roll.Contract_change.set c contract change
|
Storage.Roll.Contract_change.set c contract change
|
||||||
|
|
||||||
let assert_empty c contract =
|
let assert_empty c contract =
|
||||||
Storage.Roll.Contract_change.mem 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 (not change) Deleted_contract_owning_rolls
|
||||||
fail_unless (not change &&
|
|
||||||
match roll_list with None -> true | Some _ -> false)
|
|
||||||
Deleted_contract_owning_rolls
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user