Skip to main content

dusk_node/chain/
genesis.rs

1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4//
5// Copyright (c) DUSK NETWORK. All rights reserved.
6
7use node_data::ledger::{Block, Header};
8
9/// Generates the genesis block for the given state root and timestamp.
10pub fn generate_block(state_hash: [u8; 32], timestamp: u64) -> Block {
11    Block::new(
12        Header {
13            timestamp,
14            state_hash,
15            ..Default::default()
16        },
17        vec![],
18        vec![],
19    )
20    .expect("block should be valid")
21}