[−][src]Struct grin_p2p::Peer
Fields
info: PeerInfo
Methods
impl Peer
[src]
impl Peer
pub fn accept(
conn: &mut TcpStream,
capab: Capabilities,
total_difficulty: Difficulty,
hs: &Handshake,
adapter: Arc<dyn NetAdapter>
) -> Result<Peer, Error>
[src]
pub fn accept(
conn: &mut TcpStream,
capab: Capabilities,
total_difficulty: Difficulty,
hs: &Handshake,
adapter: Arc<dyn NetAdapter>
) -> Result<Peer, Error>
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 connect(
conn: &mut TcpStream,
capab: Capabilities,
total_difficulty: Difficulty,
self_addr: SocketAddr,
hs: &Handshake,
na: Arc<dyn NetAdapter>
) -> Result<Peer, Error>
pub fn start(&mut self, conn: TcpStream)
[src]
pub fn start(&mut self, conn: TcpStream)
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_denied(config: &P2PConfig, peer_addr: &SocketAddr) -> bool
pub fn is_connected(&self) -> bool
[src]
pub fn is_connected(&self) -> bool
Whether this peer is still connected.
pub fn is_banned(&self) -> bool
[src]
pub fn is_banned(&self) -> bool
Whether this peer has been banned.
pub fn is_stuck(&self) -> (bool, Difficulty)
[src]
pub fn is_stuck(&self) -> (bool, Difficulty)
Whether this peer is stuck on sync.
pub fn is_abusive(&self) -> bool
[src]
pub fn is_abusive(&self) -> bool
Whether the peer is considered abusive, mostly for spammy nodes
pub fn last_min_sent_bytes(&self) -> Option<u64>
[src]
pub fn last_min_sent_bytes(&self) -> Option<u64>
Number of bytes sent to the peer
pub fn last_min_received_bytes(&self) -> Option<u64>
[src]
pub fn last_min_received_bytes(&self) -> Option<u64>
Number of bytes received from the peer
pub fn last_min_message_counts(&self) -> Option<(u64, u64)>
[src]
pub fn last_min_message_counts(&self) -> Option<(u64, u64)>
pub fn set_banned(&self)
[src]
pub fn set_banned(&self)
Set this peer status to banned
pub fn send_ping(
&self,
total_difficulty: Difficulty,
height: u64
) -> Result<(), Error>
[src]
pub fn send_ping(
&self,
total_difficulty: Difficulty,
height: u64
) -> Result<(), Error>
Send a ping to the remote peer, providing our local difficulty and height
pub fn send_ban_reason(&self, ban_reason: ReasonForBan)
[src]
pub fn send_ban_reason(&self, ban_reason: ReasonForBan)
Send the ban reason before banning
pub fn send_block(&self, b: &Block) -> Result<bool, Error>
[src]
pub fn send_block(&self, b: &Block) -> Result<bool, Error>
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_compact_block(&self, b: &CompactBlock) -> Result<bool, Error>
pub fn send_header(&self, bh: &BlockHeader) -> Result<bool, Error>
[src]
pub fn send_header(&self, bh: &BlockHeader) -> Result<bool, Error>
pub fn send_tx_kernel_hash(&self, h: Hash) -> Result<bool, Error>
[src]
pub fn send_tx_kernel_hash(&self, h: Hash) -> Result<bool, Error>
pub fn send_transaction(&self, tx: &Transaction) -> Result<bool, Error>
[src]
pub fn send_transaction(&self, tx: &Transaction) -> Result<bool, Error>
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]
pub fn send_stem_transaction(&self, tx: &Transaction) -> Result<(), Error>
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]
pub fn send_header_request(&self, locator: Vec<Hash>) -> Result<(), Error>
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_tx_request(&self, h: Hash) -> Result<(), Error>
pub fn send_block_request(&self, h: Hash) -> Result<(), Error>
[src]
pub fn send_block_request(&self, h: Hash) -> Result<(), Error>
Sends a request for a specific block by hash
pub fn send_compact_block_request(&self, h: Hash) -> Result<(), Error>
[src]
pub fn send_compact_block_request(&self, h: Hash) -> Result<(), Error>
Sends a request for a specific compact block by hash
pub fn send_peer_request(&self, capab: Capabilities) -> Result<(), Error>
[src]
pub fn send_peer_request(&self, capab: Capabilities) -> Result<(), Error>
pub fn send_txhashset_request(
&self,
height: u64,
hash: Hash
) -> Result<(), Error>
[src]
pub fn send_txhashset_request(
&self,
height: u64,
hash: Hash
) -> Result<(), Error>
pub fn stop(&self)
[src]
pub fn stop(&self)
Stops the peer, closing its connection
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,
impl<T> Erased for T
impl<T> Erased for T
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self
impl<T> SafeBorrow for T where
T: ?Sized,
impl<T> SafeBorrow for T where
T: ?Sized,
fn borrow_replacement(ptr: &T) -> &T
fn borrow_replacement(ptr: &T) -> &T