mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 11:01:01 +00:00
Use Pin<Box<>> for collation future (#1792)
This commit is contained in:
@@ -407,7 +407,7 @@ mod tests {
|
||||
Arc::new(CollationGenerationConfig {
|
||||
key: CollatorPair::generate().0,
|
||||
collator: Box::new(|_: Hash, _vd: &ValidationData| {
|
||||
Box::new(TestCollator)
|
||||
TestCollator.boxed()
|
||||
}),
|
||||
para_id: para_id.into(),
|
||||
})
|
||||
|
||||
@@ -1876,7 +1876,7 @@ mod tests {
|
||||
fn test_collator_generation_msg() -> CollationGenerationMessage {
|
||||
CollationGenerationMessage::Initialize(CollationGenerationConfig {
|
||||
key: CollatorPair::generate().0,
|
||||
collator: Box::new(|_, _| Box::new(TestCollator)),
|
||||
collator: Box::new(|_, _| TestCollator.boxed()),
|
||||
para_id: Default::default(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ use polkadot_statement_table::{
|
||||
},
|
||||
v1::Misbehavior as TableMisbehavior,
|
||||
};
|
||||
use std::pin::Pin;
|
||||
|
||||
pub use sp_core::traits::SpawnNamed;
|
||||
|
||||
@@ -289,7 +290,7 @@ pub struct CollationGenerationConfig {
|
||||
/// Will be called with the hash of the relay chain block the parachain
|
||||
/// block should be build on and the [`ValidationData`] that provides
|
||||
/// information about the state of the parachain on the relay chain.
|
||||
pub collator: Box<dyn Fn(Hash, &ValidationData) -> Box<dyn Future<Output = Option<Collation>> + Unpin + Send> + Send + Sync>,
|
||||
pub collator: Box<dyn Fn(Hash, &ValidationData) -> Pin<Box<dyn Future<Output = Option<Collation>> + Send>> + Send + Sync>,
|
||||
/// The parachain that this collator collates for
|
||||
pub para_id: ParaId,
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ struct CollationGenerationConfig {
|
||||
/// Collate will be called with the relay chain hash the parachain should build
|
||||
/// a block on and the `ValidationData` that provides information about the state
|
||||
/// of the parachain on the relay chain.
|
||||
collator: Box<dyn Fn(Hash, &ValidationData) -> Box<dyn Future<Output = Option<Collation>>>>
|
||||
collator: Box<dyn Fn(Hash, &ValidationData) -> Pin<Box<dyn Future<Output = Option<Collation>>>>>
|
||||
para_id: ParaId,
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user