Struct ethsync::light_sync::LightSync
[−]
[src]
pub struct LightSync<L: LightChainClient> { /* fields omitted */ }
Light client synchronization manager. See module docs for more details.
Methods
impl<L: LightChainClient> LightSync<L>
[src]
fn new(client: Arc<L>) -> Result<Self, Error>
Create a new instance of LightSync
.
This won't do anything until registered as a handler so it can act on events.
Trait Implementations
impl<L: LightChainClient> Handler for LightSync<L>
[src]
fn on_connect(&self,
ctx: &EventContext,
status: &Status,
capabilities: &Capabilities)
ctx: &EventContext,
status: &Status,
capabilities: &Capabilities)
Called when a peer connects.
fn on_disconnect(&self, ctx: &EventContext, unfulfilled: &[ReqId])
Called when a peer disconnects, with a list of unfulfilled request IDs as of yet. Read more
fn on_announcement(&self, ctx: &EventContext, announcement: &Announcement)
Called when a peer makes an announcement.
fn on_block_headers(&self, ctx: &EventContext, req_id: ReqId, headers: &[Bytes])
Called when a peer responds with block headers.
fn tick(&self, ctx: &BasicContext)
Called to "tick" the handler periodically.
fn on_transactions(&self, _ctx: &EventContext, _relay: &[UnverifiedTransaction])
Called when a peer requests relay of some transactions.
fn on_block_bodies(&self,
_ctx: &EventContext,
_req_id: ReqId,
_bodies: &[Vec<u8>])
_ctx: &EventContext,
_req_id: ReqId,
_bodies: &[Vec<u8>])
Called when a peer responds with block bodies.
fn on_receipts(&self,
_ctx: &EventContext,
_req_id: ReqId,
_receipts: &[Vec<Receipt>])
_ctx: &EventContext,
_req_id: ReqId,
_receipts: &[Vec<Receipt>])
Called when a peer responds with block receipts.
fn on_state_proofs(&self,
_ctx: &EventContext,
_req_id: ReqId,
_proofs: &[Vec<Vec<u8>>])
_ctx: &EventContext,
_req_id: ReqId,
_proofs: &[Vec<Vec<u8>>])
Called when a peer responds with state proofs. Each proof should be a series of trie nodes in ascending order by distance from the root. Read more
fn on_code(&self, _ctx: &EventContext, _req_id: ReqId, _codes: &[Vec<u8>])
Called when a peer responds with contract code.
fn on_header_proofs(&self,
_ctx: &EventContext,
_req_id: ReqId,
_proofs: &[(Vec<u8>, Vec<Vec<u8>>)])
_ctx: &EventContext,
_req_id: ReqId,
_proofs: &[(Vec<u8>, Vec<Vec<u8>>)])
Called when a peer responds with header proofs. Each proof should be a block header coupled with a series of trie nodes is ascending order by distance from the root. Read more
fn on_abort(&self)
Called on abort. This signals to handlers that they should clean up and ignore peers. Read more