Extend inbound eviction protection for peers connected over CJDNS, as is the case for peers connected via onion, localhost, and I2P since #21261 and #20197. CJDNS peers seem to have better min ping latency than onion and I2P peers but still higher than that of unencrypted IPv4/6 peers and can be disadvantaged under our eviction criteria. They are also very few in number, which is a further reason to protect them, as the goal of this logic is to favorise the diversity of our peer connections. CJDNS support was added in #23077 for the upcoming v23 release.
p2p: extend inbound eviction protection by network to CJDNS peers #24165
pull jonatack wants to merge 4 commits into bitcoin:master from jonatack:protect-inbound-cjdns-peers-from-eviction changing 3 files +156 −21-
jonatack commented at 10:02 AM on January 26, 2022: member
-
f7b8094d61
p2p: extend inbound eviction protection by network to CJDNS peers
This commit extends our inbound eviction protection to CJDNS peers to favorise the diversity of peer connections, as peers connected through the CJDNS network are otherwise disadvantaged by our eviction criteria for their higher latency (higher min ping times) relative to IPv4 and IPv6 peers. The `networks` array is order-dependent in the case of a tie in candidate counts between networks; earlier array members receive priority in the case of a tie. Therefore, we place CJDNS candidates before I2P, localhost, and onion ones in terms of opportunity to recover unused remaining protected slots from the previous iteration, estimating that most nodes allowing several inbound privacy networks will have more onion, localhost or I2P peers than CJDNS ones, as CJDNS support is only being added in the upcoming v23.0 release.
-
test: fix off-by-one logic in an eviction protection test 0c00c0c981
-
test: add tests for inbound eviction protection of CJDNS peers 0a1bb84770
-
test: add combined CJDNS/I2P/localhost/onion eviction protection tests b7be28cac5
- DrahtBot added the label P2P on Jan 26, 2022
-
kristapsk commented at 11:42 AM on January 26, 2022: contributor
Concept ACK
- w0xlt approved
-
w0xlt commented at 2:02 PM on January 26, 2022: contributor
tACK b7be28c
-
laanwj commented at 7:01 PM on January 26, 2022: member
Concept and code review ACK b7be28cac50046b9f2ddfe63ecafccc80649a36c Code changes look straightforward, thanks for adding tests.
-
DrahtBot commented at 11:30 PM on January 26, 2022: member
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
No conflicts as of last run.
-
jonatack commented at 1:16 PM on January 28, 2022: member
Thanks for the ACKs @kristapsk, @w0xlt and @laanwj.
Here is an example at this moment of the min ping latency of inbound IP peers vs CJDNS, Tor and I2P ones.

- laanwj added this to the milestone 23.0 on Feb 3, 2022
- fanquake deleted a comment on Feb 4, 2022
- fanquake deleted a comment on Feb 4, 2022
-
ghost commented at 3:04 PM on February 14, 2022: none
Concept ACK
- laanwj merged this on Mar 2, 2022
- laanwj closed this on Mar 2, 2022
- jonatack deleted the branch on Mar 2, 2022
- sidhujag referenced this in commit 55f6e404b5 on Mar 2, 2022
- DrahtBot locked this on Mar 2, 2023
Labels
Milestone
23.0