[][src]Struct grin_p2p::Peer

pub struct Peer {
    pub info: PeerInfo,
    // some fields omitted
}

Fields

info: PeerInfo

Implementations

impl Peer[src]

pub fn accept(
    conn: TcpStream,
    capab: Capabilities,
    total_difficulty: Difficulty,
    hs: &Handshake,
    adapter: Arc<dyn NetAdapter>
) -> Result<Peer, Error>
[src]

pub fn connect(
    conn: TcpStream,
    capab: Capabilities,
    total_difficulty: Difficulty,
    self_addr: PeerAddr,
    hs: &Handshake,
    adapter: Arc<dyn NetAdapter>
) -> Result<Peer, Error>
[src]

pub fn is_denied(config: &P2PConfig, peer_addr: PeerAddr) -> bool[src]

pub fn is_connected(&self) -> bool[src]

Whether this peer is currently connected.

pub fn is_banned(&self) -> bool[src]

Whether this peer has been banned.

pub fn is_stuck(&self) -> (bool, Difficulty)[src]

Whether this peer is stuck on sync.

pub fn is_abusive(&self) -> bool[src]

Whether the peer is considered abusive, mostly for spammy nodes

pub fn last_min_sent_bytes(&self) -> Option<u64>[src]

Number of bytes sent to the peer

pub fn last_min_received_bytes(&self) -> Option<u64>[src]

Number of bytes received from the peer

pub fn last_min_message_counts(&self) -> Option<(u64, u64)>[src]

pub fn set_banned(&self)[src]

Set this peer status to banned

pub fn send_ping(
    &self,
    total_difficulty: Difficulty,
    height: u64
) -> Result<(), Error>
[src]

Send a ping to the remote peer, providing our local difficulty and height

pub fn send_ban_reason(&self, ban_reason: ReasonForBan) -> Result<(), Error>[src]

Send the ban reason before banning

pub fn send_compact_block(&self, b: &CompactBlock) -> Result<bool, Error>[src]

pub fn send_header(&self, bh: &BlockHeader) -> Result<bool, Error>[src]

pub fn send_tx_kernel_hash(&self, h: Hash) -> Result<bool, Error>[src]

pub fn send_transaction(&self, tx: &Transaction) -> Result<bool, Error>[src]

Sends the provided transaction to the remote peer. The request may be dropped if the remote peer is known to already have the transaction. We support broadcast of lightweight tx kernel hash so track known txs by kernel hash.

pub fn send_stem_transaction(&self, tx: &Transaction) -> Result<(), Error>[src]

Sends the provided stem transaction to the remote peer. Note: tracking adapter is ignored for stem transactions (while under embargo).

pub fn send_header_request(&self, locator: Vec<Hash>) -> Result<(), Error>[src]

Sends a request for block headers from the provided block locator

pub fn send_tx_request(&self, h: Hash) -> Result<(), Error>[src]

pub fn send_block_request(&self, h: Hash, opts: Options) -> Result<(), Error>[src]

Sends a request for a specific block by hash. Takes opts so we can track if this request was due to our node syncing or otherwise.

pub fn send_compact_block_request(&self, h: Hash) -> Result<(), Error>[src]

Sends a request for a specific compact block by hash

pub fn send_peer_request(&self, capab: Capabilities) -> Result<(), Error>[src]

pub fn send_txhashset_request(
    &self,
    height: u64,
    hash: Hash
) -> Result<(), Error>
[src]

pub fn stop(&self)[src]

Stops the peer

pub fn wait(&self)[src]

Waits until the peer's thread exit

Trait Implementations

impl Debug for Peer[src]

Auto Trait Implementations

impl !RefUnwindSafe for Peer

impl Send for Peer

impl Sync for Peer

impl Unpin for Peer

impl !UnwindSafe for Peer

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> DebugAny for T where
    T: Any + Debug

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

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

impl<T> SafeBorrow<T> for T where
    T: ?Sized

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

impl<T> UnsafeAny for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,