mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Unify ChainSync actions under one enum (follow-up) (#2317)
Get rid of public `ChainSync::..._requests()` functions and return all requests as actions. --------- Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
//! `ChainSync`-related service code
|
||||
//! `SyncingEngine`-related service code
|
||||
|
||||
pub mod chain_sync;
|
||||
pub mod mock;
|
||||
pub mod network;
|
||||
pub mod syncing_service;
|
||||
|
||||
+3
-3
@@ -34,7 +34,7 @@ use std::{
|
||||
},
|
||||
};
|
||||
|
||||
/// Commands send to `ChainSync`
|
||||
/// Commands send to `SyncingEngine`
|
||||
pub enum ToServiceCommand<B: BlockT> {
|
||||
SetSyncForkRequest(Vec<PeerId>, B::Hash, NumberFor<B>),
|
||||
RequestJustification(B::Hash, NumberFor<B>),
|
||||
@@ -63,7 +63,7 @@ pub enum ToServiceCommand<B: BlockT> {
|
||||
// },
|
||||
}
|
||||
|
||||
/// Handle for communicating with `ChainSync` asynchronously
|
||||
/// Handle for communicating with `SyncingEngine` asynchronously
|
||||
#[derive(Clone)]
|
||||
pub struct SyncingService<B: BlockT> {
|
||||
tx: TracingUnboundedSender<ToServiceCommand<B>>,
|
||||
@@ -148,7 +148,7 @@ impl<B: BlockT> SyncingService<B> {
|
||||
|
||||
/// Get sync status
|
||||
///
|
||||
/// Returns an error if `ChainSync` has terminated.
|
||||
/// Returns an error if `SyncingEngine` has terminated.
|
||||
pub async fn status(&self) -> Result<SyncStatus<B>, ()> {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
let _ = self.tx.unbounded_send(ToServiceCommand::Status(tx));
|
||||
Reference in New Issue
Block a user