2016-10-22 21:35:48 +03:00
|
|
|
// Copyright 2016 The Grin Developers
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2016-10-21 03:06:12 +03:00
|
|
|
//! Definition of the genesis block. Placeholder for now.
|
|
|
|
|
|
|
|
use time;
|
|
|
|
|
|
|
|
use core;
|
2016-12-27 02:39:31 +03:00
|
|
|
use consensus::DEFAULT_SIZESHIFT;
|
2017-06-29 17:49:11 +03:00
|
|
|
use consensus::MINIMUM_DIFFICULTY;
|
2016-12-18 00:44:14 +03:00
|
|
|
use core::hash::Hashed;
|
2016-12-27 02:39:31 +03:00
|
|
|
use core::target::Difficulty;
|
2016-10-21 03:06:12 +03:00
|
|
|
|
2017-04-10 09:17:23 +03:00
|
|
|
/// Genesis block definition. It has no rewards, no inputs, no outputs, no
|
|
|
|
/// fees and a height of zero.
|
2016-10-21 03:06:12 +03:00
|
|
|
pub fn genesis() -> core::Block {
|
|
|
|
core::Block {
|
|
|
|
header: core::BlockHeader {
|
|
|
|
height: 0,
|
2016-11-10 00:25:40 +03:00
|
|
|
previous: core::hash::Hash([0xff; 32]),
|
2016-10-21 03:06:12 +03:00
|
|
|
timestamp: time::Tm {
|
2016-12-14 06:21:49 +03:00
|
|
|
tm_year: 1997 - 1900,
|
2016-10-21 03:06:12 +03:00
|
|
|
tm_mon: 7,
|
|
|
|
tm_mday: 4,
|
|
|
|
..time::empty_tm()
|
|
|
|
},
|
2017-06-29 17:49:11 +03:00
|
|
|
difficulty: Difficulty::from_num(MINIMUM_DIFFICULTY),
|
|
|
|
total_difficulty: Difficulty::from_num(MINIMUM_DIFFICULTY),
|
2016-12-21 04:32:19 +03:00
|
|
|
utxo_merkle: [].hash(),
|
|
|
|
tx_merkle: [].hash(),
|
2017-03-24 03:06:00 +03:00
|
|
|
features: core::DEFAULT_BLOCK,
|
2016-10-21 03:06:12 +03:00
|
|
|
nonce: 0,
|
|
|
|
pow: core::Proof::zero(), // TODO get actual PoW solution
|
|
|
|
},
|
|
|
|
inputs: vec![],
|
|
|
|
outputs: vec![],
|
2017-03-21 00:07:00 +03:00
|
|
|
kernels: vec![],
|
2016-10-21 03:06:12 +03:00
|
|
|
}
|
|
|
|
}
|