Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to access to the chain state, receive notifications, estimate fees, and submit transactions.
More...
|
virtual | ~Chain ()=default |
|
virtual std::optional< int > | getHeight ()=0 |
| Get current chain height, not including genesis block (returns 0 if chain only contains genesis block, nullopt if chain does not contain any blocks) More...
|
|
virtual uint256 | getBlockHash (int height)=0 |
| Get block hash. Height must be valid or this function will abort. More...
|
|
virtual bool | haveBlockOnDisk (int height)=0 |
| Check that the block is available on disk (i.e. More...
|
|
virtual CBlockLocator | getTipLocator ()=0 |
| Get locator for the current chain tip. More...
|
|
virtual CBlockLocator | getActiveChainLocator (const uint256 &block_hash)=0 |
| Return a locator that refers to a block in the active chain. More...
|
|
virtual std::optional< int > | findLocatorFork (const CBlockLocator &locator)=0 |
| Return height of the highest block on chain in common with the locator, which will either be the original block used to create the locator, or one of its ancestors. More...
|
|
virtual bool | hasBlockFilterIndex (BlockFilterType filter_type)=0 |
| Returns whether a block filter index is available. More...
|
|
virtual std::optional< bool > | blockFilterMatchesAny (BlockFilterType filter_type, const uint256 &block_hash, const GCSFilter::ElementSet &filter_set)=0 |
| Returns whether any of the elements match the block via a BIP 157 block filter or std::nullopt if the block filter for this block couldn't be found. More...
|
|
virtual bool | findBlock (const uint256 &hash, const FoundBlock &block={})=0 |
| Return whether node has the block and optionally return block metadata or contents. More...
|
|
virtual bool | findFirstBlockWithTimeAndHeight (int64_t min_time, int min_height, const FoundBlock &block={})=0 |
| Find first block in the chain with timestamp >= the given time and height >= than the given height, return false if there is no block with a high enough timestamp and height. More...
|
|
virtual bool | findAncestorByHeight (const uint256 &block_hash, int ancestor_height, const FoundBlock &ancestor_out={})=0 |
| Find ancestor of block at specified height and optionally return ancestor information. More...
|
|
virtual bool | findAncestorByHash (const uint256 &block_hash, const uint256 &ancestor_hash, const FoundBlock &ancestor_out={})=0 |
| Return whether block descends from a specified ancestor, and optionally return ancestor information. More...
|
|
virtual bool | findCommonAncestor (const uint256 &block_hash1, const uint256 &block_hash2, const FoundBlock &ancestor_out={}, const FoundBlock &block1_out={}, const FoundBlock &block2_out={})=0 |
| Find most recent common ancestor between two blocks and optionally return block information. More...
|
|
virtual void | findCoins (std::map< COutPoint, Coin > &coins)=0 |
| Look up unspent output information. More...
|
|
virtual double | guessVerificationProgress (const uint256 &block_hash)=0 |
| Estimate fraction of total transactions verified if blocks up to the specified block hash are verified. More...
|
|
virtual bool | hasBlocks (const uint256 &block_hash, int min_height=0, std::optional< int > max_height={})=0 |
| Return true if data is available for all blocks in the specified range of blocks. More...
|
|
virtual RBFTransactionState | isRBFOptIn (const CTransaction &tx)=0 |
| Check if transaction is RBF opt in. More...
|
|
virtual bool | isInMempool (const uint256 &txid)=0 |
| Check if transaction is in mempool. More...
|
|
virtual bool | hasDescendantsInMempool (const uint256 &txid)=0 |
| Check if transaction has descendants in mempool. More...
|
|
virtual bool | broadcastTransaction (const CTransactionRef &tx, const CAmount &max_tx_fee, bool relay, std::string &err_string)=0 |
| Transaction is added to memory pool, if the transaction fee is below the amount specified by max_tx_fee, and broadcast to all peers if relay is set to true. More...
|
|
virtual void | getTransactionAncestry (const uint256 &txid, size_t &ancestors, size_t &descendants, size_t *ancestorsize=nullptr, CAmount *ancestorfees=nullptr)=0 |
| Calculate mempool ancestor and descendant counts for the given transaction. More...
|
|
virtual std::map< COutPoint, CAmount > | calculateIndividualBumpFees (const std::vector< COutPoint > &outpoints, const CFeeRate &target_feerate)=0 |
| For each outpoint, calculate the fee-bumping cost to spend this outpoint at the specified. More...
|
|
virtual std::optional< CAmount > | calculateCombinedBumpFee (const std::vector< COutPoint > &outpoints, const CFeeRate &target_feerate)=0 |
| Calculate the combined bump fee for an input set per the same strategy. More...
|
|
virtual void | getPackageLimits (unsigned int &limit_ancestor_count, unsigned int &limit_descendant_count)=0 |
| Get the node's package limits. More...
|
|
virtual util::Result< void > | checkChainLimits (const CTransactionRef &tx)=0 |
| Check if transaction will pass the mempool's chain limits. More...
|
|
virtual CFeeRate | estimateSmartFee (int num_blocks, bool conservative, FeeCalculation *calc=nullptr)=0 |
| Estimate smart fee. More...
|
|
virtual unsigned int | estimateMaxBlocks ()=0 |
| Fee estimator max target. More...
|
|
virtual CFeeRate | mempoolMinFee ()=0 |
| Mempool minimum fee. More...
|
|
virtual CFeeRate | relayMinFee ()=0 |
| Relay current minimum fee (from -minrelaytxfee and -incrementalrelayfee settings). More...
|
|
virtual CFeeRate | relayIncrementalFee ()=0 |
| Relay incremental fee setting (-incrementalrelayfee), reflecting cost of relay. More...
|
|
virtual CFeeRate | relayDustFee ()=0 |
| Relay dust fee setting (-dustrelayfee), reflecting lowest rate it's economical to spend. More...
|
|
virtual bool | havePruned ()=0 |
| Check if any block has been pruned. More...
|
|
virtual bool | isReadyToBroadcast ()=0 |
| Check if the node is ready to broadcast transactions. More...
|
|
virtual bool | isInitialBlockDownload ()=0 |
| Check if in IBD. More...
|
|
virtual bool | shutdownRequested ()=0 |
| Check if shutdown requested. More...
|
|
virtual void | initMessage (const std::string &message)=0 |
| Send init message. More...
|
|
virtual void | initWarning (const bilingual_str &message)=0 |
| Send init warning. More...
|
|
virtual void | initError (const bilingual_str &message)=0 |
| Send init error. More...
|
|
virtual void | showProgress (const std::string &title, int progress, bool resume_possible)=0 |
| Send progress indicator. More...
|
|
virtual std::unique_ptr< Handler > | handleNotifications (std::shared_ptr< Notifications > notifications)=0 |
| Register handler for notifications. More...
|
|
virtual void | waitForNotificationsIfTipChanged (const uint256 &old_tip)=0 |
| Wait for pending notifications to be processed unless block hash points to the current chain tip. More...
|
|
virtual std::unique_ptr< Handler > | handleRpc (const CRPCCommand &command)=0 |
| Register handler for RPC. More...
|
|
virtual bool | rpcEnableDeprecated (const std::string &method)=0 |
| Check if deprecated RPC is enabled. More...
|
|
virtual void | rpcRunLater (const std::string &name, std::function< void()> fn, int64_t seconds)=0 |
| Run function after given number of seconds. Cancel any previous calls with same name. More...
|
|
virtual common::SettingsValue | getSetting (const std::string &arg)=0 |
| Get settings value. More...
|
|
virtual std::vector< common::SettingsValue > | getSettingsList (const std::string &arg)=0 |
| Get list of settings values. More...
|
|
virtual common::SettingsValue | getRwSetting (const std::string &name)=0 |
| Return <datadir>/settings.json setting value. More...
|
|
virtual bool | updateRwSetting (const std::string &name, const SettingsUpdate &update_function)=0 |
| Updates a setting in <datadir>/settings.json. More...
|
|
virtual bool | overwriteRwSetting (const std::string &name, common::SettingsValue value, SettingsAction action=SettingsAction::WRITE)=0 |
| Replace a setting in <datadir>/settings.json with a new value. More...
|
|
virtual bool | deleteRwSettings (const std::string &name, SettingsAction action=SettingsAction::WRITE)=0 |
| Delete a given setting in <datadir>/settings.json. More...
|
|
virtual void | requestMempoolTransactions (Notifications ¬ifications)=0 |
| Synchronously send transactionAddedToMempool notifications about all current mempool transactions to the specified handler and return after the last one is sent. More...
|
|
virtual bool | hasAssumedValidChain ()=0 |
| Return true if an assumed-valid chain is in use. More...
|
|
virtual node::NodeContext * | context () |
| Get internal node context. More...
|
|
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to access to the chain state, receive notifications, estimate fees, and submit transactions.
TODO: Current chain methods are too low level, exposing too much of the internal workings of the bitcoin node, and not being very convenient to use. Chain methods should be cleaned up and simplified over time. Examples:
- The initMessages() and showProgress() methods which the wallet uses to send notifications to the GUI should go away when GUI and wallet can directly communicate with each other without going through the node (https://github.com/bitcoin/bitcoin/pull/15288#discussion_r253321096).
- The handleRpc, registerRpcs, rpcEnableDeprecated methods and other RPC methods can go away if wallets listen for HTTP requests on their own ports instead of registering to handle requests on the node HTTP port.
- Move fee estimation queries to an asynchronous interface and let the wallet cache it, fee estimation being driven by node mempool, wallet should be the consumer.
guessVerificationProgress
and similar methods can go away if rescan logic moves out of the wallet, and the wallet just requests scans from the node (https://github.com/bitcoin/bitcoin/issues/11756)
Definition at line 128 of file chain.h.