Shell/State: consistent use of pred vs. predecessor.

This commit is contained in:
Grégoire Henry 2017-04-10 12:58:31 +02:00
parent 6212af55f1
commit ab76b8fbf5
4 changed files with 8 additions and 8 deletions

View File

@ -152,7 +152,7 @@ module RPC = struct
let convert (block: State.Valid_block.t) = { let convert (block: State.Valid_block.t) = {
hash = block.hash ; hash = block.hash ;
predecessor = block.pred ; predecessor = block.predecessor ;
fitness = block.fitness ; fitness = block.fitness ;
timestamp = block.timestamp ; timestamp = block.timestamp ;
protocol = Some block.protocol_hash ; protocol = Some block.protocol_hash ;

View File

@ -110,7 +110,7 @@ and net_state = {
and valid_block = { and valid_block = {
net_id: Net_id.t ; net_id: Net_id.t ;
hash: Block_hash.t ; hash: Block_hash.t ;
pred: Block_hash.t ; predecessor: Block_hash.t ;
timestamp: Time.t ; timestamp: Time.t ;
fitness: Protocol.fitness ; fitness: Protocol.fitness ;
operations_hash: Operation_list_list_hash.t ; operations_hash: Operation_list_list_hash.t ;
@ -144,7 +144,7 @@ let build_valid_block
let valid_block = { let valid_block = {
net_id = header.Store.Block_header.shell.net_id ; net_id = header.Store.Block_header.shell.net_id ;
hash ; hash ;
pred = header.shell.predecessor ; predecessor = header.shell.predecessor ;
timestamp = header.shell.timestamp ; timestamp = header.shell.timestamp ;
discovery_time ; discovery_time ;
operations_hash = header.shell.operations ; operations_hash = header.shell.operations ;
@ -932,7 +932,7 @@ module Valid_block = struct
type t = valid_block = { type t = valid_block = {
net_id: Net_id.t ; net_id: Net_id.t ;
hash: Block_hash.t ; hash: Block_hash.t ;
pred: Block_hash.t ; predecessor: Block_hash.t ;
timestamp: Time.t ; timestamp: Time.t ;
fitness: Fitness.fitness ; fitness: Fitness.fitness ;
operations_hash: Operation_list_list_hash.t ; operations_hash: Operation_list_list_hash.t ;
@ -1166,10 +1166,10 @@ module Valid_block = struct
end end
| res -> res in | res -> res in
let predecessor state b = 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 Lwt.return None
else else
read_opt state b.pred in read_opt state b.predecessor in
Raw_helpers.iter_predecessors compare predecessor Raw_helpers.iter_predecessors compare predecessor
(fun b -> b.timestamp) (fun b -> b.fitness) (fun b -> b.timestamp) (fun b -> b.fitness)

View File

@ -245,7 +245,7 @@ module Valid_block : sig
(** The genesis of the chain this block belongs to. *) (** The genesis of the chain this block belongs to. *)
hash: Block_hash.t ; hash: Block_hash.t ;
(** The block hash. *) (** The block hash. *)
pred: Block_hash.t ; predecessor: Block_hash.t ;
(** The preceding block in the chain. *) (** The preceding block in the chain. *)
timestamp: Time.t ; timestamp: Time.t ;
(** The date at which this block has been forged. *) (** The date at which this block has been forged. *)

View File

@ -129,7 +129,7 @@ let rec may_set_head v (block: State.Valid_block.t) =
Fitness.pp block.fitness Fitness.pp block.fitness
Time.pp_hum block.timestamp Time.pp_hum block.timestamp
(fun ppf -> (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" Format.fprintf ppf "same branch"
else else
Format.fprintf ppf "changing branch") >>= fun () -> Format.fprintf ppf "changing branch") >>= fun () ->