pub struct LightClient {
pub repository_roots: Vec<Hash256>,
pub commit_roots: Vec<Hash256>,
pub height_offset: u64,
pub last_header: BlockHeader,
}
Expand description
A light client state machine.
Fields§
§repository_roots: Vec<Hash256>
§commit_roots: Vec<Hash256>
§height_offset: u64
§last_header: BlockHeader
Implementations§
Source§impl LightClient
impl LightClient
Sourcepub fn new(initial_header: BlockHeader) -> Self
pub fn new(initial_header: BlockHeader) -> Self
initializes a new light client with the initial header.
Sourcepub fn update(
&mut self,
header: BlockHeader,
proof: FinalizationProof,
) -> Result<(), String>
pub fn update( &mut self, header: BlockHeader, proof: FinalizationProof, ) -> Result<(), String>
Updates the header by providing the next block and the proof of it.
Sourcepub fn verify_transaction_commitment(
&self,
transaction: &Transaction,
block_height: u64,
proof: MerkleProof,
) -> bool
pub fn verify_transaction_commitment( &self, transaction: &Transaction, block_height: u64, proof: MerkleProof, ) -> bool
Verifies the given transaction with its proof.
Sourcepub fn verify_state_commitment(
&self,
_message: Vec<u8>,
_block_height: u64,
_proof: MerkleProof,
) -> bool
pub fn verify_state_commitment( &self, _message: Vec<u8>, _block_height: u64, _proof: MerkleProof, ) -> bool
Verifies the state entry with its proof.
Trait Implementations§
Source§impl Clone for LightClient
impl Clone for LightClient
Source§fn clone(&self) -> LightClient
fn clone(&self) -> LightClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for LightClient
impl Debug for LightClient
Source§impl<'de> Deserialize<'de> for LightClient
impl<'de> Deserialize<'de> for LightClient
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LightClient
impl RefUnwindSafe for LightClient
impl Send for LightClient
impl Sync for LightClient
impl Unpin for LightClient
impl UnwindSafe for LightClient
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