Struct openethereum::modules::EthSync
source · [−]pub struct EthSync {
network: NetworkService,
eth_handler: Arc<SyncProtocolHandler>,
subprotocol_name: U64,
priority_tasks: Mutex<RawMutex, Sender<PriorityTask>>,
new_transaction_hashes: Sender<H256>,
}
Expand description
Ethereum network protocol handler
Fields
network: NetworkService
Network service
eth_handler: Arc<SyncProtocolHandler>
Main (eth/par) protocol handler
subprotocol_name: U64
The main subprotocol name
priority_tasks: Mutex<RawMutex, Sender<PriorityTask>>
Priority tasks notification channel
new_transaction_hashes: Sender<H256>
New incoming transactions notification channel
Implementations
sourceimpl EthSync
impl EthSync
sourcepub fn new(
params: Params,
connection_filter: Option<Arc<dyn ConnectionFilter + 'static>>
) -> Result<Arc<EthSync>, Error>
pub fn new(
params: Params,
connection_filter: Option<Arc<dyn ConnectionFilter + 'static>>
) -> Result<Arc<EthSync>, Error>
Creates and register protocol with the network service
sourcepub fn priority_tasks(&self) -> Sender<PriorityTask>
pub fn priority_tasks(&self) -> Sender<PriorityTask>
Priority tasks producer
sourcepub fn new_transaction_hashes(&self) -> Sender<H256>
pub fn new_transaction_hashes(&self) -> Sender<H256>
New transactions hashes producer
Trait Implementations
sourceimpl ChainNotify for EthSync
impl ChainNotify for EthSync
sourcepub fn block_pre_import(
&self,
bytes: &Vec<u8, Global>,
hash: &H256,
difficulty: &U256
)
pub fn block_pre_import(
&self,
bytes: &Vec<u8, Global>,
hash: &H256,
difficulty: &U256
)
fires when new block is about to be imported implementations should be light Read more
sourcepub fn new_blocks(&self, new_blocks: NewBlocks)
pub fn new_blocks(&self, new_blocks: NewBlocks)
fires when chain has new blocks.
sourcepub fn broadcast(&self, message_type: ChainMessageType)
pub fn broadcast(&self, message_type: ChainMessageType)
fires when chain broadcasts a message
sourcepub fn transactions_received(
&self,
txs: &[UnverifiedTransaction],
peer_id: usize
)
pub fn transactions_received(
&self,
txs: &[UnverifiedTransaction],
peer_id: usize
)
fires when new transactions are received from a peer
sourceimpl ManageNetwork for EthSync
impl ManageNetwork for EthSync
sourcepub fn accept_unreserved_peers(&self)
pub fn accept_unreserved_peers(&self)
Set to allow unreserved peers to connect
sourcepub fn deny_unreserved_peers(&self)
pub fn deny_unreserved_peers(&self)
Set to deny unreserved peers to connect
sourcepub fn remove_reserved_peer(&self, peer: String) -> Result<(), String>
pub fn remove_reserved_peer(&self, peer: String) -> Result<(), String>
Remove reservation for the peer
sourcepub fn start_network(&self)
pub fn start_network(&self)
Start network
sourcepub fn stop_network(&self)
pub fn stop_network(&self)
Stop network
sourcepub fn num_peers_range(&self) -> RangeInclusive<u32>
pub fn num_peers_range(&self) -> RangeInclusive<u32>
Returns the minimum and maximum peers.
sourcepub fn with_proto_context(
&self,
proto: U64,
f: &mut dyn FnMut(&dyn NetworkContext)
)
pub fn with_proto_context(
&self,
proto: U64,
f: &mut dyn FnMut(&dyn NetworkContext)
)
Get network context for protocol.
sourceimpl PrometheusMetrics for EthSync
impl PrometheusMetrics for EthSync
pub fn prometheus_metrics(&self, r: &mut PrometheusRegistry)
sourceimpl SyncProvider for EthSync
impl SyncProvider for EthSync
sourcepub fn status(&self) -> SyncStatus
pub fn status(&self) -> SyncStatus
Get sync status
sourcepub fn peers(&self) -> Vec<PeerInfo, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn peers(&self) -> Vec<PeerInfo, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Get sync peers
sourcepub fn pending_transactions_stats(&self) -> BTreeMap<H256, TransactionStats>
pub fn pending_transactions_stats(&self) -> BTreeMap<H256, TransactionStats>
Returns propagation count for pending transactions.
sourcepub fn new_transactions_stats(&self) -> BTreeMap<H256, TransactionStats>
pub fn new_transactions_stats(&self) -> BTreeMap<H256, TransactionStats>
Returns propagation count for new transactions.
Auto Trait Implementations
impl !RefUnwindSafe for EthSync
impl Send for EthSync
impl Sync for EthSync
impl Unpin for EthSync
impl !UnwindSafe for EthSync
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more