diff options
author | John Newbery <john@johnnewbery.com> | 2021-08-23 10:42:39 +0100 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2021-09-22 16:12:14 +0100 |
commit | 0220b834b175dc8c45a2c60213474a72c0ef8193 (patch) | |
tree | e3077a9f637e510cf3a388e4badac3ff942164d6 /src | |
parent | dbcb5742c48fd26f77e500291d7083e12eec741b (diff) |
[test] Add testing for outbound feeler connections
Extend the addconnection RPC method to allow creating outbound
feeler connections. Extend the test framework to accept those
feeler connections.
Diffstat (limited to 'src')
-rw-r--r-- | src/net.cpp | 4 | ||||
-rw-r--r-- | src/net.h | 4 | ||||
-rw-r--r-- | src/rpc/net.cpp | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/net.cpp b/src/net.cpp index 57b8844d6b..504619dec5 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1217,7 +1217,6 @@ bool CConnman::AddConnection(const std::string& address, ConnectionType conn_typ switch (conn_type) { case ConnectionType::INBOUND: case ConnectionType::MANUAL: - case ConnectionType::FEELER: return false; case ConnectionType::OUTBOUND_FULL_RELAY: max_connections = m_max_outbound_full_relay; @@ -1228,6 +1227,9 @@ bool CConnman::AddConnection(const std::string& address, ConnectionType conn_typ // no limit for ADDR_FETCH because -seednode has no limit either case ConnectionType::ADDR_FETCH: break; + // no limit for FEELER connections since they're short-lived + case ConnectionType::FEELER: + break; } // no default case, so the compiler can warn about missing cases // Count existing connections @@ -892,8 +892,8 @@ public: * Attempts to open a connection. Currently only used from tests. * * @param[in] address Address of node to try connecting to - * @param[in] conn_type ConnectionType::OUTBOUND or ConnectionType::BLOCK_RELAY - * or ConnectionType::ADDR_FETCH + * @param[in] conn_type ConnectionType::OUTBOUND, ConnectionType::BLOCK_RELAY, + * ConnectionType::ADDR_FETCH or ConnectionType::FEELER * @return bool Returns false if there are no available * slots for this connection: * - conn_type not a supported ConnectionType diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 861b889118..4ef44a93db 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -343,7 +343,7 @@ static RPCHelpMan addconnection() "\nOpen an outbound connection to a specified node. This RPC is for testing only.\n", { {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The IP address and port to attempt connecting to."}, - {"connection_type", RPCArg::Type::STR, RPCArg::Optional::NO, "Type of connection to open (\"outbound-full-relay\", \"block-relay-only\" or \"addr-fetch\")."}, + {"connection_type", RPCArg::Type::STR, RPCArg::Optional::NO, "Type of connection to open (\"outbound-full-relay\", \"block-relay-only\", \"addr-fetch\" or \"feeler\")."}, }, RPCResult{ RPCResult::Type::OBJ, "", "", @@ -371,6 +371,8 @@ static RPCHelpMan addconnection() conn_type = ConnectionType::BLOCK_RELAY; } else if (conn_type_in == "addr-fetch") { conn_type = ConnectionType::ADDR_FETCH; + } else if (conn_type_in == "feeler") { + conn_type = ConnectionType::FEELER; } else { throw JSONRPCError(RPC_INVALID_PARAMETER, self.ToString()); } |