Alpha/Origination: ensure that delegate's originated accounts are registered

This commit is contained in:
Vincent Botbol 2018-07-17 14:04:33 +02:00 committed by Grégoire Henry
parent da986e27ab
commit 07486a3027

View File

@ -253,6 +253,14 @@ let registered c delegate =
c (Contract_repr.implicit_contract delegate)
let init ctxt contract delegate =
known ctxt delegate >>=? fun known_delegate ->
fail_unless
known_delegate
(Roll_storage.Unregistered_delegate delegate) >>=? fun () ->
registered ctxt delegate >>= fun is_registered ->
fail_unless
is_registered
(Roll_storage.Unregistered_delegate delegate) >>=? fun () ->
Storage.Contract.Delegate.init ctxt contract delegate >>=? fun ctxt ->
Storage.Contract.Balance.get ctxt contract >>=? fun balance ->
link ctxt contract delegate balance