Skip to main content

CoinStateFetcher

Trait CoinStateFetcher 

Source
pub trait CoinStateFetcher: Send + Sync {
    // Required methods
    fn coin_states<'life0, 'async_trait>(
        &'life0 self,
        coin_ids: Vec<Bytes32>,
        subscribe: bool,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CoinState>, ChiaPeerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn puzzle_states<'life0, 'async_trait>(
        &'life0 self,
        puzzle_hashes: Vec<Bytes32>,
        filters: CoinStateFilters,
        subscribe: bool,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CoinState>, ChiaPeerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn children<'life0, 'async_trait>(
        &'life0 self,
        coin_id: Bytes32,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CoinState>, ChiaPeerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn puzzle_and_solution<'life0, 'async_trait>(
        &'life0 self,
        coin_id: Bytes32,
        height: u32,
    ) -> Pin<Box<dyn Future<Output = Result<(Program, Program), ChiaPeerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The reads a provider issues against a Chia full node when its local cache misses.

subscribe = true arms a server-side subscription so future changes stream back as CoinStateUpdates; subscribe = false is a one-shot read that never grows the subscription set.

Required Methods§

Source

fn coin_states<'life0, 'async_trait>( &'life0 self, coin_ids: Vec<Bytes32>, subscribe: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<CoinState>, ChiaPeerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reads the current state of coin_ids. An empty result is a PROVABLE absence.

Source

fn puzzle_states<'life0, 'async_trait>( &'life0 self, puzzle_hashes: Vec<Bytes32>, filters: CoinStateFilters, subscribe: bool, ) -> Pin<Box<dyn Future<Output = Result<Vec<CoinState>, ChiaPeerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reads every coin paying to puzzle_hashes (paging through the peer’s is_finished protocol until complete), applying filters.

Source

fn children<'life0, 'async_trait>( &'life0 self, coin_id: Bytes32, ) -> Pin<Box<dyn Future<Output = Result<Vec<CoinState>, ChiaPeerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reads the direct children created by spending coin_id.

Source

fn puzzle_and_solution<'life0, 'async_trait>( &'life0 self, coin_id: Bytes32, height: u32, ) -> Pin<Box<dyn Future<Output = Result<(Program, Program), ChiaPeerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reads the puzzle reveal + solution of the coin spent at height.

Callers reach this ONLY after confirming the coin is spent, so absence is impossible: a rejection/absence is a “could not answer” and is returned as Err(_) (fail closed), NEVER a misleading Ok(None) that would corrupt the interface’s parent-walk authentication.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§