Skip to content
Bitcoin Roots

v29.4-roots.3 · Commit 3: [PATCH 03/30] policy: restore conservative relay and network controls

src/net_processing.h

Before: src/net_processing.h · After: src/net_processing.h

File metadata
index 0d2dc59c5ae92e63fb635683a1bb7c1483fad60d..4ce9f409c94ae3be4afc80e476307d6901f15f84 100644

Download original patch · Release notes

Diff rows 1–68 of 68. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/net_processing.h CHANGED
@@ -7,6 +7,7 @@
7
7
  #define BITCOIN_NET_PROCESSING_H
8
8
 
9
9
  #include <net.h>
10
+ #include <threadsafety.h>
10
11
  #include <txorphanage.h>
11
12
  #include <validationinterface.h>
12
13
 
@@ -23,11 +24,15 @@ class Warnings;
23
24
 
24
25
  /** Whether transaction reconciliation protocol should be enabled by default. */
25
26
  static constexpr bool DEFAULT_TXRECONCILIATION_ENABLE{false};
27
+ /** Whether to announce a fee filter to compatible transaction-relay peers. */
28
+ static constexpr bool DEFAULT_FEEFILTER{true};
26
29
  /** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
27
30
  static const uint32_t DEFAULT_MAX_ORPHAN_TRANSACTIONS{100};
31
+ static constexpr size_t BLOCK_RECONSTRUCTION_EXTRA_TXN_PER_TXN_SIZE_LIMIT{100000};
32
+ static const size_t DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN_SIZE{10000000};
28
33
  /** Default number of non-mempool transactions to keep around for block reconstruction. Includes
29
34
  orphan, replaced, and rejected transactions. */
30
- static const uint32_t DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN{100};
35
+ static const uint32_t DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN{32768};
31
36
  static const bool DEFAULT_PEERBLOOMFILTERS = false;
32
37
  static const bool DEFAULT_PEERBLOCKFILTERS = false;
33
38
  /** Maximum number of outstanding CMPCTBLOCK requests for the same block. */
@@ -50,6 +55,8 @@ struct CNodeStateStats {
50
55
  ServiceFlags their_services;
51
56
  int64_t presync_height{-1};
52
57
  std::chrono::seconds time_offset{0};
58
+ NodeSeconds m_last_block_announcement;
59
+ int m_misbehavior_score{0};
53
60
  };
54
61
 
55
62
  struct PeerManagerInfo {
@@ -70,6 +77,7 @@ public:
70
77
  //! Number of non-mempool transactions to keep around for block reconstruction. Includes
71
78
  //! orphan, replaced, and rejected transactions.
72
79
  uint32_t max_extra_txs{DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN};
80
+ size_t max_extra_txs_size{DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN_SIZE};
73
81
  //! Whether all P2P messages are captured to disk
74
82
  bool capture_messages{false};
75
83
  //! Whether or not the internal RNG behaves deterministically (this is
@@ -86,20 +94,20 @@ public:
86
94
  virtual ~PeerManager() = default;
87
95
 
88
96
  /**
89
- * Attempt to manually fetch block from a given peer. We must already have the header.
97
+ * Attempt to manually fetch block from a given peer.
90
98
  *
91
99
  * @param[in] peer_id The peer id
92
100
  * @param[in] block_index The blockindex
93
101
  * @returns std::nullopt if a request was successfully made, otherwise an error message
94
102
  */
95
- virtual std::optional<std::string> FetchBlock(NodeId peer_id, const CBlockIndex& block_index) = 0;
103
+ std::optional<std::string> FetchBlock(NodeId peer_id, const CBlockIndex& block_index);
104
+ virtual std::optional<std::string> FetchBlock(NodeId peer_id, const uint256& hash, const CBlockIndex* block_index) = 0;
96
105
 
97
106
  /** Begin running background tasks, should only be called once */
98
107
  virtual void StartScheduledTasks(CScheduler& scheduler) = 0;
99
108
 
100
109
  /** Get statistics from node state */
101
110
  virtual bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const = 0;
102
-
103
111
  virtual std::vector<TxOrphanage::OrphanTxBase> GetOrphanTransactions() = 0;
104
112
 
105
113
  /** Get peer manager info. */
@@ -152,6 +160,7 @@ public:
152
160
  * we do not have a confirmed set of service flags.
153
161
  */
154
162
  virtual ServiceFlags GetDesirableServiceFlags(ServiceFlags services) const = 0;
163
+
155
164
  };
156
165
 
157
166
  #endif // BITCOIN_NET_PROCESSING_H