Alpha: Seed_repr.initial_seeds n generates n seeds rather than n+1
This commit is contained in:
parent
9f1c703991
commit
0ad4f8f6e6
@ -99,7 +99,7 @@ let initial_nonce_hash_0 =
|
|||||||
|
|
||||||
let initial_seeds n =
|
let initial_seeds n =
|
||||||
let rec loop acc elt i =
|
let rec loop acc elt i =
|
||||||
if Compare.Int.(i = 0) then
|
if Compare.Int.(i = 1) then
|
||||||
List.rev (elt :: acc)
|
List.rev (elt :: acc)
|
||||||
else
|
else
|
||||||
loop
|
loop
|
||||||
|
@ -43,6 +43,10 @@ val take_int32 : sequence -> int32 -> int32 * sequence
|
|||||||
(** {2 Predefined seeds} *****************************************************)
|
(** {2 Predefined seeds} *****************************************************)
|
||||||
|
|
||||||
val empty : seed
|
val empty : seed
|
||||||
|
|
||||||
|
(** [intial_seeds n] generates the first [n] seeds for which there are no nonces.
|
||||||
|
The first seed is a constant value. The kth seed is the hash of seed (k-1)
|
||||||
|
concatenated with a constant. *)
|
||||||
val initial_seeds : int -> seed list
|
val initial_seeds : int -> seed list
|
||||||
|
|
||||||
(** {2 Entropy} **************************************************************)
|
(** {2 Entropy} **************************************************************)
|
||||||
|
@ -90,7 +90,7 @@ let init ctxt =
|
|||||||
Storage.Seed.For_cycle.init ctxt cycle seed)
|
Storage.Seed.For_cycle.init ctxt cycle seed)
|
||||||
(return ctxt)
|
(return ctxt)
|
||||||
(0 --> (preserved+1))
|
(0 --> (preserved+1))
|
||||||
(Seed_repr.initial_seeds (preserved+1))
|
(Seed_repr.initial_seeds (preserved+2))
|
||||||
|
|
||||||
let cycle_end ctxt last_cycle =
|
let cycle_end ctxt last_cycle =
|
||||||
let preserved = Constants_storage.preserved_cycles ctxt in
|
let preserved = Constants_storage.preserved_cycles ctxt in
|
||||||
@ -105,4 +105,3 @@ let cycle_end ctxt last_cycle =
|
|||||||
| Some revealed ->
|
| Some revealed ->
|
||||||
let inited_seed_cycle = Cycle_repr.add last_cycle (preserved+1) in
|
let inited_seed_cycle = Cycle_repr.add last_cycle (preserved+1) in
|
||||||
compute_for_cycle ctxt ~revealed inited_seed_cycle
|
compute_for_cycle ctxt ~revealed inited_seed_cycle
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user