LCOV - code coverage report
Current view: top level - src - httprpc.cpp (source / functions) Coverage Total Hit
Test: total_coverage.info Lines: 97.1 % 204 198
Test Date: 2026-11-25 06:45:13 Functions: 100.0 % 9 9
Branches: 56.6 % 412 233

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2015-present The Bitcoin Core developers
       2                 :             : // Distributed under the MIT software license, see the accompanying
       3                 :             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4                 :             : 
       5                 :             : #include <httprpc.h>
       6                 :             : 
       7                 :             : #include <common/args.h>
       8                 :             : #include <crypto/hmac_sha256.h>
       9                 :             : #include <httpserver.h>
      10                 :             : #include <netaddress.h>
      11                 :             : #include <rpc/protocol.h>
      12                 :             : #include <rpc/server.h>
      13                 :             : #include <util/fs.h>
      14                 :             : #include <util/fs_helpers.h>
      15                 :             : #include <util/log.h>
      16                 :             : #include <util/strencodings.h>
      17                 :             : #include <util/string.h>
      18                 :             : #include <walletinitinterface.h>
      19                 :             : 
      20                 :             : #include <algorithm>
      21                 :             : #include <iterator>
      22                 :             : #include <map>
      23                 :             : #include <memory>
      24                 :             : #include <optional>
      25                 :             : #include <set>
      26                 :             : #include <string>
      27                 :             : #include <vector>
      28                 :             : 
      29                 :             : using util::SplitString;
      30                 :             : using util::TrimStringView;
      31                 :             : 
      32                 :             : /** WWW-Authenticate to present with 401 Unauthorized response */
      33                 :             : static const char* WWW_AUTH_HEADER_DATA = "Basic realm=\"jsonrpc\"";
      34                 :             : 
      35                 :             : /* List of -rpcauth values */
      36                 :             : static std::vector<std::vector<std::string>> g_rpcauth;
      37                 :             : /* RPC Auth Whitelist */
      38                 :             : static std::map<std::string, std::set<std::string>> g_rpc_whitelist;
      39                 :             : static bool g_rpc_whitelist_default = false;
      40                 :             : 
      41                 :          88 : static UniValue JSONErrorReply(UniValue objError, const JSONRPCRequest& jreq, HTTPStatusCode& nStatus)
      42                 :             : {
      43                 :             :     // HTTP errors should never be returned if JSON-RPC v2 was requested. This
      44                 :             :     // function should only be called when a v1 request fails or when a request
      45                 :             :     // cannot be parsed, so the version is unknown.
      46                 :          88 :     Assume(jreq.m_json_version != JSONRPCVersion::V2);
      47                 :             : 
      48                 :             :     // Send error reply from json-rpc error object
      49                 :          88 :     nStatus = HTTP_INTERNAL_SERVER_ERROR;
      50                 :          88 :     int code = objError.find_value("code").getInt<int>();
      51                 :             : 
      52         [ +  + ]:          88 :     if (code == RPC_INVALID_REQUEST)
      53                 :           2 :         nStatus = HTTP_BAD_REQUEST;
      54         [ +  + ]:          86 :     else if (code == RPC_METHOD_NOT_FOUND)
      55                 :          83 :         nStatus = HTTP_NOT_FOUND;
      56                 :             : 
      57   [ +  -  +  - ]:          88 :     return JSONRPCReplyObj(NullUniValue, std::move(objError), jreq.id, jreq.m_json_version);
      58                 :             : }
      59                 :             : 
      60                 :             : //This function checks username and password against -rpcauth
      61                 :             : //entries from config file.
      62                 :      236031 : static bool CheckUserAuthorized(std::string_view user, std::string_view pass)
      63                 :             : {
      64         [ +  + ]:      236200 :     for (const auto& fields : g_rpcauth) {
      65   [ -  +  +  + ]:      236179 :         if (!TimingResistantEqual(std::string_view(fields[0]), user)) {
      66                 :         163 :             continue;
      67                 :             :         }
      68                 :             : 
      69         [ -  + ]:      236016 :         const std::string& salt = fields[1];
      70                 :      236016 :         const std::string& hash = fields[2];
      71                 :             : 
      72                 :      236016 :         std::array<unsigned char, CHMAC_SHA256::OUTPUT_SIZE> out;
      73         [ -  + ]:      236016 :         CHMAC_SHA256(UCharCast(salt.data()), salt.size()).Write(UCharCast(pass.data()), pass.size()).Finalize(out.data());
      74                 :      236016 :         std::string hash_from_pass = HexStr(out);
      75                 :             : 
      76         [ +  + ]:      236016 :         if (TimingResistantEqual(hash_from_pass, hash)) {
      77                 :      236010 :             return true;
      78                 :             :         }
      79                 :      236016 :     }
      80                 :             :     return false;
      81                 :             : }
      82                 :             : 
      83                 :      236038 : static bool RPCAuthorized(const std::string& strAuth, std::string& strAuthUsernameOut)
      84                 :             : {
      85   [ -  +  +  + ]:      236038 :     if (!strAuth.starts_with("Basic "))
      86                 :             :         return false;
      87         [ -  + ]:      236033 :     std::string_view strUserPass64 = TrimStringView(std::string_view{strAuth}.substr(6));
      88                 :      236033 :     auto userpass_data = DecodeBase64(strUserPass64);
      89         [ +  + ]:      236033 :     std::string strUserPass;
      90         [ +  + ]:      236033 :     if (!userpass_data) return false;
      91         [ +  - ]:      236032 :     strUserPass.assign(userpass_data->begin(), userpass_data->end());
      92                 :             : 
      93                 :      236032 :     size_t colon_pos = strUserPass.find(':');
      94         [ +  + ]:      236032 :     if (colon_pos == std::string::npos) {
      95                 :             :         return false; // Invalid basic auth.
      96                 :             :     }
      97         [ +  - ]:      236031 :     std::string user = strUserPass.substr(0, colon_pos);
      98         [ +  - ]:      236031 :     std::string pass = strUserPass.substr(colon_pos + 1);
      99         [ +  - ]:      236031 :     strAuthUsernameOut = user;
     100   [ -  +  -  +  :      236031 :     return CheckUserAuthorized(user, pass);
                   +  - ]
     101                 :      472064 : }
     102                 :             : 
     103                 :      236012 : UniValue ExecuteHTTPRPC(const UniValue& valRequest, JSONRPCRequest& jreq, HTTPStatusCode& status)
     104                 :             : {
     105                 :      236012 :     status = HTTP_OK;
     106                 :      236012 :     try {
     107                 :      236012 :         bool user_has_whitelist = g_rpc_whitelist.contains(jreq.authUser);
     108   [ +  +  +  + ]:      236012 :         if (!user_has_whitelist && g_rpc_whitelist_default) {
     109         [ +  - ]:           4 :             LogWarning("RPC User %s not allowed to call any methods", jreq.authUser);
     110                 :           4 :             status = HTTP_FORBIDDEN;
     111                 :           4 :             return {};
     112                 :             : 
     113                 :             :         // singleton request
     114         [ +  + ]:      236008 :         } else if (valRequest.isObject()) {
     115         [ +  + ]:      235710 :             jreq.parse(valRequest);
     116   [ +  +  +  -  :      235708 :             if (user_has_whitelist && !g_rpc_whitelist[jreq.authUser].contains(jreq.strMethod)) {
                   +  + ]
     117         [ +  - ]:          13 :                 LogWarning("RPC User %s not allowed to call method %s", jreq.authUser, jreq.strMethod);
     118                 :          13 :                 status = HTTP_FORBIDDEN;
     119                 :          13 :                 return {};
     120                 :             :             }
     121                 :             : 
     122                 :             :             // Legacy 1.0/1.1 behavior is for failed requests to throw
     123                 :             :             // exceptions which return HTTP errors and RPC errors to the client.
     124                 :             :             // 2.0 behavior is to catch exceptions and return HTTP success with
     125                 :             :             // RPC errors, as long as there is not an actual HTTP server error.
     126                 :      235695 :             const bool catch_errors{jreq.m_json_version == JSONRPCVersion::V2};
     127         [ +  + ]:      235695 :             UniValue reply{JSONRPCExec(jreq, catch_errors)};
     128         [ +  + ]:      235611 :             if (jreq.IsNotification()) {
     129                 :             :                 // Even though we do execute notifications, we do not respond to them
     130                 :           2 :                 status = HTTP_NO_CONTENT;
     131                 :           2 :                 return {};
     132                 :             :             }
     133                 :      235609 :             return reply;
     134                 :             :         // array of requests
     135         [ +  - ]:      235909 :         } else if (valRequest.isArray()) {
     136                 :             :             // Check authorization for each request's method
     137         [ +  + ]:         298 :             if (user_has_whitelist) {
     138   [ -  +  +  - ]:           2 :                 for (unsigned int reqIdx = 0; reqIdx < valRequest.size(); reqIdx++) {
     139   [ +  -  -  + ]:           2 :                     if (!valRequest[reqIdx].isObject()) {
     140   [ #  #  #  # ]:           0 :                         throw JSONRPCError(RPC_INVALID_REQUEST, "Invalid Request object");
     141                 :             :                     } else {
     142   [ +  -  +  - ]:           2 :                         const UniValue& request = valRequest[reqIdx].get_obj();
     143                 :             :                         // Parse method
     144   [ +  -  +  -  :           2 :                         std::string strMethod = request.find_value("method").get_str();
                   -  + ]
     145   [ +  -  +  - ]:           2 :                         if (!g_rpc_whitelist[jreq.authUser].contains(strMethod)) {
     146         [ +  - ]:           2 :                             LogWarning("RPC User %s not allowed to call method %s", jreq.authUser, strMethod);
     147                 :           2 :                             status = HTTP_FORBIDDEN;
     148                 :           2 :                             return {};
     149                 :             :                         }
     150                 :           2 :                     }
     151                 :             :                 }
     152                 :             :             }
     153                 :             : 
     154                 :             :             // Execute each request
     155                 :         296 :             UniValue reply = UniValue::VARR;
     156   [ -  +  +  + ]:       18993 :             for (size_t i{0}; i < valRequest.size(); ++i) {
     157                 :             :                 // Batches never throw HTTP errors, they are always just included
     158                 :             :                 // in "HTTP OK" responses. Notifications never get any response.
     159         [ +  - ]:       18697 :                 UniValue response;
     160                 :             :                 // Each element gets its own copy of the unparsed request, so
     161                 :             :                 // that nothing parsed from one element ends up in the reply to
     162                 :             :                 // the next
     163         [ +  - ]:       18697 :                 JSONRPCRequest elem_jreq{jreq};
     164                 :       18697 :                 try {
     165   [ +  -  +  + ]:       18697 :                     elem_jreq.parse(valRequest[i]);
     166         [ +  - ]:       18683 :                     response = JSONRPCExec(elem_jreq, /*catch_errors=*/true);
     167      [ -  +  - ]:          14 :                 } catch (UniValue& e) {
     168   [ +  -  +  -  :          14 :                     response = JSONRPCReplyObj(NullUniValue, std::move(e), elem_jreq.id, elem_jreq.m_json_version);
                   +  - ]
     169                 :          14 :                 } catch (const std::exception& e) {
     170   [ -  -  -  -  :           0 :                     response = JSONRPCReplyObj(NullUniValue, JSONRPCError(RPC_PARSE_ERROR, e.what()), elem_jreq.id, elem_jreq.m_json_version);
          -  -  -  -  -  
                      - ]
     171                 :           0 :                 }
     172         [ +  + ]:       18697 :                 if (!elem_jreq.IsNotification()) {
     173         [ +  - ]:       18691 :                     reply.push_back(std::move(response));
     174                 :             :                 }
     175                 :       18697 :             }
     176                 :             :             // Return no response for an all-notification batch, but only if the
     177                 :             :             // batch request is non-empty. Technically according to the JSON-RPC
     178                 :             :             // 2.0 spec, an empty batch request should also return no response,
     179                 :             :             // However, if the batch request is empty, it means the request did
     180                 :             :             // not contain any JSON-RPC version numbers, so returning an empty
     181                 :             :             // response could break backwards compatibility with old RPC clients
     182                 :             :             // relying on previous behavior. Return an empty array instead of an
     183                 :             :             // empty response in this case to favor being backwards compatible
     184                 :             :             // over complying with the JSON-RPC 2.0 spec in this case.
     185   [ -  +  +  +  :         296 :             if (reply.size() == 0 && valRequest.size() > 0) {
                   +  + ]
     186                 :           1 :                 status = HTTP_NO_CONTENT;
     187                 :           1 :                 return {};
     188                 :             :             }
     189                 :         295 :             return reply;
     190                 :         296 :         }
     191                 :             :         else
     192   [ #  #  #  # ]:           0 :             throw JSONRPCError(RPC_PARSE_ERROR, "Top-level object parse error");
     193      [ -  +  - ]:          86 :     } catch (UniValue& e) {
     194         [ +  - ]:          86 :         return JSONErrorReply(std::move(e), jreq, status);
     195                 :          86 :     } catch (const std::exception& e) {
     196   [ -  -  -  -  :           0 :         return JSONErrorReply(JSONRPCError(RPC_PARSE_ERROR, e.what()), jreq, status);
                   -  - ]
     197                 :           0 :     }
     198                 :             : }
     199                 :             : 
     200                 :      236126 : static void HTTPReq_JSONRPC(const std::any& context, HTTPRequest* req)
     201                 :             : {
     202                 :             :     // JSONRPC handles only POST
     203         [ +  + ]:      236126 :     if (req->GetRequestMethod() != HTTPRequestMethod::POST) {
     204                 :          87 :         req->WriteReply(HTTP_BAD_METHOD, "JSONRPC server handles only POST requests");
     205                 :          87 :         return;
     206                 :             :     }
     207                 :             :     // Check authorization
     208                 :      236039 :     std::optional<std::string> auth_header = req->GetHeader("authorization");
     209         [ +  + ]:      236039 :     if (!auth_header) {
     210   [ +  -  +  -  :           2 :         req->WriteHeader("WWW-Authenticate", WWW_AUTH_HEADER_DATA);
                   +  - ]
     211         [ +  - ]:           1 :         req->WriteReply(HTTP_UNAUTHORIZED);
     212                 :             :         return;
     213                 :             :     }
     214                 :             : 
     215                 :      236038 :     JSONRPCRequest jreq;
     216         [ +  - ]:      236038 :     jreq.context = context;
     217   [ +  -  +  - ]:      236038 :     jreq.peerAddr = req->GetPeer().ToStringAddrPort();
     218         [ -  + ]:      472076 :     jreq.URI = req->GetURI();
     219   [ +  -  +  + ]:      236038 :     if (!RPCAuthorized(*auth_header, jreq.authUser)) {
     220         [ +  - ]:          28 :         LogWarning("ThreadRPCServer incorrect password attempt from %s", jreq.peerAddr);
     221                 :             : 
     222                 :             :         /* Deter brute-forcing
     223                 :             :            If this results in a DoS the user really
     224                 :             :            shouldn't have their RPC port exposed. */
     225         [ +  - ]:          28 :         UninterruptibleSleep(std::chrono::milliseconds{250});
     226                 :             : 
     227   [ +  -  +  -  :          56 :         req->WriteHeader("WWW-Authenticate", WWW_AUTH_HEADER_DATA);
                   +  - ]
     228         [ +  - ]:          28 :         req->WriteReply(HTTP_UNAUTHORIZED);
     229                 :          28 :         return;
     230                 :             :     }
     231                 :             : 
     232                 :             :     // Generate reply
     233                 :      236010 :     HTTPStatusCode status;
     234         [ -  + ]:      236010 :     UniValue reply;
     235                 :      236010 :     UniValue request;
     236   [ -  +  -  +  :      472020 :     if (request.read(req->ReadBody())) {
             +  -  +  + ]
     237         [ +  - ]:      236008 :         reply = ExecuteHTTPRPC(request, jreq, status);
     238                 :             :     } else {
     239   [ +  -  +  -  :           2 :         reply = JSONErrorReply(JSONRPCError(RPC_PARSE_ERROR, "Parse error"), jreq, status);
                   +  - ]
     240                 :             :     }
     241                 :             : 
     242                 :             :     // Write reply
     243         [ +  + ]:      236010 :     if (reply.isNull()) {
     244                 :             :         // Error case or no-content notification reply.
     245         [ +  - ]:          22 :         req->WriteReply(status);
     246                 :             :     } else {
     247   [ +  -  +  -  :      471976 :         req->WriteHeader("Content-Type", "application/json");
                   +  - ]
     248   [ +  -  -  +  :      707964 :         req->WriteReply(status, reply.write() + "\n");
                   +  - ]
     249                 :             :     }
     250                 :      236067 : }
     251                 :             : 
     252                 :        1255 : static bool InitRPCAuthentication()
     253                 :             : {
     254         [ +  - ]:        1255 :     std::string user;
     255                 :        1255 :     std::string pass;
     256                 :             : 
     257   [ +  -  +  -  :        1255 :     if (gArgs.GetArg("-rpcpassword", "") == "")
             +  -  +  + ]
     258                 :             :     {
     259                 :        1254 :         std::optional<fs::perms> cookie_perms{std::nullopt};
     260   [ +  -  +  - ]:        1254 :         auto cookie_perms_arg{gArgs.GetArg("-rpccookieperms")};
     261         [ +  + ]:        1254 :         if (cookie_perms_arg) {
     262         [ +  - ]:           3 :             auto perm_opt = InterpretPermString(*cookie_perms_arg);
     263         [ -  + ]:           3 :             if (!perm_opt) {
     264         [ -  - ]:           1 :                 LogError("Invalid -rpccookieperms=%s; must be one of 'owner', 'group', or 'all'.", *cookie_perms_arg);
     265                 :             :                 return false;
     266                 :             :             }
     267                 :           3 :             cookie_perms = *perm_opt;
     268                 :             :         }
     269                 :             : 
     270   [ +  -  +  +  :        1254 :         switch (GenerateAuthCookie(cookie_perms, user, pass)) {
                   -  + ]
     271                 :             :         case AuthCookieResult::Error:
     272                 :             :             return false;
     273                 :           1 :         case AuthCookieResult::Disabled:
     274         [ +  - ]:           1 :             LogInfo("RPC authentication cookie file generation is disabled.");
     275                 :             :             break;
     276                 :        1252 :         case AuthCookieResult::Ok:
     277         [ +  - ]:        1253 :             LogInfo("Using random cookie authentication.");
     278                 :             :             break;
     279                 :             :         }
     280                 :        1254 :     } else {
     281         [ +  - ]:           1 :         LogInfo("Using rpcuser/rpcpassword authentication.");
     282         [ +  - ]:           1 :         LogWarning("The use of rpcuser/rpcpassword is less secure, because credentials are configured in plain text. It is recommended that locally-run instances switch to cookie-based auth, or otherwise to use hashed rpcauth credentials. See share/rpcauth in the source directory for more information.");
     283   [ +  -  +  -  :           1 :         user = gArgs.GetArg("-rpcuser", "");
                   +  - ]
     284   [ +  -  +  -  :           1 :         pass = gArgs.GetArg("-rpcpassword", "");
                   +  - ]
     285                 :             :     }
     286                 :             : 
     287                 :             :     // If there is a plaintext credential, hash it with a random salt before storage.
     288   [ +  +  -  + ]:        1254 :     if (!user.empty() || !pass.empty()) {
     289                 :             :         // Generate a random 16 byte hex salt.
     290                 :        1253 :         std::array<unsigned char, 16> raw_salt;
     291                 :        1253 :         GetStrongRandBytes(raw_salt);
     292         [ +  - ]:        1253 :         std::string salt = HexStr(raw_salt);
     293                 :             : 
     294                 :             :         // Compute HMAC.
     295                 :        1253 :         std::array<unsigned char, CHMAC_SHA256::OUTPUT_SIZE> out;
     296   [ -  +  +  -  :        2506 :         CHMAC_SHA256(UCharCast(salt.data()), salt.size()).Write(UCharCast(pass.data()), pass.size()).Finalize(out.data());
             +  -  +  - ]
     297         [ +  - ]:        1253 :         std::string hash = HexStr(out);
     298                 :             : 
     299   [ +  +  -  - ]:        5012 :         g_rpcauth.push_back({user, salt, hash});
     300                 :        1253 :     }
     301                 :             : 
     302   [ +  -  +  -  :        1254 :     if (!gArgs.GetArgs("-rpcauth").empty()) {
                   +  + ]
     303         [ +  - ]:          18 :         LogInfo("Using rpcauth authentication.\n");
     304   [ +  -  +  -  :          58 :         for (const std::string& rpcauth : gArgs.GetArgs("-rpcauth")) {
                   +  + ]
     305   [ -  +  +  - ]:          51 :             std::vector<std::string> fields{SplitString(rpcauth, ':')};
     306   [ -  +  +  - ]:          51 :             const std::vector<std::string> salt_hmac{SplitString(fields.back(), '$')};
     307   [ -  +  +  +  :          93 :             if (fields.size() == 2 && salt_hmac.size() == 2) {
                   +  + ]
     308                 :          40 :                 fields.pop_back();
     309         [ +  - ]:          40 :                 fields.insert(fields.end(), salt_hmac.begin(), salt_hmac.end());
     310         [ +  - ]:          40 :                 g_rpcauth.push_back(fields);
     311                 :             :             } else {
     312         [ +  - ]:          11 :                 LogWarning("Invalid -rpcauth argument.");
     313                 :          11 :                 return false;
     314                 :             :             }
     315                 :          58 :         }
     316                 :             :     }
     317                 :             : 
     318   [ +  -  +  -  :        1243 :     g_rpc_whitelist_default = gArgs.GetBoolArg("-rpcwhitelistdefault", !gArgs.GetArgs("-rpcwhitelist").empty());
             +  -  +  - ]
     319   [ +  -  +  -  :        1269 :     for (const std::string& strRPCWhitelist : gArgs.GetArgs("-rpcwhitelist")) {
                   +  + ]
     320                 :          26 :         auto pos = strRPCWhitelist.find(':');
     321         [ +  - ]:          26 :         std::string strUser = strRPCWhitelist.substr(0, pos);
     322                 :          26 :         bool intersect = g_rpc_whitelist.contains(strUser);
     323         [ +  - ]:          26 :         std::set<std::string>& whitelist = g_rpc_whitelist[strUser];
     324         [ +  + ]:          26 :         if (pos != std::string::npos) {
     325         [ +  - ]:          23 :             std::string strWhitelist = strRPCWhitelist.substr(pos + 1);
     326   [ -  +  +  - ]:          23 :             std::vector<std::string> whitelist_split = SplitString(strWhitelist, ", ");
     327         [ +  - ]:          23 :             std::set<std::string> new_whitelist{
     328         [ +  - ]:          23 :                 std::make_move_iterator(whitelist_split.begin()),
     329         [ +  - ]:          23 :                 std::make_move_iterator(whitelist_split.end())};
     330         [ +  + ]:          23 :             if (intersect) {
     331         [ +  - ]:           3 :                 std::set<std::string> tmp_whitelist;
     332         [ +  - ]:           3 :                 std::set_intersection(new_whitelist.begin(), new_whitelist.end(),
     333                 :             :                        whitelist.begin(), whitelist.end(), std::inserter(tmp_whitelist, tmp_whitelist.end()));
     334                 :           3 :                 new_whitelist = std::move(tmp_whitelist);
     335                 :           3 :             }
     336                 :          23 :             whitelist = std::move(new_whitelist);
     337                 :          23 :         }
     338                 :          26 :     }
     339                 :             : 
     340                 :        1243 :     return true;
     341   [ -  +  -  +  :        6267 : }
          -  +  +  -  -  
                      - ]
     342                 :             : 
     343                 :        1255 : bool StartHTTPRPC(const std::any& context)
     344                 :             : {
     345         [ +  - ]:        1255 :     LogDebug(BCLog::RPC, "Starting HTTP RPC server\n");
     346         [ +  + ]:        1255 :     if (!InitRPCAuthentication())
     347                 :             :         return false;
     348                 :             : 
     349   [ +  -  +  - ]:      724537 :     auto handle_rpc = [context](HTTPRequest* req, const std::string&) { return HTTPReq_JSONRPC(context, req); };
     350   [ +  -  +  -  :        2486 :     RegisterHTTPHandler("/", true, handle_rpc);
                   +  - ]
     351   [ +  -  +  - ]:        1243 :     if (g_wallet_init_interface.HasWalletSupport()) {
     352   [ +  -  +  -  :        2486 :         RegisterHTTPHandler("/wallet/", false, handle_rpc);
                   +  - ]
     353                 :             :     }
     354                 :        1243 :     return true;
     355                 :        1243 : }
     356                 :             : 
     357                 :        1304 : void InterruptHTTPRPC()
     358                 :             : {
     359         [ +  + ]:        1304 :     LogDebug(BCLog::RPC, "Interrupting HTTP RPC server\n");
     360                 :        1304 : }
     361                 :             : 
     362                 :        1304 : void StopHTTPRPC()
     363                 :             : {
     364         [ +  + ]:        1304 :     LogDebug(BCLog::RPC, "Stopping HTTP RPC server\n");
     365         [ +  - ]:        1304 :     UnregisterHTTPHandler("/", true);
     366         [ +  - ]:        1304 :     if (g_wallet_init_interface.HasWalletSupport()) {
     367         [ +  - ]:        2608 :         UnregisterHTTPHandler("/wallet/", false);
     368                 :             :     }
     369                 :        1304 : }
        

Generated by: LCOV version 2.0-1