Struct loki::process::AdversaryNode
source · pub struct AdversaryNode {
temp_dir: Option<TestingDirectory>,
alias: String,
node_data: Arc<RwLock<MockServerData>>,
server: Option<MockController>,
open_client_connections: HashMap<SocketAddr, JormungandrClient>,
}
Expand description
An adversary-controlled node, which can deviate in every way from the blockchain protocol.
It uses the same node-to-node gRPC interface as Jormungandr (although not complete) so that it’s able to communicate with other nodes, but the rest interface and the general way of controlling its behavior might be different.
In the future, we may be interested in this node being interchangeable with JormungandrProcess in terms of functionalities, but we start from what is currently needed.
Fields§
§temp_dir: Option<TestingDirectory>
§alias: String
§node_data: Arc<RwLock<MockServerData>>
§server: Option<MockController>
§open_client_connections: HashMap<SocketAddr, JormungandrClient>
Implementations§
source§impl AdversaryNode
impl AdversaryNode
pub(crate) fn new( temp_dir: Option<TestingDirectory>, alias: String, node_data: Arc<RwLock<NodeData>>, server: Option<MockController> ) -> Self
pub fn fragment_sender<'a, S: SyncNode + Send>( &self, setup: FragmentSenderSetup<'a, S> ) -> FragmentSender<'a, S>
pub fn alias(&self) -> NodeAlias
pub fn address(&self) -> SocketAddr
pub fn fees(&self) -> LinearFee
pub fn genesis_block_hash(&self) -> Hash
pub fn block0_configuration(&self) -> Block0Configuration
fn p2p_public_addr(&self) -> SocketAddr
pub fn to_trusted_peer(&self) -> TrustedPeer
pub fn steal_temp_dir(&mut self) -> Option<TestingDirectory>
pub fn send_block_to_peer( &mut self, peer: SocketAddr, block: Block ) -> Result<(), MockClientError>
pub fn send_header_to_peer( &mut self, peer: SocketAddr, header: Header ) -> Result<(), MockClientError>
pub fn builder(genesis_block: Block) -> AdversaryNodeBuilder
pub fn node_data(&self) -> Arc<RwLock<NodeData>>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AdversaryNode
impl Send for AdversaryNode
impl !Sync for AdversaryNode
impl Unpin for AdversaryNode
impl !UnwindSafe for AdversaryNode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request