mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 21:01:05 +00:00
babe: pass epoch data via intermediates (#4807)
* babe: pass epoch data via intermediates * Switch to use Box<dyn Any> for intermediates * Set intermediate.epoch to be Option * Fix proposer should put out an empty intermediate * Remove unnecessary encode/decode * Add EpochData to block_import_params in slot worker * Fix aura compile * Fix integration test
This commit is contained in:
@@ -565,8 +565,18 @@ fn propose_and_import_block<Transaction>(
|
||||
],
|
||||
};
|
||||
|
||||
let parent_hash = parent.hash();
|
||||
|
||||
let mut block = futures::executor::block_on(proposer.propose_with(pre_digest)).unwrap().block;
|
||||
|
||||
let epoch = proposer_factory.epoch_changes.lock().epoch_for_child_of(
|
||||
descendent_query(&*proposer_factory.client),
|
||||
&parent_hash,
|
||||
*parent.number(),
|
||||
slot_number,
|
||||
|slot| proposer_factory.config.genesis_epoch(slot)
|
||||
).unwrap().unwrap();
|
||||
|
||||
let seal = {
|
||||
// sign the pre-sealed hash of the block and then
|
||||
// add it to a digest item.
|
||||
@@ -593,7 +603,14 @@ fn propose_and_import_block<Transaction>(
|
||||
storage_changes: None,
|
||||
finalized: false,
|
||||
auxiliary: Vec::new(),
|
||||
intermediates: Default::default(),
|
||||
intermediates: {
|
||||
let mut intermediates = HashMap::new();
|
||||
intermediates.insert(
|
||||
Cow::from(INTERMEDIATE_KEY),
|
||||
Box::new(BabeIntermediate { epoch }) as Box<dyn Any>,
|
||||
);
|
||||
intermediates
|
||||
},
|
||||
fork_choice: Some(ForkChoiceStrategy::LongestChain),
|
||||
allow_missing_state: false,
|
||||
import_existing: false,
|
||||
|
||||
Reference in New Issue
Block a user