Shell: do not forbid to restart the node.
This commit is contained in:
parent
23869991ca
commit
257a3972df
@ -89,6 +89,16 @@ type config = {
|
|||||||
p2p: (P2p.config * P2p.limits) option ;
|
p2p: (P2p.config * P2p.limits) option ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let may_create_net state ?test_protocol genesis =
|
||||||
|
State.Net.get state (State.Net_id.Id genesis.State.Net.block) >>= function
|
||||||
|
| Ok net -> Lwt.return net
|
||||||
|
| Error _ ->
|
||||||
|
State.Net.create state
|
||||||
|
?test_protocol
|
||||||
|
~forked_network_ttl:(48 * 3600) (* 2 days *)
|
||||||
|
genesis
|
||||||
|
|
||||||
|
|
||||||
let create { genesis ; store_root ; context_root ;
|
let create { genesis ; store_root ; context_root ;
|
||||||
test_protocol ; patch_context ; p2p = net_params } =
|
test_protocol ; patch_context ; p2p = net_params } =
|
||||||
init_p2p net_params >>= fun p2p ->
|
init_p2p net_params >>= fun p2p ->
|
||||||
@ -96,10 +106,7 @@ let create { genesis ; store_root ; context_root ;
|
|||||||
~store_root ~context_root ?patch_context () >>=? fun state ->
|
~store_root ~context_root ?patch_context () >>=? fun state ->
|
||||||
let distributed_db = Distributed_db.create state p2p in
|
let distributed_db = Distributed_db.create state p2p in
|
||||||
let validator = Validator.create_worker state distributed_db in
|
let validator = Validator.create_worker state distributed_db in
|
||||||
State.Net.create state
|
may_create_net state ?test_protocol genesis >>= fun mainnet_net ->
|
||||||
?test_protocol
|
|
||||||
~forked_network_ttl:(48 * 3600) (* 2 days *)
|
|
||||||
genesis >>= fun mainnet_net ->
|
|
||||||
Validator.activate validator mainnet_net >>= fun mainnet_validator ->
|
Validator.activate validator mainnet_net >>= fun mainnet_validator ->
|
||||||
let mainnet_db = Validator.net_db mainnet_validator in
|
let mainnet_db = Validator.net_db mainnet_validator in
|
||||||
let shutdown () =
|
let shutdown () =
|
||||||
|
@ -929,7 +929,7 @@ module Valid_block = struct
|
|||||||
} in
|
} in
|
||||||
Shared.use state.global_data begin fun data ->
|
Shared.use state.global_data begin fun data ->
|
||||||
if Net_id.Table.mem data.nets (Net_id.Id hash) then
|
if Net_id.Table.mem data.nets (Net_id.Id hash) then
|
||||||
failwith "...FIXME"
|
assert false (* This would mean a block is validated twice... *)
|
||||||
else
|
else
|
||||||
Context.init_test_network block.context
|
Context.init_test_network block.context
|
||||||
~time:genesis.time
|
~time:genesis.time
|
||||||
|
Loading…
Reference in New Issue
Block a user