referrerpolicy=no-referrer-when-downgrade
polkadot_sdk_frame::traits

Trait PreimageProvider

pub trait PreimageProvider<Hash> {
    // Required methods
    fn have_preimage(hash: &Hash) -> bool;
    fn get_preimage(hash: &Hash) -> Option<Vec<u8>>;
    fn preimage_requested(hash: &Hash) -> bool;
    fn request_preimage(hash: &Hash);
    fn unrequest_preimage(hash: &Hash);
}
Expand description

A interface for looking up preimages from their hash on chain.

Required Methods§

fn have_preimage(hash: &Hash) -> bool

Returns whether a preimage exists for a given hash.

A value of true implies that get_preimage is Some.

fn get_preimage(hash: &Hash) -> Option<Vec<u8>>

Returns the preimage for a given hash.

fn preimage_requested(hash: &Hash) -> bool

Returns whether a preimage request exists for a given hash.

fn request_preimage(hash: &Hash)

Request that someone report a preimage. Providers use this to optimise the economics for preimage reporting.

fn unrequest_preimage(hash: &Hash)

Cancel a previous preimage request.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl<Hash> PreimageProvider<Hash> for ()

Implementors§

impl<T: Config> PreimageProvider<<T as Config>::Hash> for Pallet<T>