Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | |||||
* Maximum number of headers to announce when relaying blocks with headers | * Maximum number of headers to announce when relaying blocks with headers | ||||
* message. | * message. | ||||
*/ | */ | ||||
static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8; | static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8; | ||||
/** Maximum number of unconnecting headers announcements before DoS score */ | /** Maximum number of unconnecting headers announcements before DoS score */ | ||||
static const int MAX_UNCONNECTING_HEADERS = 10; | static const int MAX_UNCONNECTING_HEADERS = 10; | ||||
/** Minimum blocks required to signal NODE_NETWORK_LIMITED */ | /** Minimum blocks required to signal NODE_NETWORK_LIMITED */ | ||||
static const unsigned int NODE_NETWORK_LIMITED_MIN_BLOCKS = 288; | static const unsigned int NODE_NETWORK_LIMITED_MIN_BLOCKS = 288; | ||||
/// How many non standard orphan do we consider from a node before ignoring it. | |||||
static constexpr uint32_t MAX_NON_STANDARD_ORPHAN_PER_NODE = 5; | |||||
struct COrphanTx { | |||||
// When modifying, adapt the copy of this definition in tests/DoS_tests. | |||||
CTransactionRef tx; | |||||
NodeId fromPeer; | |||||
int64_t nTimeExpire; | |||||
size_t list_pos; | |||||
}; | |||||
RecursiveMutex g_cs_orphans; | |||||
std::map<TxId, COrphanTx> mapOrphanTransactions GUARDED_BY(g_cs_orphans); | |||||
void EraseOrphansFor(NodeId peer); | |||||
/** | /** | ||||
* Average delay between local address broadcasts. | * Average delay between local address broadcasts. | ||||
*/ | */ | ||||
static constexpr std::chrono::hours AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL{24}; | static constexpr std::chrono::hours AVG_LOCAL_ADDRESS_BROADCAST_INTERVAL{24}; | ||||
/** | /** | ||||
* Average delay between peer address broadcasts. | * Average delay between peer address broadcasts. | ||||
*/ | */ | ||||
static const std::chrono::seconds AVG_ADDRESS_BROADCAST_INTERVAL{30}; | static const std::chrono::seconds AVG_ADDRESS_BROADCAST_INTERVAL{30}; | ||||
Show All 23 Lines | |||||
*/ | */ | ||||
static constexpr uint32_t MAX_GETCFILTERS_SIZE = 1000; | static constexpr uint32_t MAX_GETCFILTERS_SIZE = 1000; | ||||
/** | /** | ||||
* Maximum number of cf hashes that may be requested with one getcfheaders. See | * Maximum number of cf hashes that may be requested with one getcfheaders. See | ||||
* BIP 157. | * BIP 157. | ||||
*/ | */ | ||||
static constexpr uint32_t MAX_GETCFHEADERS_SIZE = 2000; | static constexpr uint32_t MAX_GETCFHEADERS_SIZE = 2000; | ||||
/// How many non standard orphan do we consider from a node before ignoring it. | |||||
static constexpr uint32_t MAX_NON_STANDARD_ORPHAN_PER_NODE = 5; | |||||
struct COrphanTx { | |||||
// When modifying, adapt the copy of this definition in tests/DoS_tests. | |||||
CTransactionRef tx; | |||||
NodeId fromPeer; | |||||
int64_t nTimeExpire; | |||||
size_t list_pos; | |||||
}; | |||||
RecursiveMutex g_cs_orphans; | |||||
std::map<TxId, COrphanTx> mapOrphanTransactions GUARDED_BY(g_cs_orphans); | |||||
void EraseOrphansFor(NodeId peer); | |||||
// Internal stuff | // Internal stuff | ||||
namespace { | namespace { | ||||
/** Number of nodes with fSyncStarted. */ | /** Number of nodes with fSyncStarted. */ | ||||
int nSyncStarted GUARDED_BY(cs_main) = 0; | int nSyncStarted GUARDED_BY(cs_main) = 0; | ||||
/** | /** | ||||
* Sources of received blocks, saved to be able to punish them when processing | * Sources of received blocks, saved to be able to punish them when processing | ||||
* happens afterwards. | * happens afterwards. | ||||
▲ Show 20 Lines • Show All 5,260 Lines • Show Last 20 Lines |