mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Consensus message buffering and more (#114)
* CLI options and keystore integration * Replace multiqueue with future::mpsc * BFT gossip * Revert to app_dirs * generate_from_seed commented * Refactor event loop * Start consensus by timer * Message buffering * Minor fixes * Work around duty-roster issue. * some more minor fixes * fix compilation * more consistent formatting * make bft input stream never conclude * Minor fixes * add timestamp module to executive * more cleanups and logging * Fixed message propagation
This commit is contained in:
committed by
Gav Wood
parent
633b9f4c0b
commit
b3dd4e74fd
@@ -50,6 +50,13 @@ use runtime_support::StorageValue;
|
||||
use primitives::traits::{self, Header, Zero, One, Checkable, Applyable, CheckEqual, Executable, MakePayment};
|
||||
use codec::Slicable;
|
||||
|
||||
/// Compute the extrinsics root of a list of extrinsics.
|
||||
pub fn extrinsics_root<H: Hashing, E: Slicable>(extrinsics: &[E]) -> H::Output {
|
||||
let xts = extrinsics.iter().map(Slicable::encode).collect::<Vec<_>>();
|
||||
let xts = xts.iter().map(Vec::as_slice).collect::<Vec<_>>();
|
||||
H::enumerated_trie_root(&xts)
|
||||
}
|
||||
|
||||
pub struct Executive<
|
||||
System,
|
||||
Block,
|
||||
@@ -82,11 +89,9 @@ impl<
|
||||
);
|
||||
|
||||
// check transaction trie root represents the transactions.
|
||||
let txs = block.extrinsics().iter().map(Slicable::encode).collect::<Vec<_>>();
|
||||
let txs = txs.iter().map(Vec::as_slice).collect::<Vec<_>>();
|
||||
let txs_root = System::Hashing::enumerated_trie_root(&txs);
|
||||
header.extrinsics_root().check_equal(&txs_root);
|
||||
assert!(header.extrinsics_root() == &txs_root, "Transaction trie root must be valid.");
|
||||
let xts_root = extrinsics_root::<System::Hashing, _>(&block.extrinsics());
|
||||
header.extrinsics_root().check_equal(&xts_root);
|
||||
assert!(header.extrinsics_root() == &xts_root, "Transaction trie root must be valid.");
|
||||
}
|
||||
|
||||
/// Actually execute all transitioning for `block`.
|
||||
@@ -164,7 +169,7 @@ impl<
|
||||
fn post_finalise(header: &System::Header) {
|
||||
// store the header hash in storage; we can't do it before otherwise there would be a
|
||||
// cyclic dependency.
|
||||
<system::Module<System>>::record_block_hash(header)
|
||||
<system::Module<System>>::record_block_hash(header);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user