From ab76b8fbf58b89abd826d8069aad0315cf2ef396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Mon, 10 Apr 2017 12:58:31 +0200 Subject: [PATCH] Shell/State: consistent use of `pred` vs. `predecessor`. --- src/node/shell/node.ml | 2 +- src/node/shell/state.ml | 10 +++++----- src/node/shell/state.mli | 2 +- src/node/shell/validator.ml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/node/shell/node.ml b/src/node/shell/node.ml index 40c7211ad..b3764cd14 100644 --- a/src/node/shell/node.ml +++ b/src/node/shell/node.ml @@ -152,7 +152,7 @@ module RPC = struct let convert (block: State.Valid_block.t) = { hash = block.hash ; - predecessor = block.pred ; + predecessor = block.predecessor ; fitness = block.fitness ; timestamp = block.timestamp ; protocol = Some block.protocol_hash ; diff --git a/src/node/shell/state.ml b/src/node/shell/state.ml index 653385fd2..c34dbc5a3 100644 --- a/src/node/shell/state.ml +++ b/src/node/shell/state.ml @@ -110,7 +110,7 @@ and net_state = { and valid_block = { net_id: Net_id.t ; hash: Block_hash.t ; - pred: Block_hash.t ; + predecessor: Block_hash.t ; timestamp: Time.t ; fitness: Protocol.fitness ; operations_hash: Operation_list_list_hash.t ; @@ -144,7 +144,7 @@ let build_valid_block let valid_block = { net_id = header.Store.Block_header.shell.net_id ; hash ; - pred = header.shell.predecessor ; + predecessor = header.shell.predecessor ; timestamp = header.shell.timestamp ; discovery_time ; operations_hash = header.shell.operations ; @@ -932,7 +932,7 @@ module Valid_block = struct type t = valid_block = { net_id: Net_id.t ; hash: Block_hash.t ; - pred: Block_hash.t ; + predecessor: Block_hash.t ; timestamp: Time.t ; fitness: Fitness.fitness ; operations_hash: Operation_list_list_hash.t ; @@ -1166,10 +1166,10 @@ module Valid_block = struct end | res -> res in let predecessor state b = - if Block_hash.equal b.hash b.pred then + if Block_hash.equal b.hash b.predecessor then Lwt.return None else - read_opt state b.pred in + read_opt state b.predecessor in Raw_helpers.iter_predecessors compare predecessor (fun b -> b.timestamp) (fun b -> b.fitness) diff --git a/src/node/shell/state.mli b/src/node/shell/state.mli index b8c64f6ea..e8a98d90e 100644 --- a/src/node/shell/state.mli +++ b/src/node/shell/state.mli @@ -245,7 +245,7 @@ module Valid_block : sig (** The genesis of the chain this block belongs to. *) hash: Block_hash.t ; (** The block hash. *) - pred: Block_hash.t ; + predecessor: Block_hash.t ; (** The preceding block in the chain. *) timestamp: Time.t ; (** The date at which this block has been forged. *) diff --git a/src/node/shell/validator.ml b/src/node/shell/validator.ml index 6b488bbe0..4e11a0b82 100644 --- a/src/node/shell/validator.ml +++ b/src/node/shell/validator.ml @@ -129,7 +129,7 @@ let rec may_set_head v (block: State.Valid_block.t) = Fitness.pp block.fitness Time.pp_hum block.timestamp (fun ppf -> - if Block_hash.equal head.hash block.pred then + if Block_hash.equal head.hash block.predecessor then Format.fprintf ppf "same branch" else Format.fprintf ppf "changing branch") >>= fun () ->