Skip to content

Commit 62bf5b7

Browse files
committed
netinfo: add ConnectionTypeForNetinfo member helper function
1 parent 384e090 commit 62bf5b7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bitcoin-cli.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,14 @@ class NetinfoRequestHandler : public BaseRequestHandler
351351
const double milliseconds{round(1000 * seconds)};
352352
return milliseconds > 999999 ? "-" : ToString(milliseconds);
353353
}
354+
std::string ConnectionTypeForNetinfo(const std::string& conn_type) const
355+
{
356+
if (conn_type == "outbound-full-relay") return "full";
357+
if (conn_type == "block-relay-only") return "block";
358+
if (conn_type == "manual" || conn_type == "feeler") return conn_type;
359+
if (conn_type == "addr-fetch") return "addr";
360+
return "";
361+
}
354362
const UniValue NetinfoHelp()
355363
{
356364
return std::string{

0 commit comments

Comments
 (0)