5 #ifndef BITCOIN_INTERFACES_NODE_H 6 #define BITCOIN_INTERFACES_NODE_H 58 virtual void initLogging() = 0;
61 virtual void initParameterInteraction() = 0;
67 virtual uint32_t getLogCategories() = 0;
70 virtual bool baseInitialize() = 0;
76 virtual void appShutdown() = 0;
79 virtual void startShutdown() = 0;
82 virtual bool shutdownRequested() = 0;
85 virtual void mapPort(
bool use_upnp) = 0;
94 using NodesStats = std::vector<std::tuple<CNodeStats, bool, CNodeStateStats>>;
95 virtual bool getNodesStats(
NodesStats& stats) = 0;
98 virtual bool getBanned(
banmap_t& banmap) = 0;
101 virtual bool ban(
const CNetAddr& net_addr, int64_t ban_time_offset) = 0;
104 virtual bool unban(
const CSubNet& ip) = 0;
107 virtual bool disconnectByAddress(
const CNetAddr& net_addr) = 0;
110 virtual bool disconnectById(
NodeId id) = 0;
113 virtual int64_t getTotalBytesRecv() = 0;
116 virtual int64_t getTotalBytesSent() = 0;
119 virtual size_t getMempoolSize() = 0;
122 virtual size_t getMempoolDynamicUsage() = 0;
125 virtual bool getHeaderTip(
int& height, int64_t&
block_time) = 0;
128 virtual int getNumBlocks() = 0;
131 virtual uint256 getBestBlockHash() = 0;
134 virtual int64_t getLastBlockTime() = 0;
137 virtual double getVerificationProgress() = 0;
140 virtual bool isInitialBlockDownload() = 0;
143 virtual bool getReindex() = 0;
146 virtual bool getImporting() = 0;
149 virtual void setNetworkActive(
bool active) = 0;
152 virtual bool getNetworkActive() = 0;
155 virtual CFeeRate estimateSmartFee(
int num_blocks,
bool conservative,
int* returned_target =
nullptr) = 0;
158 virtual CFeeRate getDustRelayFee() = 0;
161 virtual UniValue executeRpc(
const std::string& command,
const UniValue& params,
const std::string& uri) = 0;
164 virtual std::vector<std::string> listRpcCommands() = 0;
173 virtual bool getUnspentOutput(
const COutPoint& output,
Coin& coin) = 0;
180 virtual std::unique_ptr<Handler> handleInitMessage(
InitMessageFn fn) = 0;
184 std::function<bool(const bilingual_str& message, const std::string& caption, unsigned int style)>;
185 virtual std::unique_ptr<Handler> handleMessageBox(
MessageBoxFn fn) = 0;
189 const std::string& non_interactive_message,
190 const std::string& caption,
191 unsigned int style)>;
192 virtual std::unique_ptr<Handler> handleQuestion(
QuestionFn fn) = 0;
195 using ShowProgressFn = std::function<void(const std::string& title, int progress, bool resume_possible)>;
196 virtual std::unique_ptr<Handler> handleShowProgress(
ShowProgressFn fn) = 0;
216 std::function<void(SynchronizationState, interfaces::BlockTip tip, double verification_progress)>;
217 virtual std::unique_ptr<Handler> handleNotifyBlockTip(
NotifyBlockTipFn fn) = 0;
221 std::function<void(SynchronizationState, interfaces::BlockTip tip, double verification_progress)>;
222 virtual std::unique_ptr<Handler> handleNotifyHeaderTip(
NotifyHeaderTipFn fn) = 0;
242 #endif // BITCOIN_INTERFACES_NODE_H
Block tip (could be a header or not, depends on the subscribed signal).
SynchronizationState
Current sync state passed to tip changed callbacks.
std::function< void(bool network_active)> NotifyNetworkActiveChangedFn
Register handler for network active messages.
std::function< void(SynchronizationState, interfaces::BlockTip tip, double verification_progress)> NotifyBlockTipFn
Register handler for block tip messages.
Wallet chain client that in addition to having chain client methods for starting up, shutting down, and registering RPCs, also has additional methods (called by the GUI) to load and create wallets.
virtual void setContext(NodeContext *context)
std::function< void(SynchronizationState, interfaces::BlockTip tip, double verification_progress)> NotifyHeaderTipFn
Register handler for header tip messages.
NodeContext struct containing references to chain state and connection state.
std::function< void()> NotifyAlertChangedFn
Register handler for notify alert messages.
Block and header tip information.
std::vector< std::tuple< CNodeStats, bool, CNodeStateStats >> NodesStats
Get stats for connected nodes.
An outpoint - a combination of a transaction hash and an index n into its vout.
std::function< void(const std::string &message)> InitMessageFn
Register handler for init messages.
std::function< void()> BannedListChangedFn
Register handler for ban list messages.
std::function< void(int new_num_connections)> NotifyNumConnectionsChangedFn
Register handler for number of connections changed messages.
double verification_progress
std::function< bool(const bilingual_str &message, const std::string &non_interactive_message, const std::string &caption, unsigned int style)> QuestionFn
Register handler for question messages.
virtual NodeContext * context()
Get and set internal node context.
Fee rate in satoshis per kilobyte: CAmount / kB.
std::function< void(const std::string &title, int progress, bool resume_possible)> ShowProgressFn
Register handler for progress messages.
std::map< CSubNet, CBanEntry > banmap_t
std::function< bool(const bilingual_str &message, const std::string &caption, unsigned int style)> MessageBoxFn
Register handler for message box messages.
std::unique_ptr< Node > MakeNode(NodeContext *context)
Return implementation of Node interface.
Top-level interface for a bitcoin node (bitcoind process).