Alpha/Client: also prevent the client from parsing n times the nonces

This commit is contained in:
Vincent Botbol 2018-11-06 16:47:45 +01:00 committed by Grégoire Henry
parent ca1b05e514
commit 2e2a40b331
No known key found for this signature in database
GPG Key ID: 50D984F20BD445D2

View File

@ -110,6 +110,9 @@ let do_reveal cctxt block blocks =
return_unit
let reveal_block_nonces (cctxt : #Proto_alpha.full) block_hashes =
cctxt#with_lock begin fun () ->
Client_baking_nonces.load cctxt
end >>=? fun nonces ->
Lwt_list.filter_map_p
(fun hash ->
Lwt.catch
@ -125,7 +128,7 @@ let reveal_block_nonces (cctxt : #Proto_alpha.full) block_hashes =
Lwt.return_none))
block_hashes >>= fun block_infos ->
filter_map_s (fun (bi : Client_baking_blocks.block_info) ->
Client_baking_nonces.find cctxt bi.hash >>=? function
match List.assoc_opt bi.hash nonces with
| None ->
cctxt#warning "Cannot find nonces for block %a (ignoring)@."
Block_hash.pp_short bi.hash >>= fun () ->