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

source

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>

source

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

source

pub fn relay_transaction_impl(&self, txid: u256, wtxid: u256)

source§

impl PeerManager

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source§

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

source§

impl AlreadyHaveBlock for PeerManager

source§

fn already_have_block(self: Arc<Self>, block_hash: &u256) -> bool

source§

impl AlreadyHaveTx for PeerManager

source§

fn already_have_tx(self: Arc<Self>, gtxid: &GenTxId) -> bool

source§

impl BlockChecked for PeerManager

source§

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

source§

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

source§

fn block_disconnected(&mut self, block: Arc<Block>, pindex: Arc<BlockIndex>)

| Notifies listeners of a block being | disconnected | | Called on a background thread. |
source§

impl BlockRequestAllowed for PeerManager

source§

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

source§

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

source§

fn can_direct_fetch(self: Arc<Self>) -> bool

source§

impl CheckForStaleTipAndEvictPeers for PeerManager

source§

fn check_for_stale_tip_and_evict_peers(self: Arc<Self>)

| Evict extra outbound peers. If we think | our tip may be stale, connect to an extra | outbound. | | Public for unit testing. |
source§

impl ConsiderEviction for PeerManager

source§

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

source§

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

source§

fn finalize_node( &mut self, node: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>> )

| Handle removal of a peer (clear state) |
source§

impl FindNextBlocksToDownload for PeerManager

source§

fn find_next_blocks_to_download( self: Arc<Self>, nodeid: NodeId, count: u32, blocks: &mut Vec<Option<Arc<BlockIndex>>>, node_staller: &mut NodeId )

| Update pindexLastCommonBlock and | add not-in-flight missing successors | to vBlocks, until it has at most count | entries. |

source§

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

| 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

source§

fn get_node_state_stats( &self, nodeid: NodeId, stats: &mut NodeStateStats ) -> bool

| Get statistics from node state |
source§

impl GetPeerRef for PeerManager

source§

fn get_peer_ref(&self, id: NodeId) -> Amo<Peer>

| Get a shared pointer to the Peer object. | | May return an empty shared_ptr if the | Peer object can’t be found. |

source§

impl IgnoresIncomingTxs for PeerManager

source§

fn ignores_incoming_txs(&mut self) -> bool

| Whether this node ignores txs received | over p2p. |
source§

impl InitializeNode for PeerManager

source§

fn initialize_node( &mut self, pnode: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>> )

| Initialize a peer (setup state, queue | any initial messages) |
source§

impl IsBlockRequested for PeerManager

source§

fn is_block_requested(&self, hash: &u256) -> bool

| Have we requested this block from a peer |
source§

impl MaybeDiscourageAndDisconnect for PeerManager

source§

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

source§

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

source§

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

source§

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

source§

fn maybe_send_feefilter( self: Arc<Self>, pto: Amo<Box<dyn NodeInterface>>, current_time: OffsetDateTime )

| Send feefilter message. |

source§

impl MaybeSendPing for PeerManager

source§

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

source§

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

source§

fn misbehaving(&self, pnode: NodeId, howmuch: i32, message: &str)

| Increment peer’s misbehavior score. | If the new value >= DISCOURAGEMENT_THRESHOLD, | mark the node to be discouraged, meaning | the peer might be disconnected and added | to the discouragement filter. | | Public for unit testing. |
source§

impl NewPowValidBlock for PeerManager

source§

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

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

| 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

source§

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

source§

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

source§

fn process_get_block_data( self: Arc<Self>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, peer: Amo<Peer>, inv: &Inv )

source§

impl ProcessGetCfCheckPt for PeerManager

source§

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

source§

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

source§

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

source§

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

source§

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

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 )

| Process a single message from a peer. | Public for fuzz testing |
source§

impl ProcessMessages for PeerManager

source§

fn process_messages( self: Arc<Self>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, interrupt_msg_proc: &AtomicBool ) -> bool

| Process protocol messages received | from a given node | | ———– | @param[in] pnode | | The node which we have received messages | from. | ––––– | @param[in] interrupt | | Interrupt condition for processing | threads | | ———– | @return | | True if there is more work to be done |
source§

impl ProcessOrphanTx for PeerManager

source§

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

source§

fn push_node_version( &self, pnode: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, n_time: &OffsetDateTime )

| Send a version message to a peer |

source§

impl ReattemptInitialBroadcast for PeerManager

source§

fn reattempt_initial_broadcast( self: Arc<Self>, scheduler: Arc<Mutex<Scheduler>> )

| Retrieve unbroadcast transactions | from the mempool and reattempt sending | to peers |

source§

impl RelayAddress for PeerManager

source§

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

source§

fn relay_transaction(self: Arc<Self>, txid: &u256, wtxid: &u256)

| Relay transaction to all peers. |
source§

impl RemoveBlockRequest for PeerManager

source§

fn remove_block_request(&self, hash: &u256)

| Remove this block from our tracked requested | blocks. Called if: | | - the block has been received from a peer | | - the request for the block has timed | out |
source§

impl RemovePeer for PeerManager

source§

fn remove_peer(&mut self, id: NodeId) -> Amo<Peer>

| Get a shared pointer to the Peer object | and remove it from m_peer_map. | | May return an empty shared_ptr if the | Peer object can’t be found. |

source§

impl SendBlockTransactions for PeerManager

source§

fn send_block_transactions( self: Arc<Self>, pfrom: &mut AmoWriteGuard<'_, Box<dyn NodeInterface>>, block: &Block, req: &BlockTransactionsRequest )

source§

impl SendMessages for PeerManager

source§

fn send_messages(self: Arc<Self>, pto: Amo<Box<dyn NodeInterface>>) -> bool

| Send queued protocol messages to a given | node. | | ———– | @param[in] pnode | | The node which we are sending messages | to. | | ———– | @return | | True if there is more work to be done |
source§

impl SendPings for PeerManager

source§

fn send_pings(&mut self)

| Send ping message to all peers |
source§

impl SetBestHeight for PeerManager

source§

fn set_best_height(&mut self, height: i32)

| Set the best height |
source§

impl SetupAddressRelay for PeerManager

source§

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

source§

fn start_scheduled_tasks(self: Arc<Self>, scheduler: Arc<Mutex<Scheduler>>)

| Begin running background tasks, should | only be called once |
source§

impl TipMayBeStale for PeerManager

source§

fn tip_may_be_stale(self: Arc<Self>) -> bool

source§

impl UpdateBlockAvailability for PeerManager

source§

fn update_block_availability(self: Arc<Self>, nodeid: NodeId, hash: &u256)

| Update tracking information about | which blocks a peer is assumed to have. |

source§

impl UpdatedBlockTip for PeerManager

source§

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. |

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, U> CastInto<U> for Twhere U: CastFrom<T>,

§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> StaticUpcast<T> for T

§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V