pub trait McHashDataSource {
// Required methods
fn get_latest_stable_block_for<'life0, 'async_trait>(
&'life0 self,
reference_timestamp: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<Option<MainchainBlock>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_stable_block_for<'life0, 'async_trait>(
&'life0 self,
hash: McBlockHash,
reference_timestamp: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<Option<MainchainBlock>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_block_by_hash<'life0, 'async_trait>(
&'life0 self,
hash: McBlockHash,
) -> Pin<Box<dyn Future<Output = Result<Option<MainchainBlock>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Data source API used by McHashInherentDataProvider
Required Methods§
Sourcefn get_latest_stable_block_for<'life0, 'async_trait>(
&'life0 self,
reference_timestamp: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<Option<MainchainBlock>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_latest_stable_block_for<'life0, 'async_trait>(
&'life0 self,
reference_timestamp: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<Option<MainchainBlock>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Query for the currently latest stable block with timestamp within the allowable_range(reference_timestamp) = [reference_timestamp - seconds(max_slot_boundary), reference_timestamp - seconds(slot_boundary)]
where max_slot_boundary
is 3 * security_parameter/active_slot_coeff
(3k/f
) and min_slot_boundary
is security_parameter/active_slot_coeff
(k/f
).
§Arguments
reference_timestamp
- restricts the timestamps of MC blocks
§Returns
Some(block)
- the latest stable block, with timestamp in the allowable rangeNone
- none of the blocks is stable, and with timestamp valid in according toreference_timestamp
Sourcefn get_stable_block_for<'life0, 'async_trait>(
&'life0 self,
hash: McBlockHash,
reference_timestamp: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<Option<MainchainBlock>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_stable_block_for<'life0, 'async_trait>(
&'life0 self,
hash: McBlockHash,
reference_timestamp: Timestamp,
) -> Pin<Box<dyn Future<Output = Result<Option<MainchainBlock>, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find block by hash, filtered by block timestamp being in allowable_range(reference_timestamp)
§Arguments
hash
- the hash of the blockreference_timestamp
- restricts the timestamp of the MC block
§Returns
Some(block)
- the block with given hash, with timestamp in the allowable rangeNone
- no stable block with given hash and timestamp in the allowable range exists