TransactionDependencyProvider

Trait TransactionDependencyProvider 

Source
pub trait TransactionDependencyProvider: Sync + Send {
    // Required methods
    fn get_transaction_async<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx_hash: &'life1 Byte32,
    ) -> Pin<Box<dyn Future<Output = Result<TransactionView, TransactionDependencyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_cell_async<'life0, 'life1, 'async_trait>(
        &'life0 self,
        out_point: &'life1 OutPoint,
    ) -> Pin<Box<dyn Future<Output = Result<CellOutput, TransactionDependencyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_cell_data_async<'life0, 'life1, 'async_trait>(
        &'life0 self,
        out_point: &'life1 OutPoint,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, TransactionDependencyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_header_async<'life0, 'life1, 'async_trait>(
        &'life0 self,
        block_hash: &'life1 Byte32,
    ) -> Pin<Box<dyn Future<Output = Result<HeaderView, TransactionDependencyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_block_extension_async<'life0, 'life1, 'async_trait>(
        &'life0 self,
        block_hash: &'life1 Byte32,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, TransactionDependencyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn get_transaction(
        &self,
        tx_hash: &Byte32,
    ) -> Result<TransactionView, TransactionDependencyError> { ... }
    fn get_cell(
        &self,
        out_point: &OutPoint,
    ) -> Result<CellOutput, TransactionDependencyError> { ... }
    fn get_cell_data(
        &self,
        out_point: &OutPoint,
    ) -> Result<Bytes, TransactionDependencyError> { ... }
    fn get_header(
        &self,
        block_hash: &Byte32,
    ) -> Result<HeaderView, TransactionDependencyError> { ... }
    fn get_block_extension(
        &self,
        block_hash: &Byte32,
    ) -> Result<Option<Bytes>, TransactionDependencyError> { ... }
}
Expand description

Provider dependency information of a transaction:

  • inputs
  • cell_deps
  • header_deps

Required Methods§

Source

fn get_transaction_async<'life0, 'life1, 'async_trait>( &'life0 self, tx_hash: &'life1 Byte32, ) -> Pin<Box<dyn Future<Output = Result<TransactionView, TransactionDependencyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_cell_async<'life0, 'life1, 'async_trait>( &'life0 self, out_point: &'life1 OutPoint, ) -> Pin<Box<dyn Future<Output = Result<CellOutput, TransactionDependencyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

For get the output information of inputs or cell_deps, those cell should be live cell

Source

fn get_cell_data_async<'life0, 'life1, 'async_trait>( &'life0 self, out_point: &'life1 OutPoint, ) -> Pin<Box<dyn Future<Output = Result<Bytes, TransactionDependencyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

For get the output data information of inputs or cell_deps

Source

fn get_header_async<'life0, 'life1, 'async_trait>( &'life0 self, block_hash: &'life1 Byte32, ) -> Pin<Box<dyn Future<Output = Result<HeaderView, TransactionDependencyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

For get the header information of header_deps

Source

fn get_block_extension_async<'life0, 'life1, 'async_trait>( &'life0 self, block_hash: &'life1 Byte32, ) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, TransactionDependencyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

For get_block_extension

Provided Methods§

Source

fn get_transaction( &self, tx_hash: &Byte32, ) -> Result<TransactionView, TransactionDependencyError>

For verify certain cell belong to certain transaction

Source

fn get_cell( &self, out_point: &OutPoint, ) -> Result<CellOutput, TransactionDependencyError>

For get the output information of inputs or cell_deps, those cell should be live cell

Source

fn get_cell_data( &self, out_point: &OutPoint, ) -> Result<Bytes, TransactionDependencyError>

For get the output data information of inputs or cell_deps

Source

fn get_header( &self, block_hash: &Byte32, ) -> Result<HeaderView, TransactionDependencyError>

For get the header information of header_deps

Source

fn get_block_extension( &self, block_hash: &Byte32, ) -> Result<Option<Bytes>, TransactionDependencyError>

For get_block_extension

Trait Implementations§

Source§

impl CellDataProvider for &dyn TransactionDependencyProvider

Available on non-WebAssembly only.
Source§

fn get_cell_data(&self, out_point: &OutPoint) -> Option<Bytes>

Fetch cell_data from storage
Source§

fn get_cell_data_hash(&self, out_point: &OutPoint) -> Option<Byte32>

Fetch cell_data_hash from storage, please note that loading a large amount of cell data and calculating hash may be a performance bottleneck, so here is a separate fn designed to facilitate caching. Read more
Source§

fn load_cell_data(&self, cell: &CellMeta) -> Option<Bytes>

Load cell_data from memory, fallback to storage access
Source§

fn load_cell_data_hash(&self, cell: &CellMeta) -> Option<Byte32>

Load cell_data_hash from memory, fallback to storage access
Source§

impl CellProvider for &dyn TransactionDependencyProvider

Available on non-WebAssembly only.
Source§

fn cell(&self, out_point: &OutPoint, _eager_load: bool) -> CellStatus

TODO(doc): @quake
Source§

impl ExtensionProvider for &dyn TransactionDependencyProvider

Available on non-WebAssembly only.
Source§

fn get_block_extension(&self, hash: &Byte32) -> Option<Bytes>

Get the extension field of the given block hash
Source§

impl HeaderChecker for &dyn TransactionDependencyProvider

Available on non-WebAssembly only.
Source§

fn check_valid(&self, block_hash: &Byte32) -> Result<(), OutPointError>

Check if header in main chain
Source§

impl HeaderProvider for &dyn TransactionDependencyProvider

Available on non-WebAssembly only.
Source§

fn get_header(&self, hash: &Byte32) -> Option<HeaderView>

Get the header of the given block hash

Implementors§