Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 805 Lines • ▼ Show 20 Lines | private: | ||||
std::list<NodeId> lNodesAnnouncingHeaderAndIDs GUARDED_BY(cs_main); | std::list<NodeId> lNodesAnnouncingHeaderAndIDs GUARDED_BY(cs_main); | ||||
/** Number of peers from which we're downloading blocks. */ | /** Number of peers from which we're downloading blocks. */ | ||||
int nPeersWithValidatedDownloads GUARDED_BY(cs_main) = 0; | int nPeersWithValidatedDownloads GUARDED_BY(cs_main) = 0; | ||||
/** Storage for orphan information */ | /** Storage for orphan information */ | ||||
TxOrphanage m_orphanage; | TxOrphanage m_orphanage; | ||||
void AddToCompactExtraTransactions(const CTransactionRef &tx) | |||||
EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans); | |||||
/** | |||||
* Orphan/conflicted/etc transactions that are kept for compact block | |||||
* reconstruction. | |||||
* The last | |||||
* -blockreconstructionextratxn/DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN of | |||||
* these are kept in a ring buffer | |||||
*/ | |||||
std::vector<std::pair<TxHash, CTransactionRef>> | |||||
vExtraTxnForCompact GUARDED_BY(g_cs_orphans); | |||||
/** Offset into vExtraTxnForCompact to insert the next tx */ | |||||
size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0; | |||||
/** | /** | ||||
* Checks if address relay is permitted with peer. If needed, initializes | * 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. | * the m_addr_known bloom filter and sets m_addr_relay_enabled to true. | ||||
* | * | ||||
* @return True if address relay is enabled with peer | * @return True if address relay is enabled with peer | ||||
* False if address relay is disallowed | * False if address relay is disallowed | ||||
*/ | */ | ||||
bool SetupAddressRelay(CNode &node, Peer &peer); | bool SetupAddressRelay(CNode &node, Peer &peer); | ||||
Show All 12 Lines | |||||
* million to make it highly unlikely for users to have issues with this filter. | * million to make it highly unlikely for users to have issues with this filter. | ||||
*/ | */ | ||||
Mutex cs_rejectedProofs; | Mutex cs_rejectedProofs; | ||||
std::unique_ptr<CRollingBloomFilter> | std::unique_ptr<CRollingBloomFilter> | ||||
rejectedProofs GUARDED_BY(cs_rejectedProofs); | rejectedProofs GUARDED_BY(cs_rejectedProofs); | ||||
/** Number of preferable block download peers. */ | /** Number of preferable block download peers. */ | ||||
int nPreferredDownload GUARDED_BY(cs_main) = 0; | int nPreferredDownload GUARDED_BY(cs_main) = 0; | ||||
/** | |||||
* Orphan/conflicted/etc transactions that are kept for compact block | |||||
* reconstruction. | |||||
* The last -blockreconstructionextratxn/DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN | |||||
* of these are kept in a ring buffer | |||||
*/ | |||||
static std::vector<std::pair<TxHash, CTransactionRef>> | |||||
vExtraTxnForCompact GUARDED_BY(g_cs_orphans); | |||||
/** Offset into vExtraTxnForCompact to insert the next tx */ | |||||
static size_t vExtraTxnForCompactIt GUARDED_BY(g_cs_orphans) = 0; | |||||
} // namespace | } // namespace | ||||
namespace { | namespace { | ||||
/** | /** | ||||
* Maintain validation-specific state about nodes, protected by cs_main, instead | * Maintain validation-specific state about nodes, protected by cs_main, instead | ||||
* by CNode's own locks. This simplifies asynchronous operation, where | * by CNode's own locks. This simplifies asynchronous operation, where | ||||
* processing of incoming data is done after the ProcessMessage call returns, | * processing of incoming data is done after the ProcessMessage call returns, | ||||
* and we're no longer holding the node's locks. | * and we're no longer holding the node's locks. | ||||
▲ Show 20 Lines • Show All 868 Lines • ▼ Show 20 Lines | bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) { | ||||
stats.m_ping_wait = ping_wait; | stats.m_ping_wait = ping_wait; | ||||
stats.m_addr_processed = peer->m_addr_processed.load(); | stats.m_addr_processed = peer->m_addr_processed.load(); | ||||
stats.m_addr_rate_limited = peer->m_addr_rate_limited.load(); | stats.m_addr_rate_limited = peer->m_addr_rate_limited.load(); | ||||
stats.m_addr_relay_enabled = peer->m_addr_relay_enabled.load(); | stats.m_addr_relay_enabled = peer->m_addr_relay_enabled.load(); | ||||
return true; | return true; | ||||
} | } | ||||
static void AddToCompactExtraTransactions(const CTransactionRef &tx) | void PeerManagerImpl::AddToCompactExtraTransactions(const CTransactionRef &tx) { | ||||
EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans) { | |||||
size_t max_extra_txn = gArgs.GetArg("-blockreconstructionextratxn", | size_t max_extra_txn = gArgs.GetArg("-blockreconstructionextratxn", | ||||
DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN); | DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN); | ||||
if (max_extra_txn <= 0) { | if (max_extra_txn <= 0) { | ||||
return; | return; | ||||
} | } | ||||
if (!vExtraTxnForCompact.size()) { | if (!vExtraTxnForCompact.size()) { | ||||
vExtraTxnForCompact.resize(max_extra_txn); | vExtraTxnForCompact.resize(max_extra_txn); | ||||
▲ Show 20 Lines • Show All 5,062 Lines • Show Last 20 Lines |