mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Introduce 'intermediate_insert' method to hide implementation details (#12215)
Renaming from 'intermediate_take' to 'intermediate_remove'
This commit is contained in:
@@ -65,10 +65,7 @@ use sp_runtime::{
|
||||
traits::{Block as BlockT, Header as HeaderT},
|
||||
RuntimeString,
|
||||
};
|
||||
use std::{
|
||||
borrow::Cow, cmp::Ordering, collections::HashMap, marker::PhantomData, sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
use std::{cmp::Ordering, collections::HashMap, marker::PhantomData, sync::Arc, time::Duration};
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error<B: BlockT> {
|
||||
@@ -358,8 +355,8 @@ where
|
||||
|
||||
let inner_seal = fetch_seal::<B>(block.post_digests.last(), block.header.hash())?;
|
||||
|
||||
let intermediate =
|
||||
block.take_intermediate::<PowIntermediate<Algorithm::Difficulty>>(INTERMEDIATE_KEY)?;
|
||||
let intermediate = block
|
||||
.remove_intermediate::<PowIntermediate<Algorithm::Difficulty>>(INTERMEDIATE_KEY)?;
|
||||
|
||||
let difficulty = match intermediate.difficulty {
|
||||
Some(difficulty) => difficulty,
|
||||
@@ -455,9 +452,7 @@ where
|
||||
let intermediate = PowIntermediate::<Algorithm::Difficulty> { difficulty: None };
|
||||
block.header = checked_header;
|
||||
block.post_digests.push(seal);
|
||||
block
|
||||
.intermediates
|
||||
.insert(Cow::from(INTERMEDIATE_KEY), Box::new(intermediate) as Box<_>);
|
||||
block.insert_intermediate(INTERMEDIATE_KEY, intermediate);
|
||||
block.post_hash = Some(hash);
|
||||
|
||||
Ok((block, None))
|
||||
|
||||
@@ -32,7 +32,6 @@ use sp_runtime::{
|
||||
DigestItem,
|
||||
};
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
collections::HashMap,
|
||||
pin::Pin,
|
||||
sync::{
|
||||
@@ -212,10 +211,7 @@ where
|
||||
let intermediate = PowIntermediate::<Algorithm::Difficulty> {
|
||||
difficulty: Some(build.metadata.difficulty),
|
||||
};
|
||||
|
||||
import_block
|
||||
.intermediates
|
||||
.insert(Cow::from(INTERMEDIATE_KEY), Box::new(intermediate) as Box<_>);
|
||||
import_block.insert_intermediate(INTERMEDIATE_KEY, intermediate);
|
||||
|
||||
let header = import_block.post_header();
|
||||
let mut block_import = self.block_import.lock();
|
||||
|
||||
Reference in New Issue
Block a user