Struct bitcoin_peerman::PeerManager
source · pub struct PeerManager {Show 16 fields
pub chainparams: Arc<ChainParams>,
pub connman: Amo<Connman>,
pub addrman: Amo<AddrMan>,
pub banman: Amo<BanMan>,
pub chainman: Amo<ChainstateManager>,
pub mempool: Amo<TxMemPool>,
pub best_height: Atomic<i32>,
pub stale_tip_check_time: Atomic<OffsetDateTime>,
pub ignore_incoming_txs: bool,
pub initial_sync_finished: AtomicBool,
pub peer_map: Amo<PeerMap>,
pub recent_confirmed_transactions_mutex: Amo<PeerManagerRecentConfirmedTransactions>,
pub last_tip_update: Atomic<Option<OffsetDateTime>>,
pub orphanage: Arc<TxOrphanage>,
pub orphan_data: PeerManagerOrphans,
pub inner: Arc<Mutex<PeerManagerInner>>,
}Fields§
§chainparams: Arc<ChainParams>§connman: Amo<Connman>§addrman: Amo<AddrMan>§banman: Amo<BanMan>| Pointer to this node’s banman. May be | nullptr - check existence before dereferencing. |
chainman: Amo<ChainstateManager>§mempool: Amo<TxMemPool>§best_height: Atomic<i32>| The height of the best chain |
stale_tip_check_time: Atomic<OffsetDateTime>| Next time to check for stale tip |
ignore_incoming_txs: bool| Whether this node is running in blocks | only mode |
initial_sync_finished: AtomicBool| Whether we’ve completed initial sync | yet, for determining when to turn on | extra block-relay-only peers. |
peer_map: Amo<PeerMap>| Protects m_peer_map. This mutex must | not be locked while holding a lock on | any of the mutexes inside a Peer object. |
recent_confirmed_transactions_mutex: Amo<PeerManagerRecentConfirmedTransactions>| Filter for transactions that have been | recently confirmed. | | We use this to avoid requesting transactions | that have already been confirnmed. | | Blocks don’t typically have more than | 4000 transactions, so this should be | at least six blocks (~1 hr) worth of transactions | that we can store, inserting both a txid | and wtxid for every observed transaction. | | If the number of transactions appearing | in a block goes up, or if we are seeing | getdata requests more than an hour after | initial announcement, we can increase | this number. | | The false positive rate of 1/1M should | come out to less than 1 transaction per | day that would be inadvertently ignored | (which is the same probability that | we have in the reject filter). |
last_tip_update: Atomic<Option<OffsetDateTime>>| When our tip was last updated. |
orphanage: Arc<TxOrphanage>| Storage for orphan information |
orphan_data: PeerManagerOrphans§inner: Arc<Mutex<PeerManagerInner>>Implementations§
source§impl PeerManager
impl PeerManager
pub fn make( &mut self, chainparams: &ChainParams, connman: &mut Connman, addrman: &mut AddrMan, banman: *mut BanMan, chainman: &mut ChainstateManager, pool: &mut TxMemPool, ignore_incoming_txs: bool ) -> Box<PeerManager>
pub fn new( chainparams: &ChainParams, connman: &mut Connman, addrman: &mut AddrMan, banman: *mut BanMan, chainman: &mut ChainstateManager, pool: &mut TxMemPool, ignore_incoming_txs: bool ) -> Self
pub fn relay_transaction_impl(&self, txid: u256, wtxid: u256)
source§impl PeerManager
impl PeerManager
pub fn process_addr_message( self: Arc<Self>, peer: &mut Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_block_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_blocktxn_message( self: Arc<Self>, peer: &Option<Peer>, msg_maker: &NetMsgMaker, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_cmpctblock_message( self: Arc<Self>, peer: &Option<Peer>, msg_maker: &NetMsgMaker, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_feefilter_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_filteradd_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_filterclear_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_filterload_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_getaddr_message( self: Arc<Self>, peer: &mut Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_getblocks_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_getblockstxn_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_getdata_message( self: Arc<Self>, peer: Amo<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_getheaders_message( self: Arc<Self>, peer: &Option<Peer>, msg_maker: &NetMsgMaker, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_headers_message( self: Arc<Self>, peer: &Option<Peer>, msg_maker: NetMsgMaker, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_inv_message( self: Arc<Self>, peer: &Option<Peer>, msg_maker: &NetMsgMaker, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_mempool_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_notfound_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_ping_message( self: Arc<Self>, peer: &Option<Peer>, msg_maker: &NetMsgMaker, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_pong_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_sendaddrv2_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_sendcmpct_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_sendheaders_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_tx_message( self: Arc<Self>, peer: Amo<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_verack_message( self: Arc<Self>, peer: &Option<Peer>, msg_maker: NetMsgMaker, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_version_message( self: Arc<Self>, peer: &mut Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl PeerManager
impl PeerManager
pub fn process_wtxidrelay_message( self: Arc<Self>, peer: &Option<Peer>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
Trait Implementations§
source§impl AddTxAnnouncement for PeerManager
impl AddTxAnnouncement for PeerManager
source§fn add_tx_announcement(
self: Arc<Self>,
node: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>,
gtxid: &GenTxId,
current_time: OffsetDateTime
)
fn add_tx_announcement( self: Arc<Self>, node: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, gtxid: &GenTxId, current_time: OffsetDateTime )
| Register with TxRequestTracker that | an INV has been received from a peer. | The announcement parameters are decided | in PeerManager and then passed to TxRequestTracker. |
source§impl AddtoCompactExtraTransactions for PeerManager
impl AddtoCompactExtraTransactions for PeerManager
fn add_to_compact_extra_transactions(self: Arc<Self>, tx: &TransactionRef)
source§impl AlreadyHaveBlock for PeerManager
impl AlreadyHaveBlock for PeerManager
source§impl AlreadyHaveTx for PeerManager
impl AlreadyHaveTx for PeerManager
source§impl BlockChecked for PeerManager
impl BlockChecked for PeerManager
source§fn block_checked(self: Arc<Self>, block: &Block, state: &BlockValidationState)
fn block_checked(self: Arc<Self>, block: &Block, state: &BlockValidationState)
| Handle invalid block rejection and | consequent peer discouragement, maintain | which peers announce compact blocks. |
source§impl BlockConnected for PeerManager
impl BlockConnected for PeerManager
source§fn block_connected(&mut self, pblock: Arc<Block>, pindex: Arc<BlockIndex>)
fn block_connected(&mut self, pblock: Arc<Block>, pindex: Arc<BlockIndex>)
| Evict orphan txn pool entries based | on a newly connected block, remember | the recently confirmed transactions, | and delete tracked announcements for | them. Also save the time of the last tip | update. |
source§impl BlockDisconnected for PeerManager
impl BlockDisconnected for PeerManager
source§fn block_disconnected(&mut self, block: Arc<Block>, pindex: Arc<BlockIndex>)
fn block_disconnected(&mut self, block: Arc<Block>, pindex: Arc<BlockIndex>)
source§impl BlockRequestAllowed for PeerManager
impl BlockRequestAllowed for PeerManager
source§fn block_request_allowed(
self: Arc<Self>,
pindex: Option<Arc<BlockIndex>>
) -> bool
fn block_request_allowed( self: Arc<Self>, pindex: Option<Arc<BlockIndex>> ) -> bool
| To prevent fingerprinting attacks, | only send blocks/headers outside of | the active chain if they are no more than | a month older (both in time, and in best | equivalent proof of work) than the best | header chain we know about and we fully-validated | them at some point. |
source§impl BlockRequested for PeerManager
impl BlockRequested for PeerManager
source§fn block_requested(
self: Arc<Self>,
nodeid: NodeId,
block: Option<Arc<BlockIndex>>,
pit: Amo<QueuedBlockIter>
) -> bool
fn block_requested( self: Arc<Self>, nodeid: NodeId, block: Option<Arc<BlockIndex>>, pit: Amo<QueuedBlockIter> ) -> bool
| Mark a block as in flight | | Returns false, still setting pit, if | the block was already in flight from | the same peer pit will only be valid as | long as the same CS_MAIN lock is being | held |
source§impl CanDirectFetch for PeerManager
impl CanDirectFetch for PeerManager
fn can_direct_fetch(self: Arc<Self>) -> bool
source§impl CheckForStaleTipAndEvictPeers for PeerManager
impl CheckForStaleTipAndEvictPeers for PeerManager
source§fn check_for_stale_tip_and_evict_peers(self: Arc<Self>)
fn check_for_stale_tip_and_evict_peers(self: Arc<Self>)
source§impl ConsiderEviction for PeerManager
impl ConsiderEviction for PeerManager
source§fn consider_eviction(
self: Arc<Self>,
pto: Amo<Box<dyn NodeInterface>>,
time_in_seconds: OffsetDateTime
)
fn consider_eviction( self: Arc<Self>, pto: Amo<Box<dyn NodeInterface>>, time_in_seconds: OffsetDateTime )
| Consider evicting an outbound peer | based on the amount of time they’ve been | behind our tip |
source§impl EvictExtraOutboundPeers for PeerManager
impl EvictExtraOutboundPeers for PeerManager
source§fn evict_extra_outbound_peers(self: Arc<Self>, time_in_seconds: OffsetDateTime)
fn evict_extra_outbound_peers(self: Arc<Self>, time_in_seconds: OffsetDateTime)
| If we have extra outbound peers, try | to disconnect the one with the oldest | block announcement |
source§impl FinalizeNode for PeerManager
impl FinalizeNode for PeerManager
source§fn finalize_node(
&mut self,
node: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>
)
fn finalize_node( &mut self, node: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>> )
source§impl FindTxForGetData for PeerManager
impl FindTxForGetData for PeerManager
source§fn find_tx_for_get_data(
self: Arc<Self>,
peer: &dyn NodeInterface,
gtxid: &GenTxId,
mempool_req: Option<OffsetDateTime>,
now: OffsetDateTime
) -> TransactionRef
fn find_tx_for_get_data( self: Arc<Self>, peer: &dyn NodeInterface, gtxid: &GenTxId, mempool_req: Option<OffsetDateTime>, now: OffsetDateTime ) -> TransactionRef
| Determine whether or not a peer can request | a transaction, and return it (or nullptr | if not found or not allowed). |
source§impl GetNodeStateStats for PeerManager
impl GetNodeStateStats for PeerManager
source§fn get_node_state_stats(
&self,
nodeid: NodeId,
stats: &mut NodeStateStats
) -> bool
fn get_node_state_stats( &self, nodeid: NodeId, stats: &mut NodeStateStats ) -> bool
source§impl GetPeerRef for PeerManager
impl GetPeerRef for PeerManager
source§impl IgnoresIncomingTxs for PeerManager
impl IgnoresIncomingTxs for PeerManager
source§fn ignores_incoming_txs(&mut self) -> bool
fn ignores_incoming_txs(&mut self) -> bool
source§impl InitializeNode for PeerManager
impl InitializeNode for PeerManager
source§fn initialize_node(
&mut self,
pnode: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>
)
fn initialize_node( &mut self, pnode: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>> )
source§impl IsBlockRequested for PeerManager
impl IsBlockRequested for PeerManager
source§fn is_block_requested(&self, hash: &u256) -> bool
fn is_block_requested(&self, hash: &u256) -> bool
source§impl MaybeDiscourageAndDisconnect for PeerManager
impl MaybeDiscourageAndDisconnect for PeerManager
source§fn maybe_discourage_and_disconnect(
self: Arc<Self>,
pnode: Amo<Box<dyn NodeInterface>>,
peer: &mut Peer
) -> bool
fn maybe_discourage_and_disconnect( self: Arc<Self>, pnode: Amo<Box<dyn NodeInterface>>, peer: &mut Peer ) -> bool
| Maybe disconnect a peer and discourage | future connections from its address. | | ———– | @param[in] pnode | | The node to check. | ––––– | @param[in] peer | | The peer object to check. | | ———– | @return | | True if the peer was marked for disconnection | in this function |
source§impl MaybePunishNodeForBlock for PeerManager
impl MaybePunishNodeForBlock for PeerManager
source§fn maybe_punish_node_for_block(
&self,
nodeid: NodeId,
state: &BlockValidationState,
via_compact_block: bool,
message: Option<&str>
) -> bool
fn maybe_punish_node_for_block( &self, nodeid: NodeId, state: &BlockValidationState, via_compact_block: bool, message: Option<&str> ) -> bool
| Potentially mark a node discouraged | based on the contents of a BlockValidationState | object | | ———– | @param[in] via_compact_block | | this bool is passed in because net_processing | should punish peers differently depending | on whether the data was provided in a | compact block message or not. If the | compact block had a valid header, but | contained invalid txs, the peer should | not be punished. See BIP 152. | | ———– | @return | | Returns true if the peer was punished | (probably disconnected) |
source§impl MaybePunishNodeForTx for PeerManager
impl MaybePunishNodeForTx for PeerManager
source§fn maybe_punish_node_for_tx(
self: Arc<Self>,
nodeid: NodeId,
state: &TxValidationState,
message: Option<&str>
) -> bool
fn maybe_punish_node_for_tx( self: Arc<Self>, nodeid: NodeId, state: &TxValidationState, message: Option<&str> ) -> bool
| Potentially disconnect and discourage | a node based on the contents of a TxValidationState | object | | | ———– | @return | | Returns true if the peer was punished | (probably disconnected) |
source§impl MaybeSendAddr for PeerManager
impl MaybeSendAddr for PeerManager
source§fn maybe_send_addr(
self: Arc<Self>,
node: Amo<Box<dyn NodeInterface>>,
peer: &mut Peer,
current_time: OffsetDateTime
)
fn maybe_send_addr( self: Arc<Self>, node: Amo<Box<dyn NodeInterface>>, peer: &mut Peer, current_time: OffsetDateTime )
| Send addr messages on a regular schedule.
|
source§impl MaybeSendFeeFilter for PeerManager
impl MaybeSendFeeFilter for PeerManager
source§fn maybe_send_feefilter(
self: Arc<Self>,
pto: Amo<Box<dyn NodeInterface>>,
current_time: OffsetDateTime
)
fn maybe_send_feefilter( self: Arc<Self>, pto: Amo<Box<dyn NodeInterface>>, current_time: OffsetDateTime )
| Send feefilter message.
|
source§impl MaybeSendPing for PeerManager
impl MaybeSendPing for PeerManager
source§fn maybe_send_ping(
self: Arc<Self>,
node_to: Amo<Box<dyn NodeInterface>>,
peer: Amo<Peer>,
now: OffsetDateTime
)
fn maybe_send_ping( self: Arc<Self>, node_to: Amo<Box<dyn NodeInterface>>, peer: Amo<Peer>, now: OffsetDateTime )
| Send a ping message every PING_INTERVAL | or if requested via RPC. May mark the | peer to be disconnected if a ping has | timed out. | | We use mockable time for ping timeouts, | so setmocktime may cause pings to time | out. |
source§impl MaybeSetPeerAsAnnouncingHeaderAndIds for PeerManager
impl MaybeSetPeerAsAnnouncingHeaderAndIds for PeerManager
source§fn maybe_set_peer_as_announcing_header_and_ids(self: Arc<Self>, nodeid: NodeId)
fn maybe_set_peer_as_announcing_header_and_ids(self: Arc<Self>, nodeid: NodeId)
| When a peer sends us a valid block, instruct | it to announce blocks to us using CMPCTBLOCK | if possible by adding its nodeid to the | end of lNodesAnnouncingHeaderAndIDs, | and keeping that list under a certain | size by removing the first element if | necessary. |
source§impl Misbehaving for PeerManager
impl Misbehaving for PeerManager
source§fn misbehaving(&self, pnode: NodeId, howmuch: i32, message: &str)
fn misbehaving(&self, pnode: NodeId, howmuch: i32, message: &str)
source§impl NewPowValidBlock for PeerManager
impl NewPowValidBlock for PeerManager
source§fn new_pow_valid_block(
self: Arc<Self>,
pindex: Arc<BlockIndex>,
pblock: Amo<Block>
)
fn new_pow_valid_block( self: Arc<Self>, pindex: Arc<BlockIndex>, pblock: Amo<Block> )
| Maintain state about the best-seen | block and fast-announce a compact block | to compatible peers. |
source§impl PrepareBlockFilterRequest for PeerManager
impl PrepareBlockFilterRequest for PeerManager
source§fn prepare_block_filter_request(
self: Arc<Self>,
peer: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>,
filter_type: BlockFilterType,
start_height: u32,
stop_hash: &u256,
max_height_diff: u32,
stop_index: &mut Option<Arc<BlockIndex>>,
filter_index: &mut Amo<BlockFilterIndex>
) -> bool
fn prepare_block_filter_request( self: Arc<Self>, peer: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, filter_type: BlockFilterType, start_height: u32, stop_hash: &u256, max_height_diff: u32, stop_index: &mut Option<Arc<BlockIndex>>, filter_index: &mut Amo<BlockFilterIndex> ) -> bool
| Validation logic for compact filters | request handling. | | May disconnect from the peer in the case | of a bad request. | | ———– | @param[in] peer | | The peer that we received the request | from | ––––– | @param[in] filter_type | | The filter type the request is for. Must | be basic filters. | ––––– | @param[in] start_height | | The start height for the request | ––––– | @param[in] stop_hash | | The stop_hash for the request | ––––– | @param[in] max_height_diff | | The maximum number of items permitted | to request, as specified in BIP 157 | ––––– | @param[out] stop_index | | The CBlockIndex for the stop_hash block, | if the request can be serviced. | ––––– | @param[out] filter_index | | The filter index, if the request can | be serviced. | | ———– | @return | | True if the request can be serviced. |
source§impl ProcessBlock for PeerManager
impl ProcessBlock for PeerManager
source§fn process_block(
self: Arc<Self>,
node: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>,
block: Amo<Block>,
force_processing: bool
)
fn process_block( self: Arc<Self>, node: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, block: Amo<Block>, force_processing: bool )
| Process a new block. Perform any post-processing | housekeeping |
source§impl ProcessBlockAvailability for PeerManager
impl ProcessBlockAvailability for PeerManager
source§fn process_block_availability(self: Arc<Self>, nodeid: NodeId)
fn process_block_availability(self: Arc<Self>, nodeid: NodeId)
| Check whether the last unknown block | a peer advertised is not yet known. |
source§impl ProcessGetBlockData for PeerManager
impl ProcessGetBlockData for PeerManager
fn process_get_block_data( self: Arc<Self>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, peer: Amo<Peer>, inv: &Inv )
source§impl ProcessGetCfCheckPt for PeerManager
impl ProcessGetCfCheckPt for PeerManager
source§fn process_get_cf_check_pt(
self: Arc<Self>,
peer: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>,
recv: &mut DataStream
)
fn process_get_cf_check_pt( self: Arc<Self>, peer: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, recv: &mut DataStream )
| Handle a getcfcheckpt request. | | May disconnect from the peer in the case | of a bad request. | | ———– | @param[in] peer | | The peer that we received the request | from | ––––– | @param[in] vRecv | | The raw message received |
source§impl ProcessGetCfHeaders for PeerManager
impl ProcessGetCfHeaders for PeerManager
source§fn process_get_cf_headers(
self: Arc<Self>,
peer: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>,
recv: &mut DataStream
)
fn process_get_cf_headers( self: Arc<Self>, peer: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, recv: &mut DataStream )
| Handle a cfheaders request. | | May disconnect from the peer in the case | of a bad request. | | ———– | @param[in] peer | | The peer that we received the request | from | ––––– | @param[in] vRecv | | The raw message received |
source§impl ProcessGetData for PeerManager
impl ProcessGetData for PeerManager
fn process_get_data( self: Arc<Self>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, peer: Amo<Peer>, interrupt_msg_proc: &AtomicBool )
source§impl ProcessGetFilters for PeerManager
impl ProcessGetFilters for PeerManager
source§fn process_get_filters(
self: Arc<Self>,
peer: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>,
recv: &mut DataStream
)
fn process_get_filters( self: Arc<Self>, peer: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, recv: &mut DataStream )
| Handle a filters request. | | May disconnect from the peer in the case | of a bad request. | | ———– | @param[in] peer | | The peer that we received the request | from | ––––– | @param[in] vRecv | | The raw message received |
source§impl ProcessHeadersMessage for PeerManager
impl ProcessHeadersMessage for PeerManager
source§fn process_headers_basic(
self: Arc<Self>,
pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>,
peer: &Peer,
headers: &Vec<BlockHeader>,
via_compact_block: bool
)
fn process_headers_basic( self: Arc<Self>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, peer: &Peer, headers: &Vec<BlockHeader>, via_compact_block: bool )
| Process a single headers message from | a peer. |
source§impl ProcessMessage for PeerManager
impl ProcessMessage for PeerManager
source§fn process_message(
self: Arc<Self>,
pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>,
msg_type: &str,
recv: &mut DataStream,
time_received: &OffsetDateTime,
interrupt_msg_proc: &AtomicBool
)
fn process_message( self: Arc<Self>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, msg_type: &str, recv: &mut DataStream, time_received: &OffsetDateTime, interrupt_msg_proc: &AtomicBool )
source§impl ProcessMessages for PeerManager
impl ProcessMessages for PeerManager
source§fn process_messages(
self: Arc<Self>,
pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>,
interrupt_msg_proc: &AtomicBool
) -> bool
fn process_messages( self: Arc<Self>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, interrupt_msg_proc: &AtomicBool ) -> bool
source§impl ProcessOrphanTx for PeerManager
impl ProcessOrphanTx for PeerManager
source§fn process_orphan_tx(self: Arc<Self>, orphan_work_set: &mut HashSet<u256>)
fn process_orphan_tx(self: Arc<Self>, orphan_work_set: &mut HashSet<u256>)
| Reconsider orphan transactions after | a parent has been accepted to the mempool. | | ———– | @param[in,out] orphan_work_set | | The set of orphan transactions to reconsider. | Generally only one orphan will be reconsidered | on each call of this function. This set | may be added to if accepting an orphan | causes its children to be reconsidered. |
source§impl PushNodeVersion for PeerManager
impl PushNodeVersion for PeerManager
source§fn push_node_version(
&self,
pnode: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>,
n_time: &OffsetDateTime
)
fn push_node_version( &self, pnode: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, n_time: &OffsetDateTime )
| Send a version message to a peer |
source§impl RelayAddress for PeerManager
impl RelayAddress for PeerManager
source§fn relay_address(
self: Arc<Self>,
originator: NodeId,
addr: &Address,
reachable: bool
)
fn relay_address( self: Arc<Self>, originator: NodeId, addr: &Address, reachable: bool )
| Relay (gossip) an address to a few randomly | chosen nodes. | | ———– | @param[in] originator | | The id of the peer that sent us the address. | We don’t want to relay it back. | ––––– | @param[in] addr | | Address to relay. | ––––– | @param[in] fReachable | | Whether the address’ network is reachable. | We relay unreachable addresses less. |
source§impl RelayTransaction for PeerManager
impl RelayTransaction for PeerManager
source§impl RemoveBlockRequest for PeerManager
impl RemoveBlockRequest for PeerManager
source§fn remove_block_request(&self, hash: &u256)
fn remove_block_request(&self, hash: &u256)
source§impl RemovePeer for PeerManager
impl RemovePeer for PeerManager
source§impl SendBlockTransactions for PeerManager
impl SendBlockTransactions for PeerManager
fn send_block_transactions( self: Arc<Self>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, block: &Block, req: &BlockTransactionsRequest )
source§impl SendMessages for PeerManager
impl SendMessages for PeerManager
source§fn send_messages(self: Arc<Self>, pto: Amo<Box<dyn NodeInterface>>) -> bool
fn send_messages(self: Arc<Self>, pto: Amo<Box<dyn NodeInterface>>) -> bool
source§impl SendPings for PeerManager
impl SendPings for PeerManager
source§fn send_pings(&mut self)
fn send_pings(&mut self)
source§impl SetBestHeight for PeerManager
impl SetBestHeight for PeerManager
source§fn set_best_height(&mut self, height: i32)
fn set_best_height(&mut self, height: i32)
source§impl SetupAddressRelay for PeerManager
impl SetupAddressRelay for PeerManager
source§fn setup_address_relay(
self: Arc<Self>,
node: &dyn NodeInterface,
peer: &mut Peer
) -> bool
fn setup_address_relay( self: Arc<Self>, node: &dyn NodeInterface, peer: &mut Peer ) -> bool
| Checks if address relay is permitted | with peer. If needed, initializes the | m_addr_known bloom filter and sets | m_addr_relay_enabled to true. | | | ———– | @return | | True if address relay is enabled with | peer | | False if address relay is disallowed |
source§impl StartScheduledTasks for PeerManager
impl StartScheduledTasks for PeerManager
source§impl TipMayBeStale for PeerManager
impl TipMayBeStale for PeerManager
fn tip_may_be_stale(self: Arc<Self>) -> bool
source§impl UpdatedBlockTip for PeerManager
impl UpdatedBlockTip for PeerManager
source§fn updated_block_tip(
&mut self,
pindex_new: Option<Arc<BlockIndex>>,
pindex_fork: Option<Arc<BlockIndex>>,
initial_download: bool
)
fn updated_block_tip( &mut self, pindex_new: Option<Arc<BlockIndex>>, pindex_fork: Option<Arc<BlockIndex>>, initial_download: bool )
| Update our best height and announce | any block hashes which weren’t previously | in m_chainman.ActiveChain() to our | peers. |