mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-23 14:10:15 +01:00
Merge #13570: RPC: Add new "getzmqnotifications" method
161e8d40a4RPC: Add new getzmqnotifications method. (Daniel Kraft)caac39b0acMake ZMQ notification interface instance global. (Daniel Kraft) Pull request description: This adds a new RPC method `getzmqnotifications`, which returns information about all active ZMQ notification endpoints. This is useful for software that layers on top of bitcoind, so it can verify that ZeroMQ is enabled and also figure out where it should listen. See #13526. Tree-SHA512: edce722925741c84ddbf7b3a879fc9db1907e5269d0d97138fe724035d93ee541c2118c24fa92f4197403f380d0e25c2fda5ca6c62d526792ea749cf527a99a0
This commit is contained in:
22
src/init.cpp
22
src/init.cpp
@@ -63,6 +63,7 @@
|
||||
|
||||
#if ENABLE_ZMQ
|
||||
#include <zmq/zmqnotificationinterface.h>
|
||||
#include <zmq/zmqrpc.h>
|
||||
#endif
|
||||
|
||||
bool fFeeEstimatesInitialized = false;
|
||||
@@ -100,10 +101,6 @@ void DummyWalletInit::AddWalletOptions() const
|
||||
const WalletInitInterface& g_wallet_init_interface = DummyWalletInit();
|
||||
#endif
|
||||
|
||||
#if ENABLE_ZMQ
|
||||
static CZMQNotificationInterface* pzmqNotificationInterface = nullptr;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
// Win32 LevelDB doesn't use filedescriptors, and the ones used for
|
||||
// accessing block files don't count towards the fd_set size limit
|
||||
@@ -269,10 +266,10 @@ void Shutdown()
|
||||
g_wallet_init_interface.Stop();
|
||||
|
||||
#if ENABLE_ZMQ
|
||||
if (pzmqNotificationInterface) {
|
||||
UnregisterValidationInterface(pzmqNotificationInterface);
|
||||
delete pzmqNotificationInterface;
|
||||
pzmqNotificationInterface = nullptr;
|
||||
if (g_zmq_notification_interface) {
|
||||
UnregisterValidationInterface(g_zmq_notification_interface);
|
||||
delete g_zmq_notification_interface;
|
||||
g_zmq_notification_interface = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1282,6 +1279,9 @@ bool AppInitMain()
|
||||
*/
|
||||
RegisterAllCoreRPCCommands(tableRPC);
|
||||
g_wallet_init_interface.RegisterRPC(tableRPC);
|
||||
#if ENABLE_ZMQ
|
||||
RegisterZMQRPCCommands(tableRPC);
|
||||
#endif
|
||||
|
||||
/* Start the RPC server already. It will be started in "warmup" mode
|
||||
* and not really process calls already (but it will signify connections
|
||||
@@ -1398,10 +1398,10 @@ bool AppInitMain()
|
||||
}
|
||||
|
||||
#if ENABLE_ZMQ
|
||||
pzmqNotificationInterface = CZMQNotificationInterface::Create();
|
||||
g_zmq_notification_interface = CZMQNotificationInterface::Create();
|
||||
|
||||
if (pzmqNotificationInterface) {
|
||||
RegisterValidationInterface(pzmqNotificationInterface);
|
||||
if (g_zmq_notification_interface) {
|
||||
RegisterValidationInterface(g_zmq_notification_interface);
|
||||
}
|
||||
#endif
|
||||
uint64_t nMaxOutboundLimit = 0; //unlimited unless -maxuploadtarget is set
|
||||
|
||||
Reference in New Issue
Block a user