Struct mmr_rpc::LeavesProof
source · pub struct LeavesProof<BlockHash> {
pub block_hash: BlockHash,
pub leaves: Bytes,
pub proof: Bytes,
}Expand description
Retrieved MMR leaves and their proof.
Fields§
§block_hash: BlockHashBlock hash the proof was generated for.
leaves: BytesSCALE-encoded vector of LeafData.
proof: BytesSCALE-encoded proof data. See sp_mmr_primitives::Proof.
Implementations§
source§impl<BlockHash> LeavesProof<BlockHash>
impl<BlockHash> LeavesProof<BlockHash>
sourcepub fn new<Leaf, MmrHash>(
block_hash: BlockHash,
leaves: Vec<Leaf>,
proof: Proof<MmrHash>
) -> Selfwhere
Leaf: Encode,
MmrHash: Encode,
pub fn new<Leaf, MmrHash>(
block_hash: BlockHash,
leaves: Vec<Leaf>,
proof: Proof<MmrHash>
) -> Selfwhere
Leaf: Encode,
MmrHash: Encode,
Create new LeavesProof from a given vector of Leaf and a
sp_mmr_primitives::Proof.
Examples found in repository?
src/lib.rs (line 184)
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
fn generate_proof(
&self,
block_numbers: Vec<NumberFor<Block>>,
best_known_block_number: Option<NumberFor<Block>>,
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<LeavesProof<<Block as BlockT>::Hash>> {
let api = self.client.runtime_api();
let block_hash = at.unwrap_or_else(||
// If the block hash is not supplied assume the best block.
self.client.info().best_hash);
let (leaves, proof) = api
.generate_proof_with_context(
&BlockId::hash(block_hash),
sp_core::ExecutionContext::OffchainCall(None),
block_numbers,
best_known_block_number,
)
.map_err(runtime_error_into_rpc_error)?
.map_err(mmr_error_into_rpc_error)?;
Ok(LeavesProof::new(block_hash, leaves, proof))
}Trait Implementations§
source§impl<BlockHash: Clone> Clone for LeavesProof<BlockHash>
impl<BlockHash: Clone> Clone for LeavesProof<BlockHash>
source§fn clone(&self) -> LeavesProof<BlockHash>
fn clone(&self) -> LeavesProof<BlockHash>
Returns a copy 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<BlockHash: Debug> Debug for LeavesProof<BlockHash>
impl<BlockHash: Debug> Debug for LeavesProof<BlockHash>
source§impl<'de, BlockHash> Deserialize<'de> for LeavesProof<BlockHash>where
BlockHash: Deserialize<'de>,
impl<'de, BlockHash> Deserialize<'de> for LeavesProof<BlockHash>where
BlockHash: Deserialize<'de>,
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
source§impl<BlockHash: PartialEq> PartialEq<LeavesProof<BlockHash>> for LeavesProof<BlockHash>
impl<BlockHash: PartialEq> PartialEq<LeavesProof<BlockHash>> for LeavesProof<BlockHash>
source§fn eq(&self, other: &LeavesProof<BlockHash>) -> bool
fn eq(&self, other: &LeavesProof<BlockHash>) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl<BlockHash> Serialize for LeavesProof<BlockHash>where
BlockHash: Serialize,
impl<BlockHash> Serialize for LeavesProof<BlockHash>where
BlockHash: Serialize,
impl<BlockHash: Eq> Eq for LeavesProof<BlockHash>
impl<BlockHash> StructuralEq for LeavesProof<BlockHash>
impl<BlockHash> StructuralPartialEq for LeavesProof<BlockHash>
Auto Trait Implementations§
impl<BlockHash> RefUnwindSafe for LeavesProof<BlockHash>where
BlockHash: RefUnwindSafe,
impl<BlockHash> Send for LeavesProof<BlockHash>where
BlockHash: Send,
impl<BlockHash> Sync for LeavesProof<BlockHash>where
BlockHash: Sync,
impl<BlockHash> Unpin for LeavesProof<BlockHash>where
BlockHash: Unpin,
impl<BlockHash> UnwindSafe for LeavesProof<BlockHash>where
BlockHash: UnwindSafe,
Blanket Implementations§
source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T. Read moresource§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from.§impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere
T: Bounded,
S: TryInto<T>,
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T.