Struct nakamoto_p2p::protocol::spvmgr::SpvManager [−][src]
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]
&mut self,
from: &PeerId,
msg: CFHeaders,
tree: &T,
time: LocalTime
) -> Result<Height, Error>
Handle a cfheaders
message from a peer.
pub fn received_getcfheaders<T: BlockTree>(
&mut self,
from: &PeerId,
msg: GetCFHeaders,
tree: &T
) -> Result<(), Error>
[src]
&mut self,
from: &PeerId,
msg: GetCFHeaders,
tree: &T
) -> Result<(), Error>
Handle a getcfheaders
message from a peer.
pub fn received_cfilter<T: BlockTree>(
&mut self,
from: &PeerId,
msg: CFilter,
tree: &T
) -> Result<(), Error>
[src]
&mut self,
from: &PeerId,
msg: CFilter,
tree: &T
) -> Result<(), Error>
Handle a cfilter
message.
pub fn received_getcfilters<T: BlockTree>(
&mut self,
_addr: &PeerId,
msg: GetCFilters,
_tree: &T
)
[src]
&mut self,
_addr: &PeerId,
msg: GetCFilters,
_tree: &T
)
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]
&mut self,
id: PeerId,
height: Height,
services: ServiceFlags,
link: Link,
clock: &impl Clock,
tree: &T
)
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]
&mut self,
range: Range<Height>,
tree: &T,
time: LocalTime
) -> Option<(PeerId, Height, BlockHash)>
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]
F: Send,
U: Send,
impl<F, U> !Sync for SpvManager<F, U>
[src]
impl<F, U> Unpin for SpvManager<F, U> where
F: Unpin,
U: Unpin,
[src]
F: Unpin,
U: Unpin,
impl<F, U> UnwindSafe for SpvManager<F, U> where
F: UnwindSafe,
U: UnwindSafe,
[src]
F: UnwindSafe,
U: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,