Struct jormungandr_automation::jormungandr::grpc::server::MockServerData
source · pub struct MockServerData {
genesis_hash: Hash,
protocol: ProtocolVersion,
keypair: KeyPair<Ed25519>,
profile: Profile,
auth_nonce: [u8; 32],
storage: BlockStore,
invalid_block0_hash: bool,
}
Fields§
§genesis_hash: Hash
§protocol: ProtocolVersion
§keypair: KeyPair<Ed25519>
§profile: Profile
§auth_nonce: [u8; 32]
§storage: BlockStore
§invalid_block0_hash: bool
Implementations§
source§impl MockServerData
impl MockServerData
const TIP_TAG: &'static str = "tip"
pub fn new( genesis_hash: Hash, protocol: ProtocolVersion, addr: SocketAddr, storage: BlockStore, invalid_get_blocks_hash: bool ) -> Self
pub fn genesis_hash(&self) -> &Hash
pub fn get_block(&self, header_id: Hash) -> Result<Block, Error>
pub fn genesis_block(&self) -> Block
pub fn tip(&self) -> Result<Header, Error>
sourcepub fn set_tip(&self, block_id: &[u8]) -> Result<(), Error>
pub fn set_tip(&self, block_id: &[u8]) -> Result<(), Error>
block_id must refer to a valid block already in the storage
pub fn put_block(&self, block: &Block) -> Result<(), Error>
pub fn profile(&self) -> &Profile
pub fn protocol(&self) -> &ProtocolVersion
pub fn node_id(&self) -> &[u8] ⓘ
pub fn node_signature(&self, nonce: &[u8]) -> Vec<u8> ⓘ
pub fn generate_auth_nonce(&mut self) -> &[u8] ⓘ
sourcepub fn storage(&self) -> &BlockStore
pub fn storage(&self) -> &BlockStore
Raw access to the storage. Can be used to play with raw bytes sequences or get around validations of domain objects, for example to mimic a malicous adversary
pub fn validate_peer_node_id(&self, node_id: &[u8], signature: &[u8]) -> bool
pub fn genesis_hash_mut(&mut self) -> &mut Hash
pub fn protocol_mut(&mut self) -> &mut ProtocolVersion
pub fn invalid_block0_hash(&self) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for MockServerData
impl Send for MockServerData
impl Sync for MockServerData
impl Unpin for MockServerData
impl !UnwindSafe for MockServerData
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