Trait floresta_wire::NodeHooks
source · pub trait NodeHooks {
// Required methods
fn on_block_received(&mut self, block: &Block);
fn on_transaction_received(&mut self, transaction: &Transaction);
fn on_peer_connected(&mut self, peer: &u32);
fn on_peer_disconnected(&mut self, peer: &u32);
fn on_header_received(&mut self, header: &BlockHeader);
}
Expand description
NodeHooks is a trait that defines the hooks that a node can use to interact with the network and the blockchain. Every time an event happens, the node will call the corresponding hook.
Required Methods§
sourcefn on_block_received(&mut self, block: &Block)
fn on_block_received(&mut self, block: &Block)
We’ve received a new block
sourcefn on_transaction_received(&mut self, transaction: &Transaction)
fn on_transaction_received(&mut self, transaction: &Transaction)
We’ve received a new transaction
sourcefn on_peer_connected(&mut self, peer: &u32)
fn on_peer_connected(&mut self, peer: &u32)
We’ve received a new peer
sourcefn on_peer_disconnected(&mut self, peer: &u32)
fn on_peer_disconnected(&mut self, peer: &u32)
We’ve lost a peer
sourcefn on_header_received(&mut self, header: &BlockHeader)
fn on_header_received(&mut self, header: &BlockHeader)
We’ve received a new header