Skip to main content

UtxoCommitmentsNetworkClient

Trait UtxoCommitmentsNetworkClient 

Source
pub trait UtxoCommitmentsNetworkClient: Send + Sync {
    // Required methods
    fn request_utxo_set(
        &self,
        peer_id: &str,
        height: Natural,
        block_hash: HashType,
    ) -> Pin<Box<dyn Future<Output = UtxoCommitmentResult<UtxoCommitment>> + Send + '_>>;
    fn request_filtered_block(
        &self,
        peer_id: &str,
        block_hash: HashType,
    ) -> Pin<Box<dyn Future<Output = UtxoCommitmentResult<FilteredBlock>> + Send + '_>>;
    fn request_full_block(
        &self,
        peer_id: &str,
        block_hash: HashType,
    ) -> Pin<Box<dyn Future<Output = UtxoCommitmentResult<FullBlock>> + Send + '_>>;
    fn get_peer_ids(&self) -> Vec<String>;
}
Expand description

Network client interface for UTXO commitments

In a full implementation, this would be implemented by the blvm-node’s network manager to send/receive P2P messages.

Note: This trait is designed for static dispatch. For dynamic dispatch, use the helper functions below or wrap in a type-erased async trait.

Required Methods§

Source

fn request_utxo_set( &self, peer_id: &str, height: Natural, block_hash: HashType, ) -> Pin<Box<dyn Future<Output = UtxoCommitmentResult<UtxoCommitment>> + Send + '_>>

Request UTXO set from a peer at specific height

This is a synchronous interface that returns a Future. In practice, implementers will use async/await internally.

Source

fn request_filtered_block( &self, peer_id: &str, block_hash: HashType, ) -> Pin<Box<dyn Future<Output = UtxoCommitmentResult<FilteredBlock>> + Send + '_>>

Request filtered block from a peer

Source

fn request_full_block( &self, peer_id: &str, block_hash: HashType, ) -> Pin<Box<dyn Future<Output = UtxoCommitmentResult<FullBlock>> + Send + '_>>

Request full block from a peer (with witnesses)

Returns the full block and its witnesses for complete validation. This is required for full transaction validation during sync forward.

Source

fn get_peer_ids(&self) -> Vec<String>

Get list of connected peer IDs

Implementors§