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) = {
hash = block.hash ;
predecessor = block.pred ;
predecessor = block.predecessor ;
fitness = block.fitness ;
timestamp = block.timestamp ;
protocol = Some block.protocol_hash ;

View File

@ -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)

View File

@ -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. *)

View File

@ -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 () ->