Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 3: [PATCH 03/68] feat(policy): preserve Roots relay and network controls on Core 30.3

src/net_processing.h

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

File metadata
index 8c140d98ad66bdc32edd3562427fd792fb817227..925adc5f77f8a9a0e8dfcbb03bd06fd0c4152a7a 100644

Download original patch · Release notes

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

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

src/net_processing.h CHANGED
@@ -36,9 +36,13 @@ class Warnings;
36
 
37
  /** Whether transaction reconciliation protocol should be enabled by default. */
38
  static constexpr bool DEFAULT_TXRECONCILIATION_ENABLE{false};
 
 
 
 
39
  /** Default number of non-mempool transactions to keep around for block reconstruction. Includes
40
  orphan, replaced, and rejected transactions. */
41
- static const uint32_t DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN{100};
42
  static const bool DEFAULT_PEERBLOOMFILTERS = false;
43
  static const bool DEFAULT_PEERBLOCKFILTERS = false;
44
  /** Maximum number of outstanding CMPCTBLOCK requests for the same block. */
@@ -61,6 +65,8 @@ struct CNodeStateStats {
61
  ServiceFlags their_services;
62
  int64_t presync_height{-1};
63
  std::chrono::seconds time_offset{0};
 
 
64
  };
65
 
66
  struct PeerManagerInfo {
@@ -79,6 +85,7 @@ public:
79
  //! Number of non-mempool transactions to keep around for block reconstruction. Includes
80
  //! orphan, replaced, and rejected transactions.
81
  uint32_t max_extra_txs{DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN};
 
82
  //! Whether all P2P messages are captured to disk
83
  bool capture_messages{false};
84
  //! Whether or not the internal RNG behaves deterministically (this is
@@ -95,13 +102,14 @@ public:
95
  virtual ~PeerManager() = default;
96
 
97
  /**
98
- * Attempt to manually fetch block from a given peer. We must already have the header.
99
  *
100
  * @param[in] peer_id The peer id
101
  * @param[in] block_index The blockindex
102
  * @returns std::nullopt if a request was successfully made, otherwise an error message
103
  */
104
- virtual std::optional<std::string> FetchBlock(NodeId peer_id, const CBlockIndex& block_index) = 0;
 
105
 
106
  /** Begin running background tasks, should only be called once */
107
  virtual void StartScheduledTasks(CScheduler& scheduler) = 0;
@@ -161,6 +169,7 @@ public:
161
  * we do not have a confirmed set of service flags.
162
  */
163
  virtual ServiceFlags GetDesirableServiceFlags(ServiceFlags services) const = 0;
 
164
  };
165
 
166
  #endif // BITCOIN_NET_PROCESSING_H
 
36
 
37
  /** Whether transaction reconciliation protocol should be enabled by default. */
38
  static constexpr bool DEFAULT_TXRECONCILIATION_ENABLE{false};
39
+ /** Whether to announce a fee filter to compatible transaction-relay peers. */
40
+ static constexpr bool DEFAULT_FEEFILTER{true};
41
+ static constexpr size_t BLOCK_RECONSTRUCTION_EXTRA_TXN_PER_TXN_SIZE_LIMIT{100000};
42
+ static const size_t DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN_SIZE{10000000};
43
  /** Default number of non-mempool transactions to keep around for block reconstruction. Includes
44
  orphan, replaced, and rejected transactions. */
45
+ static const uint32_t DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN{32768};
46
  static const bool DEFAULT_PEERBLOOMFILTERS = false;
47
  static const bool DEFAULT_PEERBLOCKFILTERS = false;
48
  /** Maximum number of outstanding CMPCTBLOCK requests for the same block. */
 
65
  ServiceFlags their_services;
66
  int64_t presync_height{-1};
67
  std::chrono::seconds time_offset{0};
68
+ NodeSeconds m_last_block_announcement;
69
+ int m_misbehavior_score{0};
70
  };
71
 
72
  struct PeerManagerInfo {
 
85
  //! Number of non-mempool transactions to keep around for block reconstruction. Includes
86
  //! orphan, replaced, and rejected transactions.
87
  uint32_t max_extra_txs{DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN};
88
+ size_t max_extra_txs_size{DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN_SIZE};
89
  //! Whether all P2P messages are captured to disk
90
  bool capture_messages{false};
91
  //! Whether or not the internal RNG behaves deterministically (this is
 
102
  virtual ~PeerManager() = default;
103
 
104
  /**
105
+ * Attempt to manually fetch block from a given peer.
106
  *
107
  * @param[in] peer_id The peer id
108
  * @param[in] block_index The blockindex
109
  * @returns std::nullopt if a request was successfully made, otherwise an error message
110
  */
111
+ std::optional<std::string> FetchBlock(NodeId peer_id, const CBlockIndex& block_index);
112
+ virtual std::optional<std::string> FetchBlock(NodeId peer_id, const uint256& hash, const CBlockIndex* block_index) = 0;
113
 
114
  /** Begin running background tasks, should only be called once */
115
  virtual void StartScheduledTasks(CScheduler& scheduler) = 0;
 
169
  * we do not have a confirmed set of service flags.
170
  */
171
  virtual ServiceFlags GetDesirableServiceFlags(ServiceFlags services) const = 0;
172
+
173
  };
174
 
175
  #endif // BITCOIN_NET_PROCESSING_H