Skip to content

Commit aa010dc

Browse files
authored
Revert "fix(minimal): pre-seal a first block to trigger maintain (#92… (#9423)
# Description This PR reverts #9207 after @michalkucharczyk's proper fix in #9338. ## Integration N/A ## Review Notes N/A
1 parent 13bc266 commit aa010dc

File tree

2 files changed

+5
-31
lines changed

2 files changed

+5
-31
lines changed

templates/minimal/node/src/command.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,10 @@ pub fn run() -> sc_cli::Result<()> {
125125
match config.network.network_backend {
126126
sc_network::config::NetworkBackendType::Libp2p =>
127127
service::new_full::<sc_network::NetworkWorker<_, _>>(config, cli.consensus)
128-
.await
129128
.map_err(sc_cli::Error::Service),
130129
sc_network::config::NetworkBackendType::Litep2p => service::new_full::<
131130
sc_network::Litep2pNetworkBackend,
132131
>(config, cli.consensus)
133-
.await
134132
.map_err(sc_cli::Error::Service),
135133
}
136134
})

templates/minimal/node/src/service.rs

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use futures::FutureExt;
2020
use minimal_template_runtime::{interface::OpaqueBlock as Block, RuntimeApi};
2121
use polkadot_sdk::{
2222
sc_client_api::backend::Backend,
23-
sc_consensus_manual_seal::{seal_block, SealBlockParams},
2423
sc_executor::WasmExecutor,
2524
sc_service::{error::Error as ServiceError, Configuration, TaskManager},
2625
sc_telemetry::{Telemetry, TelemetryWorker},
@@ -108,7 +107,7 @@ pub fn new_partial(config: &Configuration) -> Result<Service, ServiceError> {
108107
}
109108

110109
/// Builds a new service for a full client.
111-
pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Hash>>(
110+
pub fn new_full<Network: sc_network::NetworkBackend<Block, <Block as BlockT>::Hash>>(
112111
config: Configuration,
113112
consensus: Consensus,
114113
) -> Result<TaskManager, ServiceError> {
@@ -197,7 +196,7 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
197196
telemetry: telemetry.as_mut(),
198197
})?;
199198

200-
let mut proposer = sc_basic_authorship::ProposerFactory::new(
199+
let proposer = sc_basic_authorship::ProposerFactory::new(
201200
task_manager.spawn_handle(),
202201
client.clone(),
203202
transaction_pool.clone(),
@@ -207,39 +206,16 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
207206

208207
match consensus {
209208
Consensus::InstantSeal => {
210-
// Seal a first block to trigger fork-aware txpool `maintain`, and create a first
211-
// view. This is necessary so that sending txs will not keep them in mempool for
212-
// an undeterminated amount of time.
213-
//
214-
// If single state txpool is used there's no issue if we're sealing a first block in
215-
// advance.
216-
let create_inherent_data_providers =
217-
|_, ()| async move { Ok(sp_timestamp::InherentDataProvider::from_system_time()) };
218-
let mut client_mut = client.clone();
219-
let consensus_data_provider = None;
220-
let seal_params = SealBlockParams {
221-
sender: None,
222-
parent_hash: None,
223-
finalize: true,
224-
create_empty: true,
225-
env: &mut proposer,
226-
select_chain: &select_chain,
227-
block_import: &mut client_mut,
228-
consensus_data_provider,
229-
pool: transaction_pool.clone(),
230-
client: client.clone(),
231-
create_inherent_data_providers: &create_inherent_data_providers,
232-
};
233-
seal_block(seal_params).await;
234-
235209
let params = sc_consensus_manual_seal::InstantSealParams {
236210
block_import: client.clone(),
237211
env: proposer,
238212
client,
239213
pool: transaction_pool,
240214
select_chain,
241215
consensus_data_provider: None,
242-
create_inherent_data_providers,
216+
create_inherent_data_providers: move |_, ()| async move {
217+
Ok(sp_timestamp::InherentDataProvider::from_system_time())
218+
},
243219
};
244220

245221
let authorship_future = sc_consensus_manual_seal::run_instant_seal(params);

0 commit comments

Comments
 (0)