Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/node.h
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | public: | ||||
virtual size_t getMempoolDynamicUsage() = 0; | virtual size_t getMempoolDynamicUsage() = 0; | ||||
//! Get header tip height and time. | //! Get header tip height and time. | ||||
virtual bool getHeaderTip(int &height, int64_t &block_time) = 0; | virtual bool getHeaderTip(int &height, int64_t &block_time) = 0; | ||||
//! Get num blocks. | //! Get num blocks. | ||||
virtual int getNumBlocks() = 0; | virtual int getNumBlocks() = 0; | ||||
//! Get best block hash. | |||||
virtual BlockHash getBestBlockHash() = 0; | |||||
//! Get last block time. | //! Get last block time. | ||||
virtual int64_t getLastBlockTime() = 0; | virtual int64_t getLastBlockTime() = 0; | ||||
//! Get verification progress. | //! Get verification progress. | ||||
virtual double getVerificationProgress() = 0; | virtual double getVerificationProgress() = 0; | ||||
//! Is initial block download. | //! Is initial block download. | ||||
virtual bool isInitialBlockDownload() = 0; | virtual bool isInitialBlockDownload() = 0; | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | public: | ||||
handleNotifyAlertChanged(NotifyAlertChangedFn fn) = 0; | handleNotifyAlertChanged(NotifyAlertChangedFn fn) = 0; | ||||
//! Register handler for ban list messages. | //! Register handler for ban list messages. | ||||
using BannedListChangedFn = std::function<void()>; | using BannedListChangedFn = std::function<void()>; | ||||
virtual std::unique_ptr<Handler> | virtual std::unique_ptr<Handler> | ||||
handleBannedListChanged(BannedListChangedFn fn) = 0; | handleBannedListChanged(BannedListChangedFn fn) = 0; | ||||
//! Register handler for block tip messages. | //! Register handler for block tip messages. | ||||
using NotifyBlockTipFn = | using NotifyBlockTipFn = std::function<void( | ||||
std::function<void(SynchronizationState, int height, int64_t block_time, | SynchronizationState, const BlockHash &block_hash, int height, | ||||
double verification_progress)>; | int64_t block_time, double verification_progress)>; | ||||
virtual std::unique_ptr<Handler> | virtual std::unique_ptr<Handler> | ||||
handleNotifyBlockTip(NotifyBlockTipFn fn) = 0; | handleNotifyBlockTip(NotifyBlockTipFn fn) = 0; | ||||
//! Register handler for header tip messages. | //! Register handler for header tip messages. | ||||
using NotifyHeaderTipFn = | using NotifyHeaderTipFn = std::function<void( | ||||
std::function<void(SynchronizationState, int height, int64_t block_time, | SynchronizationState, const BlockHash &block_hash, int height, | ||||
double verification_progress)>; | int64_t block_time, double verification_progress)>; | ||||
virtual std::unique_ptr<Handler> | virtual std::unique_ptr<Handler> | ||||
handleNotifyHeaderTip(NotifyHeaderTipFn fn) = 0; | handleNotifyHeaderTip(NotifyHeaderTipFn fn) = 0; | ||||
//! Get and set internal node context. Useful for testing, but not | //! Get and set internal node context. Useful for testing, but not | ||||
//! accessible across processes. | //! accessible across processes. | ||||
virtual NodeContext *context() { return nullptr; } | virtual NodeContext *context() { return nullptr; } | ||||
virtual void setContext(NodeContext *context) {} | virtual void setContext(NodeContext *context) {} | ||||
}; | }; | ||||
//! Return implementation of Node interface. | //! Return implementation of Node interface. | ||||
std::unique_ptr<Node> MakeNode(NodeContext *context = nullptr); | std::unique_ptr<Node> MakeNode(NodeContext *context = nullptr); | ||||
} // namespace interfaces | } // namespace interfaces | ||||
#endif // BITCOIN_INTERFACES_NODE_H | #endif // BITCOIN_INTERFACES_NODE_H |