Alpha: replace 'try ... with'

This commit is contained in:
bruno 2018-06-18 17:34:05 +02:00 committed by Benjamin Canou
parent 1ccdea0d08
commit e498a15a1a

View File

@ -100,8 +100,9 @@ let add_rewards ctxt rewards =
let add_deposit ctxt delegate deposit =
let previous =
try Signature.Public_key_hash.Map.find delegate ctxt.deposits
with Not_found -> Tez_repr.zero in
match Signature.Public_key_hash.Map.find_opt delegate ctxt.deposits with
| Some tz -> tz
| None -> Tez_repr.zero in
Lwt.return Tez_repr.(previous +? deposit) >>=? fun deposit ->
let deposits =
Signature.Public_key_hash.Map.add delegate deposit ctxt.deposits in