[−][src]Trait grin_p2p::types::ChainAdapter
Bridge between the networking layer and the rest of the system. Handles the forwarding or querying of blocks and transactions from the network among other things.
Required methods
fn total_difficulty(&self) -> Difficulty
Current total difficulty on our chain
fn total_height(&self) -> u64
Current total height
fn transaction_received(&self, tx: Transaction, stem: bool)
A valid transaction has been received from one of our peers
fn get_transaction(&self, kernel_hash: Hash) -> Option<Transaction>
fn tx_kernel_received(&self, kernel_hash: Hash, addr: PeerAddr)
fn block_received(&self, b: Block, addr: PeerAddr, was_requested: bool) -> bool
A block has been received from one of our peers. Returns true if the block could be handled properly and is not deemed defective by the chain. Returning false means the block will never be valid and may result in the peer being banned.
fn compact_block_received(&self, cb: CompactBlock, addr: PeerAddr) -> bool
fn header_received(&self, bh: BlockHeader, addr: PeerAddr) -> bool
fn headers_received(&self, bh: &[BlockHeader], addr: PeerAddr) -> bool
A set of block header has been received, typically in response to a block header request.
fn locate_headers(&self, locator: &[Hash]) -> Vec<BlockHeader>
Finds a list of block headers based on the provided locator. Tries to identify the common chain and gets the headers that follow it immediately.
fn get_block(&self, h: Hash) -> Option<Block>
Gets a full block by its hash.
fn txhashset_read(&self, h: Hash) -> Option<TxHashSetRead>
Provides a reading view into the current txhashset state as well as the required indexes for a consumer to rewind to a consistant state at the provided block hash.
fn txhashset_receive_ready(&self) -> bool
Whether the node is ready to accept a new txhashset. If this isn't the case, the archive is provided without being requested and likely an attack attempt. This should be checked before downloading the whole state data.
fn txhashset_download_update(
&self,
start_time: DateTime<Utc>,
downloaded_size: u64,
total_size: u64
) -> bool
&self,
start_time: DateTime<Utc>,
downloaded_size: u64,
total_size: u64
) -> bool
Update txhashset downloading progress
fn txhashset_write(
&self,
h: Hash,
txhashset_data: File,
peer_addr: PeerAddr
) -> bool
&self,
h: Hash,
txhashset_data: File,
peer_addr: PeerAddr
) -> bool
Writes a reading view on a txhashset state that's been provided to us. If we're willing to accept that new state, the data stream will be read as a zip file, unzipped and the resulting state files should be rewound to the provided indexes.
Implementors
impl ChainAdapter for DummyAdapter
[src]
fn total_difficulty(&self) -> Difficulty
[src]
fn total_height(&self) -> u64
[src]
fn get_transaction(&self, _h: Hash) -> Option<Transaction>
[src]
fn tx_kernel_received(&self, _h: Hash, _addr: PeerAddr)
[src]
fn transaction_received(&self, _: Transaction, _stem: bool)
[src]
fn compact_block_received(&self, _cb: CompactBlock, _addr: PeerAddr) -> bool
[src]
fn header_received(&self, _bh: BlockHeader, _addr: PeerAddr) -> bool
[src]
fn block_received(&self, _: Block, _: PeerAddr, _: bool) -> bool
[src]
fn headers_received(&self, _: &[BlockHeader], _: PeerAddr) -> bool
[src]
fn locate_headers(&self, _: &[Hash]) -> Vec<BlockHeader>
[src]
fn get_block(&self, _: Hash) -> Option<Block>
[src]
fn txhashset_read(&self, _h: Hash) -> Option<TxHashSetRead>
[src]
fn txhashset_receive_ready(&self) -> bool
[src]
fn txhashset_write(
&self,
_h: Hash,
_txhashset_data: File,
_peer_addr: PeerAddr
) -> bool
[src]
&self,
_h: Hash,
_txhashset_data: File,
_peer_addr: PeerAddr
) -> bool
fn txhashset_download_update(
&self,
_start_time: DateTime<Utc>,
_downloaded_size: u64,
_total_size: u64
) -> bool
[src]
&self,
_start_time: DateTime<Utc>,
_downloaded_size: u64,
_total_size: u64
) -> bool
impl ChainAdapter for Peers
[src]
fn total_difficulty(&self) -> Difficulty
[src]
fn total_height(&self) -> u64
[src]
fn get_transaction(&self, kernel_hash: Hash) -> Option<Transaction>
[src]
fn tx_kernel_received(&self, kernel_hash: Hash, addr: PeerAddr)
[src]
fn transaction_received(&self, tx: Transaction, stem: bool)
[src]
fn block_received(
&self,
b: Block,
peer_addr: PeerAddr,
was_requested: bool
) -> bool
[src]
&self,
b: Block,
peer_addr: PeerAddr,
was_requested: bool
) -> bool
fn compact_block_received(&self, cb: CompactBlock, peer_addr: PeerAddr) -> bool
[src]
fn header_received(&self, bh: BlockHeader, peer_addr: PeerAddr) -> bool
[src]
fn headers_received(&self, headers: &[BlockHeader], peer_addr: PeerAddr) -> bool
[src]
fn locate_headers(&self, hs: &[Hash]) -> Vec<BlockHeader>
[src]
fn get_block(&self, h: Hash) -> Option<Block>
[src]
fn txhashset_read(&self, h: Hash) -> Option<TxHashSetRead>
[src]
fn txhashset_receive_ready(&self) -> bool
[src]
fn txhashset_write(
&self,
h: Hash,
txhashset_data: File,
peer_addr: PeerAddr
) -> bool
[src]
&self,
h: Hash,
txhashset_data: File,
peer_addr: PeerAddr
) -> bool
fn txhashset_download_update(
&self,
start_time: DateTime<Utc>,
downloaded_size: u64,
total_size: u64
) -> bool
[src]
&self,
start_time: DateTime<Utc>,
downloaded_size: u64,
total_size: u64
) -> bool