Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/chain.h
Show All 40 Lines | |||||
//! internal workings of the bitcoin node, and not being very convenient to use. | //! internal workings of the bitcoin node, and not being very convenient to use. | ||||
//! Chain methods should be cleaned up and simplified over time. Examples: | //! Chain methods should be cleaned up and simplified over time. Examples: | ||||
//! | //! | ||||
//! * The Chain::lock() method, which lets clients delay chain tip updates | //! * The Chain::lock() method, which lets clients delay chain tip updates | ||||
//! should be removed when clients are able to respond to updates | //! should be removed when clients are able to respond to updates | ||||
//! asynchronously | //! asynchronously | ||||
//! (https://github.com/bitcoin/bitcoin/pull/10973#issuecomment-380101269). | //! (https://github.com/bitcoin/bitcoin/pull/10973#issuecomment-380101269). | ||||
//! | //! | ||||
//! * The isPotentialTip() and waitForNotifications() methods are too low-level | |||||
//! and should be replaced with a higher level | |||||
//! waitForNotificationsUpTo(block_hash) method that the wallet can call | |||||
//! instead | |||||
//! (https://github.com/bitcoin/bitcoin/pull/10973#discussion_r266995234). | |||||
//! | |||||
//! * The relayTransactions() and submitToMemoryPool() methods could be replaced | //! * The relayTransactions() and submitToMemoryPool() methods could be replaced | ||||
//! with a higher-level broadcastTransaction method | //! with a higher-level broadcastTransaction method | ||||
//! (https://github.com/bitcoin/bitcoin/pull/14978#issuecomment-459373984). | //! (https://github.com/bitcoin/bitcoin/pull/14978#issuecomment-459373984). | ||||
//! | //! | ||||
//! * The initMessages() and loadWallet() methods which the wallet uses to send | //! * The initMessages() and loadWallet() methods which the wallet uses to send | ||||
//! notifications to the GUI should go away when GUI and wallet can directly | //! notifications to the GUI should go away when GUI and wallet can directly | ||||
//! communicate with each other without going through the node | //! communicate with each other without going through the node | ||||
//! (https://github.com/bitcoin/bitcoin/pull/15288#discussion_r253321096). | //! (https://github.com/bitcoin/bitcoin/pull/15288#discussion_r253321096). | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | public: | ||||
//! Return height of the highest block on the chain that is an ancestor | //! Return height of the highest block on the chain that is an ancestor | ||||
//! of the specified block, or nullopt if no common ancestor is found. | //! of the specified block, or nullopt if no common ancestor is found. | ||||
//! Also return the height of the specified block as an optional output | //! Also return the height of the specified block as an optional output | ||||
//! parameter (to avoid the cost of a second hash lookup in case this | //! parameter (to avoid the cost of a second hash lookup in case this | ||||
//! information is desired). | //! information is desired). | ||||
virtual Optional<int> findFork(const BlockHash &hash, | virtual Optional<int> findFork(const BlockHash &hash, | ||||
Optional<int> *height) = 0; | Optional<int> *height) = 0; | ||||
//! Return true if block hash points to the current chain tip, or to a | |||||
//! possible descendant of the current chain tip that isn't currently | |||||
//! connected. | |||||
virtual bool isPotentialTip(const BlockHash &hash) = 0; | |||||
//! Get locator for the current chain tip. | //! Get locator for the current chain tip. | ||||
virtual CBlockLocator getTipLocator() = 0; | virtual CBlockLocator getTipLocator() = 0; | ||||
//! Return height of the latest block common to locator and chain, which | //! Return height of the latest block common to locator and chain, which | ||||
//! is guaranteed to be an ancestor of the block used to create the | //! is guaranteed to be an ancestor of the block used to create the | ||||
//! locator. | //! locator. | ||||
virtual Optional<int> findLocatorFork(const CBlockLocator &locator) = 0; | virtual Optional<int> findLocatorFork(const CBlockLocator &locator) = 0; | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | public: | ||||
virtual void UpdatedBlockTip() {} | virtual void UpdatedBlockTip() {} | ||||
virtual void ChainStateFlushed(const CBlockLocator &locator) {} | virtual void ChainStateFlushed(const CBlockLocator &locator) {} | ||||
}; | }; | ||||
//! Register handler for notifications. | //! Register handler for notifications. | ||||
virtual std::unique_ptr<Handler> | virtual std::unique_ptr<Handler> | ||||
handleNotifications(Notifications ¬ifications) = 0; | handleNotifications(Notifications ¬ifications) = 0; | ||||
//! Wait for pending notifications to be handled. | //! Wait for pending notifications to be processed unless block hash points | ||||
virtual void waitForNotifications() = 0; | //! to the current chain tip, or to a possible descendant of the current | ||||
//! chain tip that isn't currently connected. | |||||
virtual void | |||||
waitForNotificationsIfNewBlocksConnected(const BlockHash &old_tip) = 0; | |||||
//! Register handler for RPC. Command is not copied, so reference | //! Register handler for RPC. Command is not copied, so reference | ||||
//! needs to remain valid until Handler is disconnected. | //! needs to remain valid until Handler is disconnected. | ||||
virtual std::unique_ptr<Handler> handleRpc(const CRPCCommand &command) = 0; | virtual std::unique_ptr<Handler> handleRpc(const CRPCCommand &command) = 0; | ||||
//! Check if deprecated RPC is enabled. | //! Check if deprecated RPC is enabled. | ||||
virtual bool rpcEnableDeprecated(const std::string &method) = 0; | virtual bool rpcEnableDeprecated(const std::string &method) = 0; | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |