mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 03:27:58 +00:00
Introduce ChainSyncInterface (#12489)
* Introduce `ChainSyncInterface` `ChainSyncInterface` provides an asynchronous interface for other subsystems to submit calls to `ChainSync`. This allows `NetworkService` to delegate calls to `ChainSync` while still providing the same API for other subsystems (for now). This makes it possible to move the syncing code in piecemeal fashion out of `protocol.rs` as the calls are just forwarded to `ChainSync`. * Apply review comments * Fix tests
This commit is contained in:
@@ -395,4 +395,14 @@ pub trait ChainSync<Block: BlockT>: Send {
|
||||
|
||||
/// Decode implementation-specific state response.
|
||||
fn decode_state_response(&self, response: &[u8]) -> Result<OpaqueStateResponse, String>;
|
||||
|
||||
/// Advance the state of `ChainSync`
|
||||
///
|
||||
/// Internally calls [`ChainSync::poll_block_announce_validation()`] and
|
||||
/// this function should be polled until it returns [`Poll::Pending`] to
|
||||
/// consume all pending events.
|
||||
fn poll(
|
||||
&mut self,
|
||||
cx: &mut std::task::Context,
|
||||
) -> Poll<PollBlockAnnounceValidation<Block::Header>>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user