Files
triangles_v5/src/zmqpublishnotifier.h
T
sami7777 e133e97f3b Add comprehensive RPC API upgrade: REST, ZMQ, SSE, address index
Phase 1 - New RPC commands (no new deps):
  - getblockheader: header data from memory, zero disk reads
  - estimatefee: static fee estimation (Bitcoin Core compatible)
  - getblockchaininfo: chain state, difficulty, moneysupply
  - getwalletinfo: balance, stake, txcount, keypool, encryption
  - getnetworkinfo: version, protocol, connections, proxy
  - gettxoutsetinfo: height, bestblock, total_amount

Phase 2 - REST API layer (-rest=1):
  - /rest/chaininfo.json, /rest/block/<hash>.json|hex
  - /rest/blockheader/<hash>.json, /rest/tx/<txid>.json|hex
  - /rest/blockhashbyheight/<n>, /rest/mempool.json
  - CORS headers for browser-based explorer access

Phase 3 - ZMQ pub/sub notifications (optional, USE_ZMQ=1):
  - Topics: hashblock, hashtx, rawblock, rawtx
  - Conditional compilation via ENABLE_ZMQ

Phase 4 - SSE real-time notifications (-ssenotify=1):
  - GET /events endpoint (authenticated, long-lived)
  - Block and transaction event streaming
  - 15-second keepalive for proxy compatibility

Phase 5 - Address index (-addressindex=1):
  - getaddressbalance, getaddressutxos, getaddresstxids
  - LevelDB-backed index updated in ConnectBlock/DisconnectBlock
  - Requires -reindex on first use

Also fixes QDesktopServices missing include for Qt5.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 00:50:34 -07:00

41 lines
959 B
C++

// Copyright (c) 2015 The Bitcoin Core developers
// Copyright (c) 2026 The Triangles developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef TRIANGLES_ZMQ_PUBLISH_NOTIFIER_H
#define TRIANGLES_ZMQ_PUBLISH_NOTIFIER_H
#ifdef ENABLE_ZMQ
#include <string>
class CBlock;
class CTransaction;
class CZMQPublishNotifier
{
private:
void* pcontext;
void* psocket;
std::string address;
bool fInitialized;
public:
CZMQPublishNotifier();
~CZMQPublishNotifier();
bool Initialize(const std::string& address);
void Shutdown();
bool NotifyBlock(const CBlock& block);
bool NotifyBlockHash(const uint256& hash);
bool NotifyTransaction(const CTransaction& tx);
bool NotifyTransactionHash(const uint256& hash);
};
extern CZMQPublishNotifier* pzmqNotifier;
#endif // ENABLE_ZMQ
#endif // TRIANGLES_ZMQ_PUBLISH_NOTIFIER_H