[][src]Struct grin_p2p::Peer

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

Fields

info: PeerInfo

Methods

impl Peer[src]

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

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

pub fn start(&mut self, conn: TcpStream)[src]

Main peer loop listening for messages and forwarding to the rest of the system.

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

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

Whether this peer is still 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)[src]

Send the ban reason before banning

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

Sends the provided block to the remote peer. The request may be dropped if the remote peer is known to already have the block.

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) -> Result<(), Error>[src]

Sends a request for a specific block by hash

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, closing its connection

Auto Trait Implementations

impl Send for Peer

impl Sync for Peer

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> UnsafeAny for T where
    T: Any

impl<T> Erased for T

impl<T> Same for T

type Output = T

Should always be Self

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