Trait subcoin_network::NetworkApi

source ·
pub trait NetworkApi: Send + Sync {
    // Required methods
    fn enabled(&self) -> bool;
    fn status<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Option<NetworkStatus>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sync_peers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<PeerSync>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_transaction<'life0, 'async_trait>(
        &'life0 self,
        txid: Txid,
    ) -> Pin<Box<dyn Future<Output = Option<Transaction>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_transaction<'life0, 'async_trait>(
        &'life0 self,
        transaction: Transaction,
    ) -> Pin<Box<dyn Future<Output = SendTransactionResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn start_block_sync(&self) -> bool;
    fn is_major_syncing(&self) -> bool;
}
Expand description

Subcoin network service interface.

Required Methods§

source

fn enabled(&self) -> bool

Whether the network instnace is running.

source

fn status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<NetworkStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provides high-level status information about network.

Returns None if the NetworkProcessor is no longer running.

source

fn sync_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<PeerSync>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the currently syncing peers.

source

fn get_transaction<'life0, 'async_trait>( &'life0 self, txid: Txid, ) -> Pin<Box<dyn Future<Output = Option<Transaction>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves a transaction by its Txid.

source

fn send_transaction<'life0, 'async_trait>( &'life0 self, transaction: Transaction, ) -> Pin<Box<dyn Future<Output = SendTransactionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends a transaction to the network.

source

fn start_block_sync(&self) -> bool

Starts the block sync in chain sync component.

source

fn is_major_syncing(&self) -> bool

Whether the node is actively performing a major sync.

Implementors§