Baker: small refactoring

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

View File

@ -57,7 +57,10 @@ type state = {
mutable best_slot: (Time.t * (Client_baking_blocks.block_info * int * public_key_hash)) option ; mutable best_slot: (Time.t * (Client_baking_blocks.block_info * int * public_key_hash)) option ;
} }
let create_state ?(fee_threshold = Tez.zero) ~max_waiting_time genesis context_path index delegates constants = let create_state
?(fee_threshold = Tez.zero) ~max_waiting_time
genesis context_path index
delegates constants =
{ genesis ; { genesis ;
context_path ; context_path ;
index ; index ;
@ -944,8 +947,8 @@ let filter_outdated_nonces
cctxt ~chain ~block:head () >>=? fun { protocol_data = { level = current_level } } -> cctxt ~chain ~block:head () >>=? fun { protocol_data = { level = current_level } } ->
let current_cycle = Cycle.to_int32 current_level.Level.cycle in let current_cycle = Cycle.to_int32 current_level.Level.cycle in
let is_older_than_5_cycles block_cycle = let is_older_than_5_cycles block_cycle =
let i = Int32.sub current_cycle block_cycle in let delta = Int32.sub current_cycle block_cycle in
i > 5l delta > 5l
in in
filter_map_s (fun (hash, _) -> filter_map_s (fun (hash, _) ->
Alpha_block_services.metadata cctxt ~chain ~block:(`Hash (hash, 0)) () >>=? Alpha_block_services.metadata cctxt ~chain ~block:(`Hash (hash, 0)) () >>=?