Struct nakamoto_p2p::protocol::spvmgr::SpvManager[][src]

pub struct SpvManager<F, U> { /* fields omitted */ }

A compact block filter manager.

Implementations

impl<F: Filters, U: SyncFilters + Events + SetTimeout> SpvManager<F, U>[src]

pub fn new(config: Config, rng: Rng, filters: F, upstream: U) -> Self[src]

Create a new filter manager.

pub fn initialize<T: BlockTree>(&mut self, now: LocalTime, tree: &T)[src]

Initialize the spv manager. Should only be called once.

pub fn idle<T: BlockTree>(&mut self, now: LocalTime, tree: &T)[src]

Called periodically. Triggers syncing if necessary.

pub fn received_timeout<T: BlockTree>(&mut self, now: LocalTime, tree: &T)[src]

A timeout was received.

pub fn rollback(&mut self, n: usize) -> Result<(), Error>[src]

Rollback filter header chain by a given number of headers.

pub fn get_cfilters<T: BlockTree>(&mut self, range: Range<Height>, tree: &T)[src]

Send a getcfilters message to a random peer.

Panics if there are no peers available.

pub fn received_cfheaders<T: BlockTree>(
    &mut self,
    from: &PeerId,
    msg: CFHeaders,
    tree: &T,
    time: LocalTime
) -> Result<Height, Error>
[src]

Handle a cfheaders message from a peer.

pub fn received_getcfheaders<T: BlockTree>(
    &mut self,
    from: &PeerId,
    msg: GetCFHeaders,
    tree: &T
) -> Result<(), Error>
[src]

Handle a getcfheaders message from a peer.

pub fn received_cfilter<T: BlockTree>(
    &mut self,
    from: &PeerId,
    msg: CFilter,
    tree: &T
) -> Result<(), Error>
[src]

Handle a cfilter message.

pub fn received_getcfilters<T: BlockTree>(
    &mut self,
    _addr: &PeerId,
    msg: GetCFilters,
    _tree: &T
)
[src]

Handle getcfilters message.

pub fn peer_disconnected(&mut self, id: &PeerId)[src]

Called when a peer disconnected.

pub fn peer_negotiated<T: BlockTree>(
    &mut self,
    id: PeerId,
    height: Height,
    services: ServiceFlags,
    link: Link,
    clock: &impl Clock,
    tree: &T
)
[src]

Called when a new peer was negotiated.

pub fn send_getcfheaders<T: BlockTree>(
    &mut self,
    range: Range<Height>,
    tree: &T,
    time: LocalTime
) -> Option<(PeerId, Height, BlockHash)>
[src]

Send a getcfheaders message to a random peer.

pub fn sync<T: BlockTree>(&mut self, tree: &T, time: LocalTime)[src]

Attempt to sync the filter header chain.

Trait Implementations

impl<F: Debug, U: Debug> Debug for SpvManager<F, U>[src]

Auto Trait Implementations

impl<F, U> !RefUnwindSafe for SpvManager<F, U>[src]

impl<F, U> Send for SpvManager<F, U> where
    F: Send,
    U: Send
[src]

impl<F, U> !Sync for SpvManager<F, U>[src]

impl<F, U> Unpin for SpvManager<F, U> where
    F: Unpin,
    U: Unpin
[src]

impl<F, U> UnwindSafe for SpvManager<F, U> where
    F: UnwindSafe,
    U: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.