diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rpc/net.cpp | 22 | ||||
-rw-r--r-- | src/test/fuzz/tx_pool.cpp | 2 | ||||
-rw-r--r-- | src/txorphanage.h | 2 | ||||
-rw-r--r-- | src/txrequest.cpp | 2 |
4 files changed, 13 insertions, 15 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 96533a50c8..9ace33d529 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -835,7 +835,7 @@ static RPCHelpMan setnetworkactive() static RPCHelpMan getnodeaddresses() { return RPCHelpMan{"getnodeaddresses", - "\nReturn known addresses which can potentially be used to find new nodes in the network\n", + "\nReturn known addresses, which can potentially be used to find new nodes in the network.\n", { {"count", RPCArg::Type::NUM, /* default */ "1", "The maximum number of addresses to return. Specify 0 to return all known addresses."}, }, @@ -844,10 +844,11 @@ static RPCHelpMan getnodeaddresses() { {RPCResult::Type::OBJ, "", "", { - {RPCResult::Type::NUM_TIME, "time", "The " + UNIX_EPOCH_TIME + " of when the node was last seen"}, - {RPCResult::Type::NUM, "services", "The services offered"}, + {RPCResult::Type::NUM_TIME, "time", "The " + UNIX_EPOCH_TIME + " when the node was last seen"}, + {RPCResult::Type::NUM, "services", "The services offered by the node"}, {RPCResult::Type::STR, "address", "The address of the node"}, - {RPCResult::Type::NUM, "port", "The port of the node"}, + {RPCResult::Type::NUM, "port", "The port number of the node"}, + {RPCResult::Type::STR, "network", "The network (" + Join(GetNetworkNames(), ", ") + ") the node connected through"}, }}, } }, @@ -862,15 +863,11 @@ static RPCHelpMan getnodeaddresses() throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); } - int count = 1; - if (!request.params[0].isNull()) { - count = request.params[0].get_int(); - if (count < 0) { - throw JSONRPCError(RPC_INVALID_PARAMETER, "Address count out of range"); - } - } + const int count{request.params[0].isNull() ? 1 : request.params[0].get_int()}; + if (count < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Address count out of range"); + // returns a shuffled list of CAddress - std::vector<CAddress> vAddr = node.connman->GetAddresses(count, /* max_pct */ 0); + const std::vector<CAddress> vAddr{node.connman->GetAddresses(count, /* max_pct */ 0)}; UniValue ret(UniValue::VARR); for (const CAddress& addr : vAddr) { @@ -879,6 +876,7 @@ static RPCHelpMan getnodeaddresses() obj.pushKV("services", (uint64_t)addr.nServices); obj.pushKV("address", addr.ToStringIP()); obj.pushKV("port", addr.GetPort()); + obj.pushKV("network", GetNetworkName(addr.GetNetClass())); ret.push_back(obj); } return ret; diff --git a/src/test/fuzz/tx_pool.cpp b/src/test/fuzz/tx_pool.cpp index f84d6702a7..fe8d17b24a 100644 --- a/src/test/fuzz/tx_pool.cpp +++ b/src/test/fuzz/tx_pool.cpp @@ -34,7 +34,7 @@ void initialize_tx_pool() for (int i = 0; i < 2 * COINBASE_MATURITY; ++i) { CTxIn in = MineBlock(g_setup->m_node, P2WSH_OP_TRUE); - // Remember the txids to avoid expensive disk acess later on + // Remember the txids to avoid expensive disk access later on auto& outpoints = i < COINBASE_MATURITY ? g_outpoints_coinbase_init_mature : g_outpoints_coinbase_init_immature; diff --git a/src/txorphanage.h b/src/txorphanage.h index dc9fa87dbb..e4266e470a 100644 --- a/src/txorphanage.h +++ b/src/txorphanage.h @@ -26,7 +26,7 @@ public: /** Check if we already have an orphan transaction (by txid or wtxid) */ bool HaveTx(const GenTxid& gtxid) const LOCKS_EXCLUDED(::g_cs_orphans); - /** Get an orphan transaction and its orginating peer + /** Get an orphan transaction and its originating peer * (Transaction ref will be nullptr if not found) */ std::pair<CTransactionRef, NodeId> GetTx(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans); diff --git a/src/txrequest.cpp b/src/txrequest.cpp index 58424134b0..f8d7a1ece8 100644 --- a/src/txrequest.cpp +++ b/src/txrequest.cpp @@ -486,7 +486,7 @@ private: } //! Make the data structure consistent with a given point in time: - //! - REQUESTED annoucements with expiry <= now are turned into COMPLETED. + //! - REQUESTED announcements with expiry <= now are turned into COMPLETED. //! - CANDIDATE_DELAYED announcements with reqtime <= now are turned into CANDIDATE_{READY,BEST}. //! - CANDIDATE_{READY,BEST} announcements with reqtime > now are turned into CANDIDATE_DELAYED. void SetTimePoint(std::chrono::microseconds now, std::vector<std::pair<NodeId, GenTxid>>* expired) |