/
githubmirror
/
bitcoin
Обзор
Документация
Войти
/
githubmirror
/
bitcoin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/zmq/zmqrpc.cpp
73 строки
2 KB
Anthony Towns
scripted-diff: rpc: Don't pointlessly capture in RPCMethod lambdas
25 мар 2026, 12:18
25 мар 2026, 12:18
5a81d73
Код
Авторство
О чём код?
// Copyright (c) 2018-present The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <zmq/zmqrpc.h> #include <rpc/server.h> #include <rpc/util.h> #include <univalue.h> #include <zmq/zmqabstractnotifier.h> #include <zmq/zmqnotificationinterface.h> #include <list> #include <memory> #include <string> #include <utility> #include <vector> class JSONRPCRequest; namespace { static RPCMethod getzmqnotifications() { return RPCMethod{ "getzmqnotifications", "Returns information about the active ZeroMQ notifications.\n", {}, RPCResult{ RPCResult::Type::ARR, "", "", { {RPCResult::Type::OBJ, "", "", { {RPCResult::Type::STR, "type", "Type of notification"}, {RPCResult::Type::STR, "address", "Address of the publisher"}, {RPCResult::Type::NUM, "hwm", "Outbound message high water mark"}, }}, } }, RPCExamples{ HelpExampleCli("getzmqnotifications", "") + HelpExampleRpc("getzmqnotifications", "") }, [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue { UniValue result(UniValue::VARR); if (g_zmq_notification_interface != nullptr) { for (const auto* n : g_zmq_notification_interface->GetActiveNotifiers()) { UniValue obj(UniValue::VOBJ); obj.pushKV("type", n->GetType()); obj.pushKV("address", n->GetAddress()); obj.pushKV("hwm", n->GetOutboundMessageHighWaterMark()); result.push_back(std::move(obj)); } } return result; }, }; } const CRPCCommand commands[]{ {"zmq", &getzmqnotifications}, }; } // anonymous namespace void RegisterZMQRPCCommands(CRPCTable& t) { for (const auto& c : commands) { t.appendCommand(c.name, &c); } }