Struct snarkos_node::Prover
source · pub struct Prover<N: Network, C: ConsensusStorage<N>> { /* private fields */ }Expand description
A prover is a full node, capable of producing proofs for consensus.
Implementations§
Trait Implementations§
source§impl<N: Network, C: ConsensusStorage<N>> Disconnect for Prover<N, C>
impl<N: Network, C: ConsensusStorage<N>> Disconnect for Prover<N, C>
source§fn handle_disconnect<'life0, 'async_trait>(
&'life0 self,
peer_addr: SocketAddr
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_disconnect<'life0, 'async_trait>( &'life0 self, peer_addr: SocketAddr ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Any extra operations to be performed during a disconnect.
source§fn enable_disconnect<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn enable_disconnect<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Sync + 'async_trait,
Disconnect::handle_disconnect to every occurrence of the
node disconnecting from a peer.source§impl<N: Network, C: ConsensusStorage<N>> Handshake for Prover<N, C>
impl<N: Network, C: ConsensusStorage<N>> Handshake for Prover<N, C>
source§fn perform_handshake<'life0, 'async_trait>(
&'life0 self,
connection: Connection
) -> Pin<Box<dyn Future<Output = Result<Connection>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn perform_handshake<'life0, 'async_trait>( &'life0 self, connection: Connection ) -> Pin<Box<dyn Future<Output = Result<Connection>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Performs the handshake protocol.
source§const TIMEOUT_MS: u64 = 3_000u64
const TIMEOUT_MS: u64 = 3_000u64
source§fn enable_handshake<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn enable_handshake<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Sync + 'async_trait,
source§fn borrow_stream<'a>(&self, conn: &'a mut Connection) -> &'a mut TcpStream
fn borrow_stream<'a>(&self, conn: &'a mut Connection) -> &'a mut TcpStream
Handshake::perform_handshake.source§fn take_stream(&self, conn: &mut Connection) -> TcpStream
fn take_stream(&self, conn: &mut Connection) -> TcpStream
Handshake::perform_handshake, by
the end of which it must be followed by Handshake::return_stream.source§fn return_stream<T>(&self, conn: &mut Connection, stream: T)where
T: AsyncRead + AsyncWrite + Send + Sync + 'static,
fn return_stream<T>(&self, conn: &mut Connection, stream: T)where T: AsyncRead + AsyncWrite + Send + Sync + 'static,
Handshake::take_stream had been called before; it is used to
return a (potentially modified) stream back to the applicable connection.source§impl<N: Network, C: ConsensusStorage<N>> Heartbeat<N> for Prover<N, C>
impl<N: Network, C: ConsensusStorage<N>> Heartbeat<N> for Prover<N, C>
source§const HEARTBEAT_IN_SECS: u64 = 15u64
const HEARTBEAT_IN_SECS: u64 = 15u64
source§const MINIMUM_NUMBER_OF_PEERS: usize = 3usize
const MINIMUM_NUMBER_OF_PEERS: usize = 3usize
source§const MEDIAN_NUMBER_OF_PEERS: usize = max(Self::MAXIMUM_NUMBER_OF_PEERS / 2, Self::MINIMUM_NUMBER_OF_PEERS)
const MEDIAN_NUMBER_OF_PEERS: usize = max(Self::MAXIMUM_NUMBER_OF_PEERS / 2, Self::MINIMUM_NUMBER_OF_PEERS)
source§const MAXIMUM_NUMBER_OF_PEERS: usize = 21usize
const MAXIMUM_NUMBER_OF_PEERS: usize = 21usize
source§fn safety_check_minimum_number_of_peers(&self)
fn safety_check_minimum_number_of_peers(&self)
source§fn log_connected_peers(&self)
fn log_connected_peers(&self)
source§fn remove_stale_connected_peers(&self)
fn remove_stale_connected_peers(&self)
source§fn remove_oldest_connected_peer(&self)
fn remove_oldest_connected_peer(&self)
source§fn handle_connected_peers(&self)
fn handle_connected_peers(&self)
source§fn handle_bootstrap_peers(&self)
fn handle_bootstrap_peers(&self)
source§fn handle_trusted_peers(&self)
fn handle_trusted_peers(&self)
source§fn handle_puzzle_request(&self)
fn handle_puzzle_request(&self)
source§impl<N: Network, C: ConsensusStorage<N>> Inbound<N> for Prover<N, C>
impl<N: Network, C: ConsensusStorage<N>> Inbound<N> for Prover<N, C>
source§fn block_request(&self, peer_ip: SocketAddr, _message: BlockRequest) -> bool
fn block_request(&self, peer_ip: SocketAddr, _message: BlockRequest) -> bool
Handles a BlockRequest message.
source§fn block_response(&self, peer_ip: SocketAddr, _blocks: Vec<Block<N>>) -> bool
fn block_response(&self, peer_ip: SocketAddr, _blocks: Vec<Block<N>>) -> bool
Handles a BlockResponse message.
source§fn pong(&self, peer_ip: SocketAddr, _message: Pong) -> bool
fn pong(&self, peer_ip: SocketAddr, _message: Pong) -> bool
Sleeps for a period and then sends a Ping message to the peer.
source§fn puzzle_request(&self, peer_ip: SocketAddr) -> bool
fn puzzle_request(&self, peer_ip: SocketAddr) -> bool
Disconnects on receipt of a PuzzleRequest message.
source§fn puzzle_response(
&self,
peer_ip: SocketAddr,
epoch_challenge: EpochChallenge<N>,
header: Header<N>
) -> bool
fn puzzle_response( &self, peer_ip: SocketAddr, epoch_challenge: EpochChallenge<N>, header: Header<N> ) -> bool
Saves the latest epoch challenge and latest block header in the node.
source§fn unconfirmed_solution<'life0, 'async_trait>(
&'life0 self,
peer_ip: SocketAddr,
serialized: UnconfirmedSolution<N>,
solution: ProverSolution<N>
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn unconfirmed_solution<'life0, 'async_trait>( &'life0 self, peer_ip: SocketAddr, serialized: UnconfirmedSolution<N>, solution: ProverSolution<N> ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Propagates the unconfirmed solution to all connected validators.
source§fn unconfirmed_transaction(
&self,
_peer_ip: SocketAddr,
_serialized: UnconfirmedTransaction<N>,
_transaction: Transaction<N>
) -> bool
fn unconfirmed_transaction( &self, _peer_ip: SocketAddr, _serialized: UnconfirmedTransaction<N>, _transaction: Transaction<N> ) -> bool
Handles an UnconfirmedTransaction message.
source§const MAXIMUM_PUZZLE_REQUESTS_PER_INTERVAL: usize = 5usize
const MAXIMUM_PUZZLE_REQUESTS_PER_INTERVAL: usize = 5usize
source§const PING_SLEEP_IN_SECS: u64 = 9u64
const PING_SLEEP_IN_SECS: u64 = 9u64
source§fn inbound<'life0, 'async_trait>(
&'life0 self,
peer_addr: SocketAddr,
message: Message<N>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn inbound<'life0, 'async_trait>( &'life0 self, peer_addr: SocketAddr, message: Message<N> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Sync + 'async_trait,
source§fn beacon_propose(
&self,
_peer_ip: SocketAddr,
_serialized: BeaconPropose<N>,
_block: Block<N>
) -> bool
fn beacon_propose( &self, _peer_ip: SocketAddr, _serialized: BeaconPropose<N>, _block: Block<N> ) -> bool
BeaconPropose message.source§fn peer_request(&self, peer_ip: SocketAddr) -> bool
fn peer_request(&self, peer_ip: SocketAddr) -> bool
PeerRequest message.source§fn peer_response(&self, _peer_ip: SocketAddr, peers: &[SocketAddr]) -> bool
fn peer_response(&self, _peer_ip: SocketAddr, peers: &[SocketAddr]) -> bool
PeerResponse message.fn ping(&self, peer_ip: SocketAddr, message: Ping<N>) -> bool
source§impl<N: Network, C: ConsensusStorage<N>> NodeInterface<N> for Prover<N, C>
impl<N: Network, C: ConsensusStorage<N>> NodeInterface<N> for Prover<N, C>
source§fn shut_down<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shut_down<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Shuts down the node.
source§fn private_key(&self) -> &PrivateKey<N>
fn private_key(&self) -> &PrivateKey<N>
source§fn handle_signals(&self)
fn handle_signals(&self)
source§impl<N: Network, C: ConsensusStorage<N>> OnConnect for Prover<N, C>where
Self: Outbound<N>,
impl<N: Network, C: ConsensusStorage<N>> OnConnect for Prover<N, C>where Self: Outbound<N>,
source§fn on_connect<'life0, 'async_trait>(
&'life0 self,
peer_addr: SocketAddr
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_connect<'life0, 'async_trait>( &'life0 self, peer_addr: SocketAddr ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Writing]), only its SocketAddr
(as opposed to the related [Connection] object) is provided as an argument.source§impl<N: Network, C: ConsensusStorage<N>> Outbound<N> for Prover<N, C>
impl<N: Network, C: ConsensusStorage<N>> Outbound<N> for Prover<N, C>
source§fn send_ping(
&self,
peer_ip: SocketAddr,
block_locators: Option<BlockLocators<N>>
)
fn send_ping( &self, peer_ip: SocketAddr, block_locators: Option<BlockLocators<N>> )
source§fn send(
&self,
peer_ip: SocketAddr,
message: Message<N>
) -> Option<Receiver<Result<(), Error>>>
fn send( &self, peer_ip: SocketAddr, message: Message<N> ) -> Option<Receiver<Result<(), Error>>>
source§fn propagate(&self, message: Message<N>, excluded_peers: &[SocketAddr])
fn propagate(&self, message: Message<N>, excluded_peers: &[SocketAddr])
source§fn propagate_to_beacons(
&self,
message: Message<N>,
excluded_peers: &[SocketAddr]
)
fn propagate_to_beacons( &self, message: Message<N>, excluded_peers: &[SocketAddr] )
source§fn propagate_to_validators(
&self,
message: Message<N>,
excluded_peers: &[SocketAddr]
)
fn propagate_to_validators( &self, message: Message<N>, excluded_peers: &[SocketAddr] )
source§impl<N: Network, C: ConsensusStorage<N>> Reading for Prover<N, C>
impl<N: Network, C: ConsensusStorage<N>> Reading for Prover<N, C>
source§fn codec(&self, _peer_addr: SocketAddr, _side: ConnectionSide) -> Self::Codec
fn codec(&self, _peer_addr: SocketAddr, _side: ConnectionSide) -> Self::Codec
Creates a [Decoder] used to interpret messages from the network.
The side param indicates the connection side from the node’s perspective.
source§fn process_message<'life0, 'async_trait>(
&'life0 self,
peer_addr: SocketAddr,
message: Self::Message
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process_message<'life0, 'async_trait>( &'life0 self, peer_addr: SocketAddr, message: Self::Message ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Processes a message received from the network.
§type Codec = MessageCodec<N>
type Codec = MessageCodec<N>
Decoder used to interpret inbound messages.source§const MESSAGE_QUEUE_DEPTH: usize = 1_024usize
const MESSAGE_QUEUE_DEPTH: usize = 1_024usize
source§const INITIAL_BUFFER_SIZE: usize = 1_048_576usize
const INITIAL_BUFFER_SIZE: usize = 1_048_576usize
source§impl<N: Network, C: ConsensusStorage<N>> Routing<N> for Prover<N, C>
impl<N: Network, C: ConsensusStorage<N>> Routing<N> for Prover<N, C>
source§fn initialize_routing<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn initialize_routing<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Sync + 'async_trait,
fn enable_listener<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Sync + 'async_trait,
source§fn initialize_heartbeat(&self)
fn initialize_heartbeat(&self)
source§fn initialize_report(&self)
fn initialize_report(&self)
source§impl<N: Network, C: ConsensusStorage<N>> Writing for Prover<N, C>
impl<N: Network, C: ConsensusStorage<N>> Writing for Prover<N, C>
source§fn codec(&self, _addr: SocketAddr, _side: ConnectionSide) -> Self::Codec
fn codec(&self, _addr: SocketAddr, _side: ConnectionSide) -> Self::Codec
Creates an [Encoder] used to write the outbound messages to the target stream.
The side parameter indicates the connection side from the node’s perspective.
§type Codec = MessageCodec<N>
type Codec = MessageCodec<N>
Encoder used to write outbound messages to the target stream.§type Message = Message<N>
type Message = Message<N>
Self::Codec.source§const MESSAGE_QUEUE_DEPTH: usize = 1_024usize
const MESSAGE_QUEUE_DEPTH: usize = 1_024usize
source§fn enable_writing<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn enable_writing<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: Sync + 'async_trait,
source§fn unicast(
&self,
addr: SocketAddr,
message: Self::Message
) -> Result<Receiver<Result<(), Error>>, Error>
fn unicast( &self, addr: SocketAddr, message: Self::Message ) -> Result<Receiver<Result<(), Error>>, Error>
SocketAddr. Returns as soon as the message is queued to
be sent, without waiting for the actual delivery; instead, the caller is provided with a oneshot::Receiver
which can be used to determine when and whether the message has been delivered. Read more