Skip to main content

TransactionPropagationPolicy

Trait TransactionPropagationPolicy 

Source
pub trait TransactionPropagationPolicy<N>:
    Send
    + Sync
    + Unpin
    + Debug
    + 'static{
    // Required methods
    fn can_propagate(&self, peer: &mut PeerMetadata<N>) -> bool;
    fn on_session_established(&mut self, peer: &mut PeerMetadata<N>);
    fn on_session_closed(&mut self, peer: &mut PeerMetadata<N>);
}
Expand description

A policy defining which peers pending transactions are gossiped to.

Required Methods§

Source

fn can_propagate(&self, peer: &mut PeerMetadata<N>) -> bool

Filter a given peer based on the policy.

This determines whether transactions can be propagated to this peer. Peers that are filtered out also don’t receive the pending pool announcement on session establishment and are served empty responses to GetPooledTransactions requests.

Source

fn on_session_established(&mut self, peer: &mut PeerMetadata<N>)

A callback on the policy when a new peer session is established.

Source

fn on_session_closed(&mut self, peer: &mut PeerMetadata<N>)

A callback on the policy when a peer session is closed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§