|
23 | 23 | use codec::Encode; |
24 | 24 | use frame_system_rpc_runtime_api::AccountNonceApi; |
25 | 25 | use futures::prelude::*; |
| 26 | +use jsonrpsee::ws_server::RandomStringIdProvider; |
26 | 27 | use node_executor::ExecutorDispatch; |
27 | 28 | use node_primitives::Block; |
28 | 29 | use node_runtime::RuntimeApi; |
29 | 30 | use sc_client_api::{BlockBackend, ExecutorProvider}; |
30 | 31 | use sc_consensus_babe::{self, SlotProportion}; |
31 | 32 | use sc_executor::NativeElseWasmExecutor; |
32 | 33 | use sc_network::{Event, NetworkService}; |
33 | | -use sc_service::{config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager}; |
| 34 | +use sc_service::{ |
| 35 | + config::Configuration, error::Error as ServiceError, RpcHandlers, RpcIdProvider, TaskManager, |
| 36 | +}; |
34 | 37 | use sc_telemetry::{Telemetry, TelemetryWorker}; |
35 | 38 | use sp_api::ProvideRuntimeApi; |
36 | 39 | use sp_core::crypto::Pair; |
@@ -308,6 +311,7 @@ pub struct NewFullBase { |
308 | 311 | /// Creates a full service from the configuration. |
309 | 312 | pub fn new_full_base( |
310 | 313 | mut config: Configuration, |
| 314 | + rpc_id_provider: impl RpcIdProvider + 'static, |
311 | 315 | with_startup_data: impl FnOnce( |
312 | 316 | &sc_consensus_babe::BabeBlockImport<Block, FullClient, FullGrandpaBlockImport>, |
313 | 317 | &sc_consensus_babe::BabeLink<Block>, |
@@ -380,6 +384,7 @@ pub fn new_full_base( |
380 | 384 | task_manager: &mut task_manager, |
381 | 385 | system_rpc_tx, |
382 | 386 | telemetry: telemetry.as_mut(), |
| 387 | + rpc_id_provider, |
383 | 388 | })?; |
384 | 389 |
|
385 | 390 | let (block_import, grandpa_link, babe_link) = import_setup; |
@@ -530,13 +535,15 @@ pub fn new_full_base( |
530 | 535 |
|
531 | 536 | /// Builds a new service for a full client. |
532 | 537 | pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> { |
533 | | - new_full_base(config, |_, _| ()).map(|NewFullBase { task_manager, .. }| task_manager) |
| 538 | + new_full_base(config, RandomStringIdProvider::new(16), |_, _| ()) |
| 539 | + .map(|NewFullBase { task_manager, .. }| task_manager) |
534 | 540 | } |
535 | 541 |
|
536 | 542 | #[cfg(test)] |
537 | 543 | mod tests { |
538 | 544 | use crate::service::{new_full_base, NewFullBase}; |
539 | 545 | use codec::Encode; |
| 546 | + use jsonrpsee::ws_server::RandomStringIdProvider; |
540 | 547 | use node_primitives::{Block, DigestItem, Signature}; |
541 | 548 | use node_runtime::{ |
542 | 549 | constants::{currency::CENTS, time::SLOT_DURATION}, |
@@ -597,6 +604,7 @@ mod tests { |
597 | 604 | let NewFullBase { task_manager, client, network, transaction_pool, .. } = |
598 | 605 | new_full_base( |
599 | 606 | config, |
| 607 | + RandomStringIdProvider::new(16), |
600 | 608 | |block_import: &sc_consensus_babe::BabeBlockImport<Block, _, _>, |
601 | 609 | babe_link: &sc_consensus_babe::BabeLink<Block>| { |
602 | 610 | setup_handles = Some((block_import.clone(), babe_link.clone())); |
@@ -771,7 +779,7 @@ mod tests { |
771 | 779 | crate::chain_spec::tests::integration_test_config_with_two_authorities(), |
772 | 780 | |config| { |
773 | 781 | let NewFullBase { task_manager, client, network, transaction_pool, .. } = |
774 | | - new_full_base(config, |_, _| ())?; |
| 782 | + new_full_base(config, RandomStringIdProvider::new(16), |_, _| ())?; |
775 | 783 | Ok(sc_service_test::TestNetComponents::new( |
776 | 784 | task_manager, |
777 | 785 | client, |
|
0 commit comments