Adds support for returning a custom header from validate_block (#825)

* Adds support for returning a custom header from `validate_block`

This adds support for returning a custom header from `validate_block`. Before this, we always
returned the header of the block that was validated (and still do it by default). However, after
this pr it is possible to set a custom header or better custom head data that will be returned
instead from `validate_block`. This can be for example when a chain wants to fork.

* FMT
This commit is contained in:
Bastian Köcher
2021-12-03 12:49:13 +01:00
committed by GitHub
parent 70ea98995a
commit 32a86d8ef4
8 changed files with 156 additions and 17 deletions
+4 -1
View File
@@ -122,7 +122,7 @@ fn genesis_config() -> GenesisConfig {
pub fn generate_extrinsic(
client: &Client,
origin: sp_keyring::AccountKeyring,
function: Call,
function: impl Into<Call>,
) -> UncheckedExtrinsic {
let current_block_hash = client.info().best_hash;
let current_block = client.info().best_number.saturated_into();
@@ -139,6 +139,9 @@ pub fn generate_extrinsic(
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
);
let function = function.into();
let raw_payload = SignedPayload::from_raw(
function.clone(),
extra.clone(),