![]() |
BSHA3
0.17.99
P2P Blockchain, based on Bitcoin
|
#include <net_processing.h>
Public Member Functions | |
PeerLogicValidation (CConnman *connman, CScheduler &scheduler, bool enable_bip61) | |
void | BlockConnected (const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexConnected, const std::vector< CTransactionRef > &vtxConflicted) override |
Overridden from CValidationInterface. More... | |
void | UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override |
Overridden from CValidationInterface. More... | |
void | BlockChecked (const CBlock &block, const CValidationState &state) override |
Overridden from CValidationInterface. More... | |
void | NewPoWValidBlock (const CBlockIndex *pindex, const std::shared_ptr< const CBlock > &pblock) override |
Overridden from CValidationInterface. More... | |
void | InitializeNode (CNode *pnode) override |
Initialize a peer by adding it to mapNodeState and pushing a message requesting its version. More... | |
void | FinalizeNode (NodeId nodeid, bool &fUpdateConnectionTime) override |
Handle removal of a peer by updating various state and removing it from mapNodeState. More... | |
bool | ProcessMessages (CNode *pfrom, std::atomic< bool > &interrupt) override |
Process protocol messages received from a given node. More... | |
bool | SendMessages (CNode *pto) override EXCLUSIVE_LOCKS_REQUIRED(pto -> cs_sendProcessing) |
Send queued protocol messages to be sent to a give node. More... | |
void | ConsiderEviction (CNode *pto, int64_t time_in_seconds) EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
Consider evicting an outbound peer based on the amount of time they've been behind our tip. More... | |
void | CheckForStaleTipAndEvictPeers (const Consensus::Params &consensusParams) |
Evict extra outbound peers. More... | |
void | EvictExtraOutboundPeers (int64_t time_in_seconds) EXCLUSIVE_LOCKS_REQUIRED(cs_main) |
If we have extra outbound peers, try to disconnect the one with the oldest block announcement. More... | |
Private Attributes | |
CConnman *const | connman |
int64_t | m_stale_tip_check_time |
Next time to check for stale tip. More... | |
const bool | m_enable_bip61 |
Enable BIP61 (sending reject messages) More... | |
Additional Inherited Members | |
![]() | |
~CValidationInterface ()=default | |
Protected destructor so that instances can only be deleted by derived classes. More... | |
virtual void | TransactionAddedToMempool (const CTransactionRef &ptxn) |
Notifies listeners of a transaction having been added to mempool. More... | |
virtual void | TransactionRemovedFromMempool (const CTransactionRef &ptx) |
Notifies listeners of a transaction leaving mempool. More... | |
virtual void | BlockDisconnected (const std::shared_ptr< const CBlock > &block) |
Notifies listeners of a block being disconnected. More... | |
virtual void | ChainStateFlushed (const CBlockLocator &locator) |
Notifies listeners of the new active block chain on-disk. More... | |
virtual void | ResendWalletTransactions (int64_t nBestBlockTime, CConnman *connman) |
Tells listeners to broadcast their data. More... | |
virtual void | BlockFound (const uint256 &hash) |
friend | void ::RegisterValidationInterface (CValidationInterface *) |
friend | void ::UnregisterValidationInterface (CValidationInterface *) |
friend | void ::UnregisterAllValidationInterfaces () |
![]() | |
~NetEventsInterface ()=default | |
Protected destructor so that instances can only be deleted by derived classes. More... | |
Definition at line 23 of file net_processing.h.
|
explicit |
Definition at line 843 of file net_processing.cpp.
|
overridevirtual |
Overridden from CValidationInterface.
Handle invalid block rejection and consequent peer banning, maintain which peers announce compact blocks.
Reimplemented from CValidationInterface.
Definition at line 988 of file net_processing.cpp.
|
overridevirtual |
Overridden from CValidationInterface.
Evict orphan txn pool entries (EraseOrphanTx) based on a newly connected block.
Also save the time of the last tip update.
Reimplemented from CValidationInterface.
Definition at line 862 of file net_processing.cpp.
void PeerLogicValidation::CheckForStaleTipAndEvictPeers | ( | const Consensus::Params & | consensusParams | ) |
Evict extra outbound peers.
If we think our tip may be stale, connect to an extra outbound
Definition at line 3193 of file net_processing.cpp.
void PeerLogicValidation::ConsiderEviction | ( | CNode * | pto, |
int64_t | time_in_seconds | ||
) |
Consider evicting an outbound peer based on the amount of time they've been behind our tip.
Definition at line 3083 of file net_processing.cpp.
void PeerLogicValidation::EvictExtraOutboundPeers | ( | int64_t | time_in_seconds | ) |
If we have extra outbound peers, try to disconnect the one with the oldest block announcement.
Definition at line 3136 of file net_processing.cpp.
|
overridevirtual |
Handle removal of a peer by updating various state and removing it from mapNodeState.
Implements NetEventsInterface.
Definition at line 623 of file net_processing.cpp.
|
overridevirtual |
Initialize a peer by adding it to mapNodeState and pushing a message requesting its version.
Implements NetEventsInterface.
Definition at line 611 of file net_processing.cpp.
|
overridevirtual |
Overridden from CValidationInterface.
Maintain state about the best-seen block and fast-announce a compact block to compatible peers.
Reimplemented from CValidationInterface.
Definition at line 905 of file net_processing.cpp.
|
overridevirtual |
Process protocol messages received from a given node.
[in] | pfrom | The node which we have received messages from. |
[in] | interrupt | Interrupt condition for processing threads |
Implements NetEventsInterface.
Definition at line 2961 of file net_processing.cpp.
|
overridevirtual |
Send queued protocol messages to be sent to a give node.
[in] | pto | The node which we are sending messages to. |
Implements NetEventsInterface.
Definition at line 3235 of file net_processing.cpp.
|
overridevirtual |
Overridden from CValidationInterface.
Update our best height and announce any block hashes which weren't previously in chainActive to our peers.
Reimplemented from CValidationInterface.
Definition at line 952 of file net_processing.cpp.
|
private |
Definition at line 25 of file net_processing.h.
|
private |
Enable BIP61 (sending reject messages)
Definition at line 77 of file net_processing.h.
|
private |
Next time to check for stale tip.
Definition at line 74 of file net_processing.h.