net: introduce a new connection type for private broadcast
We will open a short-lived connection to a random Tor or I2P peer, send our transaction to that peer and close the connection.
This commit is contained in:
9 files changed
+30
-2
No files matched your search
@@ -452,6 +452,7 @@ private:
|
|||||||
if (conn_type == "block-relay-only") return "block";
|
if (conn_type == "block-relay-only") return "block";
|
||||||
if (conn_type == "manual" || conn_type == "feeler") return conn_type;
|
if (conn_type == "manual" || conn_type == "feeler") return conn_type;
|
||||||
if (conn_type == "addr-fetch") return "addr";
|
if (conn_type == "addr-fetch") return "addr";
|
||||||
|
if (conn_type == "private-broadcast") return "priv";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
std::string FormatServices(const UniValue& services)
|
std::string FormatServices(const UniValue& services)
|
||||||
@@ -703,6 +704,7 @@ public:
|
|||||||
" \"manual\" - peer we manually added using RPC addnode or the -addnode/-connect config options\n"
|
" \"manual\" - peer we manually added using RPC addnode or the -addnode/-connect config options\n"
|
||||||
" \"feeler\" - short-lived connection for testing addresses\n"
|
" \"feeler\" - short-lived connection for testing addresses\n"
|
||||||
" \"addr\" - address fetch; short-lived connection for requesting addresses\n"
|
" \"addr\" - address fetch; short-lived connection for requesting addresses\n"
|
||||||
|
" \"priv\" - private broadcast; short-lived connection for broadcasting our transactions\n"
|
||||||
" net Network the peer connected through (\"ipv4\", \"ipv6\", \"onion\", \"i2p\", \"cjdns\", or \"npr\" (not publicly routable))\n"
|
" net Network the peer connected through (\"ipv4\", \"ipv6\", \"onion\", \"i2p\", \"cjdns\", or \"npr\" (not publicly routable))\n"
|
||||||
" serv Services offered by the peer\n"
|
" serv Services offered by the peer\n"
|
||||||
" \"n\" - NETWORK: peer can serve the full block chain\n"
|
" \"n\" - NETWORK: peer can serve the full block chain\n"
|
||||||
|
|||||||
@@ -1876,6 +1876,7 @@ bool CConnman::AddConnection(const std::string& address, ConnectionType conn_typ
|
|||||||
switch (conn_type) {
|
switch (conn_type) {
|
||||||
case ConnectionType::INBOUND:
|
case ConnectionType::INBOUND:
|
||||||
case ConnectionType::MANUAL:
|
case ConnectionType::MANUAL:
|
||||||
|
case ConnectionType::PRIVATE_BROADCAST:
|
||||||
return false;
|
return false;
|
||||||
case ConnectionType::OUTBOUND_FULL_RELAY:
|
case ConnectionType::OUTBOUND_FULL_RELAY:
|
||||||
max_connections = m_max_outbound_full_relay;
|
max_connections = m_max_outbound_full_relay;
|
||||||
@@ -2666,6 +2667,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
|
|||||||
// peers from addrman.
|
// peers from addrman.
|
||||||
case ConnectionType::ADDR_FETCH:
|
case ConnectionType::ADDR_FETCH:
|
||||||
case ConnectionType::FEELER:
|
case ConnectionType::FEELER:
|
||||||
|
case ConnectionType::PRIVATE_BROADCAST:
|
||||||
break;
|
break;
|
||||||
case ConnectionType::MANUAL:
|
case ConnectionType::MANUAL:
|
||||||
case ConnectionType::OUTBOUND_FULL_RELAY:
|
case ConnectionType::OUTBOUND_FULL_RELAY:
|
||||||
|
|||||||
@@ -775,6 +775,7 @@ public:
|
|||||||
case ConnectionType::MANUAL:
|
case ConnectionType::MANUAL:
|
||||||
case ConnectionType::ADDR_FETCH:
|
case ConnectionType::ADDR_FETCH:
|
||||||
case ConnectionType::FEELER:
|
case ConnectionType::FEELER:
|
||||||
|
case ConnectionType::PRIVATE_BROADCAST:
|
||||||
return false;
|
return false;
|
||||||
} // no default case, so the compiler can warn about missing cases
|
} // no default case, so the compiler can warn about missing cases
|
||||||
|
|
||||||
@@ -796,6 +797,7 @@ public:
|
|||||||
case ConnectionType::FEELER:
|
case ConnectionType::FEELER:
|
||||||
case ConnectionType::BLOCK_RELAY:
|
case ConnectionType::BLOCK_RELAY:
|
||||||
case ConnectionType::ADDR_FETCH:
|
case ConnectionType::ADDR_FETCH:
|
||||||
|
case ConnectionType::PRIVATE_BROADCAST:
|
||||||
return false;
|
return false;
|
||||||
case ConnectionType::OUTBOUND_FULL_RELAY:
|
case ConnectionType::OUTBOUND_FULL_RELAY:
|
||||||
case ConnectionType::MANUAL:
|
case ConnectionType::MANUAL:
|
||||||
@@ -817,6 +819,11 @@ public:
|
|||||||
return m_conn_type == ConnectionType::ADDR_FETCH;
|
return m_conn_type == ConnectionType::ADDR_FETCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsPrivateBroadcastConn() const
|
||||||
|
{
|
||||||
|
return m_conn_type == ConnectionType::PRIVATE_BROADCAST;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsInboundConn() const {
|
bool IsInboundConn() const {
|
||||||
return m_conn_type == ConnectionType::INBOUND;
|
return m_conn_type == ConnectionType::INBOUND;
|
||||||
}
|
}
|
||||||
@@ -830,6 +837,7 @@ public:
|
|||||||
case ConnectionType::OUTBOUND_FULL_RELAY:
|
case ConnectionType::OUTBOUND_FULL_RELAY:
|
||||||
case ConnectionType::BLOCK_RELAY:
|
case ConnectionType::BLOCK_RELAY:
|
||||||
case ConnectionType::ADDR_FETCH:
|
case ConnectionType::ADDR_FETCH:
|
||||||
|
case ConnectionType::PRIVATE_BROADCAST:
|
||||||
return true;
|
return true;
|
||||||
} // no default case, so the compiler can warn about missing cases
|
} // no default case, so the compiler can warn about missing cases
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ std::string ConnectionTypeAsString(ConnectionType conn_type)
|
|||||||
return "block-relay-only";
|
return "block-relay-only";
|
||||||
case ConnectionType::ADDR_FETCH:
|
case ConnectionType::ADDR_FETCH:
|
||||||
return "addr-fetch";
|
return "addr-fetch";
|
||||||
|
case ConnectionType::PRIVATE_BROADCAST:
|
||||||
|
return "private-broadcast";
|
||||||
} // no default case, so the compiler can warn about missing cases
|
} // no default case, so the compiler can warn about missing cases
|
||||||
|
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|||||||
@@ -75,6 +75,13 @@ enum class ConnectionType {
|
|||||||
* AddrMan is empty.
|
* AddrMan is empty.
|
||||||
*/
|
*/
|
||||||
ADDR_FETCH,
|
ADDR_FETCH,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private broadcast connections are short-lived and only opened to
|
||||||
|
* privacy networks (Tor, I2P) for relaying privacy-sensitive data (like
|
||||||
|
* our own transactions) and closed afterwards.
|
||||||
|
*/
|
||||||
|
PRIVATE_BROADCAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Convert ConnectionType enum to a string value */
|
/** Convert ConnectionType enum to a string value */
|
||||||
|
|||||||
@@ -722,6 +722,8 @@ QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction
|
|||||||
case ConnectionType::FEELER: return prefix + QObject::tr("Feeler");
|
case ConnectionType::FEELER: return prefix + QObject::tr("Feeler");
|
||||||
//: Short-lived peer connection type that solicits known addresses from a peer.
|
//: Short-lived peer connection type that solicits known addresses from a peer.
|
||||||
case ConnectionType::ADDR_FETCH: return prefix + QObject::tr("Address Fetch");
|
case ConnectionType::ADDR_FETCH: return prefix + QObject::tr("Address Fetch");
|
||||||
|
//: Short-lived peer connection type that is used for broadcasting privacy-sensitive data.
|
||||||
|
case ConnectionType::PRIVATE_BROADCAST: return prefix + QObject::tr("Private Broadcast");
|
||||||
} // no default case, so the compiler can warn about missing cases
|
} // no default case, so the compiler can warn about missing cases
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -484,7 +484,10 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
|
|||||||
tr("Outbound Feeler: short-lived, for testing addresses"),
|
tr("Outbound Feeler: short-lived, for testing addresses"),
|
||||||
/*: Explanatory text for a short-lived outbound peer connection that is used
|
/*: Explanatory text for a short-lived outbound peer connection that is used
|
||||||
to request addresses from a peer. */
|
to request addresses from a peer. */
|
||||||
tr("Outbound Address Fetch: short-lived, for soliciting addresses")};
|
tr("Outbound Address Fetch: short-lived, for soliciting addresses"),
|
||||||
|
/*: Explanatory text for a short-lived outbound peer connection that is used
|
||||||
|
to broadcast privacy-sensitive data (like our transactions). */
|
||||||
|
tr("Private broadcast: short-lived, for broadcasting privacy-sensitive transactions")};
|
||||||
const QString connection_types_list{"<ul><li>" + Join(CONNECTION_TYPE_DOC, QString("</li><li>")) + "</li></ul>"};
|
const QString connection_types_list{"<ul><li>" + Join(CONNECTION_TYPE_DOC, QString("</li><li>")) + "</li></ul>"};
|
||||||
ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(connection_types_list));
|
ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(connection_types_list));
|
||||||
const std::vector<QString> TRANSPORT_TYPE_DOC{
|
const std::vector<QString> TRANSPORT_TYPE_DOC{
|
||||||
|
|||||||
+2
-1
@@ -48,7 +48,8 @@ const std::vector<std::string> CONNECTION_TYPE_DOC{
|
|||||||
"inbound (initiated by the peer)",
|
"inbound (initiated by the peer)",
|
||||||
"manual (added via addnode RPC or -addnode/-connect configuration options)",
|
"manual (added via addnode RPC or -addnode/-connect configuration options)",
|
||||||
"addr-fetch (short-lived automatic connection for soliciting addresses)",
|
"addr-fetch (short-lived automatic connection for soliciting addresses)",
|
||||||
"feeler (short-lived automatic connection for testing addresses)"
|
"feeler (short-lived automatic connection for testing addresses)",
|
||||||
|
"private-broadcast (short-lived automatic connection for broadcasting privacy-sensitive transactions)"
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::vector<std::string> TRANSPORT_TYPE_DOC{
|
const std::vector<std::string> TRANSPORT_TYPE_DOC{
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ constexpr ConnectionType ALL_CONNECTION_TYPES[]{
|
|||||||
ConnectionType::FEELER,
|
ConnectionType::FEELER,
|
||||||
ConnectionType::BLOCK_RELAY,
|
ConnectionType::BLOCK_RELAY,
|
||||||
ConnectionType::ADDR_FETCH,
|
ConnectionType::ADDR_FETCH,
|
||||||
|
ConnectionType::PRIVATE_BROADCAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr auto ALL_NETWORKS = std::array{
|
constexpr auto ALL_NETWORKS = std::array{
|
||||||
|
|||||||
Reference in new issue
Block a user