aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h56
1 files changed, 9 insertions, 47 deletions
diff --git a/src/net.h b/src/net.h
index 05e71072e6..db09ce564e 100644
--- a/src/net.h
+++ b/src/net.h
@@ -257,7 +257,6 @@ class CNodeStats
public:
NodeId nodeid;
ServiceFlags nServices;
- bool fRelayTxes;
std::chrono::seconds m_last_send;
std::chrono::seconds m_last_recv;
std::chrono::seconds m_last_tx_time;
@@ -278,7 +277,6 @@ public:
NetPermissionFlags m_permissionFlags;
std::chrono::microseconds m_last_ping_time;
std::chrono::microseconds m_min_ping_time;
- CAmount minFeeFilter;
// Our address, as reported by the peer
std::string addrLocal;
// Address of this peer
@@ -555,34 +553,15 @@ public:
// Peer selected us as (compact blocks) high-bandwidth peer (BIP152)
std::atomic<bool> m_bip152_highbandwidth_from{false};
- struct TxRelay {
- mutable RecursiveMutex cs_filter;
- // We use fRelayTxes for two purposes -
- // a) it allows us to not relay tx invs before receiving the peer's version message
- // b) the peer may tell us in its version message that we should not relay tx invs
- // unless it loads a bloom filter.
- bool fRelayTxes GUARDED_BY(cs_filter){false};
- std::unique_ptr<CBloomFilter> pfilter PT_GUARDED_BY(cs_filter) GUARDED_BY(cs_filter){nullptr};
-
- mutable RecursiveMutex cs_tx_inventory;
- CRollingBloomFilter filterInventoryKnown GUARDED_BY(cs_tx_inventory){50000, 0.000001};
- // Set of transaction ids we still have to announce.
- // They are sorted by the mempool before relay, so the order is not important.
- std::set<uint256> setInventoryTxToSend;
- // Used for BIP35 mempool sending
- bool fSendMempool GUARDED_BY(cs_tx_inventory){false};
- // Last time a "MEMPOOL" request was serviced.
- std::atomic<std::chrono::seconds> m_last_mempool_req{0s};
- std::chrono::microseconds nNextInvSend{0};
-
- /** Minimum fee rate with which to filter inv's to this node */
- std::atomic<CAmount> minFeeFilter{0};
- CAmount lastSentFeeFilter{0};
- std::chrono::microseconds m_next_send_feefilter{0};
- };
+ /** Whether we should relay transactions to this peer (their version
+ * message did not include fRelay=false and this is not a block-relay-only
+ * connection). This only changes from false to true. It will never change
+ * back to false. Used only in inbound eviction logic. */
+ std::atomic_bool m_relays_txs{false};
- // m_tx_relay == nullptr if we're not relaying transactions with this peer
- std::unique_ptr<TxRelay> m_tx_relay;
+ /** Whether this peer has loaded a bloom filter. Used only in inbound
+ * eviction logic. */
+ std::atomic_bool m_bloom_filter_loaded{false};
/** UNIX epoch time of the last block received from this peer that we had
* not yet seen (e.g. not already received from another peer), that passed
@@ -658,23 +637,6 @@ public:
nRefCount--;
}
- void AddKnownTx(const uint256& hash)
- {
- if (m_tx_relay != nullptr) {
- LOCK(m_tx_relay->cs_tx_inventory);
- m_tx_relay->filterInventoryKnown.insert(hash);
- }
- }
-
- void PushTxInventory(const uint256& hash)
- {
- if (m_tx_relay == nullptr) return;
- LOCK(m_tx_relay->cs_tx_inventory);
- if (!m_tx_relay->filterInventoryKnown.contains(hash)) {
- m_tx_relay->setInventoryTxToSend.insert(hash);
- }
- }
-
void CloseSocketDisconnect();
void CopyStats(CNodeStats& stats);
@@ -1308,7 +1270,7 @@ struct NodeEvictionCandidate
std::chrono::seconds m_last_block_time;
std::chrono::seconds m_last_tx_time;
bool fRelevantServices;
- bool fRelayTxes;
+ bool m_relay_txs;
bool fBloomFilter;
uint64_t nKeyedNetGroup;
bool prefer_evict;