dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.2k forks source link

feat: aim to have at least 2 onion connections, guard them from eviction #6147

Closed PastaPastaPasta closed 2 months ago

PastaPastaPasta commented 2 months ago

Issue being fixed or feature implemented

In the past I've noticed that even when using -proxy over tor, I wouldn't actually gain any onion connections over time. This is even worse when using -onion. Sure it may expose an onion service, but you wouldn't gain any onion connections (in my experience)!

The goal here is to minimize easy-ish censorship and improve network-wide resistance to partitioning. It is not unimaginable that port 9999 could be blocked at large scale. This could potentially result in severe partitioning, and subsequent issues. In an attempt to avoid this, we should always try to have at least 2 outbound onion connections when at all possible. Hopefully this also makes onion addresses gossip better.

This also adds a benefit of p2p encryption for these peers. As a result, there is improved plausible deniability that you produced a transaction, as it is possible you received it over onion and simply rebroadcast it over ipv4.

I don't think there is any real downside to this patch, stuff like masternode / quorum connections will still always happen over ipv4, but with this, blocks and transactions would continue to propogate across the network even if (non-onion) ipv4 traffic was all dropped.

Arguably, it's not ideal to send so much traffic over tor, but hopefully as latency is higher, we will generally receive messages over ipv4 first and therefor not request them over the onion connections.

What was done?

We will always try to get 2 onion nodes (full or block only); and guard them from eviction

How Has This Been Tested?

Run a node; see over time that you start with 0 onion nodes, and over time you progress to having two of them!

Breaking Changes

None

Checklist:

PastaPastaPasta commented 2 months ago

force-pushed to simply update release-notes

PastaPastaPasta commented 2 months ago

rebased on develop