mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-29 22:51:03 +00:00
Refactor BlockImportParams to be non_exhaustive (#4936)
* Refactor BlockImportParams to be non_exhaustive * Fix cargo check compile
This commit is contained in:
@@ -89,20 +89,11 @@ impl<B: BlockT> Verifier<B> for ManualSealVerifier {
|
||||
justification: Option<Justification>,
|
||||
body: Option<Vec<B::Extrinsic>>,
|
||||
) -> Result<(BlockImportParams<B, ()>, Option<Vec<(CacheKeyId, Vec<u8>)>>), String> {
|
||||
let import_params = BlockImportParams {
|
||||
origin,
|
||||
header,
|
||||
justification,
|
||||
post_digests: Vec::new(),
|
||||
body,
|
||||
storage_changes: None,
|
||||
finalized: true,
|
||||
auxiliary: Vec::new(),
|
||||
intermediates: HashMap::new(),
|
||||
fork_choice: Some(ForkChoiceStrategy::LongestChain),
|
||||
allow_missing_state: false,
|
||||
import_existing: false,
|
||||
};
|
||||
let mut import_params = BlockImportParams::new(origin, header);
|
||||
import_params.justification = justification;
|
||||
import_params.body = body;
|
||||
import_params.finalized = true;
|
||||
import_params.fork_choice = Some(ForkChoiceStrategy::LongestChain);
|
||||
|
||||
Ok((import_params, None))
|
||||
}
|
||||
|
||||
@@ -121,20 +121,10 @@ pub async fn seal_new_block<B, SC, CB, E, T, P>(
|
||||
}
|
||||
|
||||
let (header, body) = proposal.block.deconstruct();
|
||||
let params = BlockImportParams {
|
||||
origin: BlockOrigin::Own,
|
||||
header: header.clone(),
|
||||
justification: None,
|
||||
post_digests: Vec::new(),
|
||||
body: Some(body),
|
||||
finalized: finalize,
|
||||
storage_changes: None,
|
||||
auxiliary: Vec::new(),
|
||||
intermediates: HashMap::new(),
|
||||
fork_choice: Some(ForkChoiceStrategy::LongestChain),
|
||||
allow_missing_state: false,
|
||||
import_existing: false,
|
||||
};
|
||||
let mut params = BlockImportParams::new(BlockOrigin::Own, header.clone());
|
||||
params.body = Some(body);
|
||||
params.finalized = finalize;
|
||||
params.fork_choice = Some(ForkChoiceStrategy::LongestChain);
|
||||
|
||||
match block_import.import_block(params, HashMap::new())? {
|
||||
ImportResult::Imported(aux) => {
|
||||
|
||||
Reference in New Issue
Block a user