Merge bitcoin/bitcoin#21719: refactor: Add and use EnsureConnman in rpc code

fafb68add5 refactor: Add and use EnsureConnman in rpc code (MarcoFalke)
faabeb854a refactor: Mark member functions const (MarcoFalke)

Pull request description:

  This removes the 10 occurrences of `throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");` and replaces them with `EnsureConnman`.

ACKs for top commit:
  jarolrod:
    re-ACK fafb68add5
  theStack:
    ACK fafb68add5
  ryanofsky:
    Code review ACK fafb68add5

Tree-SHA512: 84c63cfe31e548645d906f7191a3526c7bea99ed0d54c2a75c2041452a44fe149ede343d8e1943b0e7770816c828bb047dfec8bc541a1f2b89920a126ee54d68
This commit is contained in:
MarcoFalke
2021-04-21 07:20:35 +02:00
8 changed files with 104 additions and 85 deletions

View File

@@ -246,7 +246,7 @@ public:
/** Implement PeerManager */
void CheckForStaleTipAndEvictPeers() override;
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) override;
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const override;
bool IgnoresIncomingTxs() override { return m_ignore_incoming_txs; }
void SendPings() override;
void RelayTransaction(const uint256& txid, const uint256& wtxid) override;
@@ -1103,7 +1103,7 @@ PeerRef PeerManagerImpl::RemovePeer(NodeId id)
return ret;
}
bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats)
bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const
{
{
LOCK(cs_main);