mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 21:11:07 +00:00
committed by
Gav Wood
parent
46e3c32e49
commit
bdf156d35e
@@ -94,6 +94,7 @@ impl<T: Trait> Module<T> {
|
||||
// populate environment.
|
||||
<Number<T>>::put(number);
|
||||
<ParentHash<T>>::put(parent_hash);
|
||||
<BlockHash<T>>::insert(*number - One::one(), parent_hash);
|
||||
<ExtrinsicsRoot<T>>::put(txs_root);
|
||||
<RandomSeed<T>>::put(Self::calculate_random());
|
||||
<ExtrinsicIndex<T>>::put(0);
|
||||
@@ -119,21 +120,6 @@ impl<T: Trait> Module<T> {
|
||||
<Digest<T>>::put(l);
|
||||
}
|
||||
|
||||
/// Records a particular block number and hash combination.
|
||||
pub fn record_block_hash<H: traits::Header<Number = T::BlockNumber, Hash = T::Hash>>(header: &H) {
|
||||
// store the header hash in storage; we can't do it before otherwise there would be a
|
||||
// cyclic dependency.
|
||||
let h = T::Hashing::hash_of(header);
|
||||
<BlockHash<T>>::insert(header.number(), &h);
|
||||
|
||||
Self::initialise(&(*header.number() + One::one()), &h, &Default::default());
|
||||
}
|
||||
|
||||
/// Initializes the state following the determination of the genesis block.
|
||||
pub fn initialise_genesis_state<H: traits::Header<Number = T::BlockNumber, Hash = T::Hash>>(header: &H) {
|
||||
Self::record_block_hash(header);
|
||||
}
|
||||
|
||||
/// Calculate the current block's random seed.
|
||||
fn calculate_random() -> T::Hash {
|
||||
assert!(Self::block_number() > Zero::zero(), "Block number may never be zero");
|
||||
|
||||
Reference in New Issue
Block a user