aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-07-13 20:07:19 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-07-13 20:10:55 -0700
commit1e90862f5d0b5f7dcc18fb018b2bbaa323dcca1d (patch)
tree83d3b0dad997332f1cf68cdbe41b2be4a09142a9 /src/net_processing.h
parentad552a54c56a420be84b47154882c3e4c76f9bdd (diff)
parent3339ba28e95aaaa355b7d33a69cffca7ab29b3fd (diff)
downloadbitcoin-1e90862f5d0b5f7dcc18fb018b2bbaa323dcca1d.tar.xz
Merge #13417: [net] Tighten scope in net_processing
3339ba28e9 Make g_enable_bip61 a member variable of PeerLogicValidation (Jesse Cohen) 6690a28606 Restrict as much as possible in net_processing to translation unit (Jesse Cohen) 1d4df02b7e [move-only] Move things only referenced in net_processing out of header file (Jesse Cohen) 02bbc05310 Rescope g_enable_bip61 to net_processing (Jesse Cohen) Pull request description: As part of a larger effort to decouple net_processing and validation a bit, these are a bunch of simple scope cleanups. I've moved things out of the header file that are only referenced in net_processing and added static (or anonymous namespace) modifiers to everything possible in net_processing. There are a handful of functions which could be static except that they are exposed for the sake of unit testing - these are explicitly commented. There has been some discussion of a compile time annotation, but no conclusion has been reached on that yet. This is somewhat related to other prs #12934 #13413 #13407 and will be followed by prs that reduce reliance on cs_main to synchronize data structures which are translation unit local to net_processing Tree-SHA512: 46c9660ee4e06653feb42ba92189565b0aea17aac2375c20747c0d091054c63829cbf66d2daddf65682b58ce1d6922e23aefea051a7f2c8abbb6db253a609082
Diffstat (limited to 'src/net_processing.h')
-rw-r--r--src/net_processing.h30
1 files changed, 4 insertions, 26 deletions
diff --git a/src/net_processing.h b/src/net_processing.h
index 0d97b316eb..4dab0ada2b 100644
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -12,40 +12,17 @@
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
-/** Expiration time for orphan transactions in seconds */
-static const int64_t ORPHAN_TX_EXPIRE_TIME = 20 * 60;
-/** Minimum time between orphan transactions expire time checks in seconds */
-static const int64_t ORPHAN_TX_EXPIRE_INTERVAL = 5 * 60;
/** Default number of orphan+recently-replaced txn to keep around for block reconstruction */
static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100;
-/** Headers download timeout expressed in microseconds
- * Timeout = base + per_header * (expected number of headers) */
-static constexpr int64_t HEADERS_DOWNLOAD_TIMEOUT_BASE = 15 * 60 * 1000000; // 15 minutes
-static constexpr int64_t HEADERS_DOWNLOAD_TIMEOUT_PER_HEADER = 1000; // 1ms/header
-/** Protect at least this many outbound peers from disconnection due to slow/
- * behind headers chain.
- */
-static constexpr int32_t MAX_OUTBOUND_PEERS_TO_PROTECT_FROM_DISCONNECT = 4;
-/** Timeout for (unprotected) outbound peers to sync to our chainwork, in seconds */
-static constexpr int64_t CHAIN_SYNC_TIMEOUT = 20 * 60; // 20 minutes
-/** How frequently to check for stale tips, in seconds */
-static constexpr int64_t STALE_CHECK_INTERVAL = 10 * 60; // 10 minutes
-/** How frequently to check for extra outbound peers and disconnect, in seconds */
-static constexpr int64_t EXTRA_PEER_CHECK_INTERVAL = 45;
-/** Minimum time an outbound-peer-eviction candidate must be connected for, in order to evict, in seconds */
-static constexpr int64_t MINIMUM_CONNECT_TIME = 30;
-
/** Default for BIP61 (sending reject messages) */
static constexpr bool DEFAULT_ENABLE_BIP61 = true;
-/** Enable BIP61 (sending reject messages) */
-extern bool g_enable_bip61;
class PeerLogicValidation final : public CValidationInterface, public NetEventsInterface {
private:
CConnman* const connman;
public:
- explicit PeerLogicValidation(CConnman* connman, CScheduler &scheduler);
+ explicit PeerLogicValidation(CConnman* connman, CScheduler &scheduler, bool enable_bip61);
/**
* Overridden from CValidationInterface.
@@ -92,6 +69,9 @@ public:
private:
int64_t m_stale_tip_check_time; //! Next time to check for stale tip
+
+ /** Enable BIP61 (sending reject messages) */
+ const bool m_enable_bip61;
};
struct CNodeStateStats {
@@ -103,7 +83,5 @@ struct CNodeStateStats {
/** Get statistics from node state */
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats);
-/** Increase a node's misbehavior score. */
-void Misbehaving(NodeId nodeid, int howmuch, const std::string& message="");
#endif // BITCOIN_NET_PROCESSING_H