mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 16:53:52 +02:00
Merge #19858: Periodically make block-relay connections and sync headers
b3a515c0beClarify comments around outbound peer eviction (Suhas Daftuar)daffaf03fbPeriodically make block-relay connections and sync headers (Suhas Daftuar)3cc8a7a0f5Use conn_type to identify block-relay peers, rather than m_tx_relay == nullptr (Suhas Daftuar)91d61952a8Simplify and clarify extra outbound peer counting (Suhas Daftuar) Pull request description: To make eclipse attacks more difficult, regularly initiate outbound connections and stay connected long enough to sync headers and potentially learn of new blocks. If we learn a new block, rotate out an existing block-relay peer in favor of the new peer. This augments the existing outbound peer rotation that exists -- currently we make new full-relay connections when our tip is stale, which we disconnect after waiting a small time to see if we learn a new block. As block-relay connections use minimal bandwidth, we can make these connections regularly and not just when our tip is stale. Like feeler connections, these connections are not aggressive; whenever our timer fires (once every 5 minutes on average), we'll try to initiate a new block-relay connection as described, but if we fail to connect we just wait for our timer to fire again before repeating with a new peer. ACKs for top commit: ariard: Code Review ACKb3a515c, only change since last time is dropping a useless `cs_main` taking. I manually tested a previous version of the PR, and not substantial change has been introduced since then which would alter behavior IMO. jonatack: Tested ACKb3a515c0beover several weeks, though this change and behavior could benefit from test coverage and other follow-ups (refactoring, etc.) described in the review feedback. I did not verify the behavior of `m_start_extra_block_relay_peers` only being enabled after initial chain sync. Since my last review, one unneeded `cs_main` lock was removed. Tree-SHA512: 75fc6f8e8003e88e93f86b845caf2d30b8b9c0dbb0a6b8aabe4e24ea4f6327351f736a068a3b2720a8a581b789942a3a47f921e2afdb47e88bc50d078aa37b6f
This commit is contained in:
@@ -145,7 +145,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
}
|
||||
(void)connman.GetAddedNodeInfo();
|
||||
(void)connman.GetBestHeight();
|
||||
(void)connman.GetExtraOutboundCount();
|
||||
(void)connman.GetExtraFullOutboundCount();
|
||||
(void)connman.GetLocalServices();
|
||||
(void)connman.GetMaxOutboundTarget();
|
||||
(void)connman.GetMaxOutboundTimeframe();
|
||||
|
||||
Reference in New Issue
Block a user