Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
251//! Currently only returns the ancestor and descendant count limits, but could be enhanced to252//! return more policy settings.253virtual void getPackageLimits(unsigned int& limit_ancestor_count, unsigned int& limit_descendant_count) = 0;255//! Check if transaction will pass the mempool's chain limits.256virtual util::Result<void> checkChainLimits(const CTransactionRef& tx) = 0;258//! Estimate a fee rate.259virtual util::Expected<FeeRateEstimation, FeeRateEstimationError> getFeeRateEstimate(int num_blocks, bool conservative) const = 0;261//! Fee estimator max target.262virtual unsigned int maximumFeeEstimationTargetBlocks() const = 0;264//! Mempool minimum fee.265virtual CFeeRate mempoolMinFee() = 0;267//! Relay current minimum fee (from -minrelaytxfee and -incrementalrelayfee settings).268virtual CFeeRate relayMinFee() = 0;270//! Relay incremental fee setting (-incrementalrelayfee), reflecting cost of relay.271virtual CFeeRate relayIncrementalFee() = 0;273//! Relay dust fee setting (-dustrelayfee), reflecting lowest rate it's economical to spend.274virtual CFeeRate relayDustFee() = 0;276//! Check if any block has been pruned.277virtual bool havePruned() = 0;279//! Get the current prune height.280virtual std::optional<int> getPruneHeight() = 0;282//! Check if the node is ready to broadcast transactions.283virtual bool isReadyToBroadcast() = 0;285//! Check if in IBD.286virtual bool isInitialBlockDownload() = 0;288//! Check if shutdown requested.289virtual bool shutdownRequested() = 0;291//! Send init message.292virtual void initMessage(const std::string& message) = 0;294//! Send init warning.295virtual void initWarning(const bilingual_str& message) = 0;297//! Send init error.298virtual void initError(const bilingual_str& message) = 0;300//! Send progress indicator.301virtual void showProgress(const std::string& title, int progress, bool resume_possible) = 0;303//! Chain notifications.304class Notifications305{306public:307virtual ~Notifications() = default;308virtual void transactionAddedToMempool(const CTransactionRef& tx) {}309virtual void transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason) {}310virtual void blockConnected(const kernel::ChainstateRole& role, const BlockInfo& block) {}311virtual void blockDisconnected(const BlockInfo& block) {}312virtual void updatedBlockTip() {}313virtual void chainStateFlushed(const kernel::ChainstateRole& role, const CBlockLocator& locator) {}314};316//! Options specifying which chain notifications are required.317struct NotifyOptions318{319//! Include undo data with block connected notifications.320bool connect_undo_data = false;321//! Include block data with block disconnected notifications.322bool disconnect_data = false;323//! Include undo data with block disconnected notifications.324bool disconnect_undo_data = false;325};327//! Register handler for notifications.328//! Some notifications are asynchronous and may still execute after the handler is disconnected.329//! Use waitForNotifications() after the handler is disconnected to ensure all pending notifications330//! have been processed.331virtual std::unique_ptr<Handler> handleNotifications(std::shared_ptr<Notifications> notifications) = 0;333//! Wait for pending notifications to be processed unless block hash points to the current334//! chain tip.335virtual void waitForNotificationsIfTipChanged(const uint256& old_tip) = 0;337//! Wait for all pending notifications up to this point to be processed338virtual void waitForNotifications() = 0;340//! Register handler for RPC. Command is not copied, so reference341//! needs to remain valid until Handler is disconnected.342virtual std::unique_ptr<Handler> handleRpc(const CRPCCommand& command) = 0;344//! Check if deprecated RPC is enabled.345virtual bool rpcEnableDeprecated(const std::string& method) = 0;347//! Get settings value.348virtual common::SettingsValue getSetting(const std::string& arg) = 0;350//! Get list of settings values.351virtual std::vector<common::SettingsValue> getSettingsList(const std::string& arg) = 0;353//! Return <datadir>/settings.json setting value.354virtual common::SettingsValue getRwSetting(const std::string& name) = 0;356//! Updates a setting in <datadir>/settings.json.357//! Null can be passed to erase the setting. There is intentionally no358//! support for writing null values to settings.json.359//! Depending on the action returned by the update function, this will either360//! update the setting in memory or write the updated settings to disk.361//! Returns false if the update function returned no action, or if the362//! settings could not be written to disk, including when settings are363//! disabled with -nosettings. In-memory changes are kept either way.364virtual bool updateRwSetting(const std::string& name, const SettingsUpdate& update_function) = 0;366//! Replace a setting in <datadir>/settings.json with a new value.367//! Null can be passed to erase the setting.368//! This method provides a simpler alternative to updateRwSetting when369//! atomically reading and updating the setting is not required.370virtual bool overwriteRwSetting(const std::string& name, common::SettingsValue value, SettingsAction action = SettingsAction::WRITE) = 0;372//! Delete a given setting in <datadir>/settings.json.373//! This method provides a simpler alternative to overwriteRwSetting when374//! erasing a setting, for ease of use and readability.375virtual bool deleteRwSettings(const std::string& name, SettingsAction action = SettingsAction::WRITE) = 0;377//! Synchronously send transactionAddedToMempool notifications about all378//! current mempool transactions to the specified handler and return after379//! the last one is sent. These notifications aren't coordinated with async380//! notifications sent by handleNotifications, so out of date async381//! notifications from handleNotifications can arrive during and after382//! synchronous notifications from requestMempoolTransactions. Clients need383//! to be prepared to handle this by ignoring notifications about unknown384//! removed transactions and already added new transactions.385virtual void requestMempoolTransactions(Notifications& notifications) = 0;387//! Return true if an assumed-valid snapshot is in use. Note that this388//! returns true even after the snapshot is validated, until the next node389//! restart.390virtual bool hasAssumedValidChain() = 0;392//! Get internal node context. Useful for testing, but not393//! accessible across processes.394virtual node::NodeContext* context() { return nullptr; }395};397//! Interface to let node manage chain clients (wallets, or maybe tools for398//! monitoring and analysis in the future).399class ChainClient400{401public:402virtual ~ChainClient() = default;404//! Register rpcs.405virtual void registerRpcs() = 0;407//! Check for errors before loading.408virtual bool verify() = 0;410//! Load saved state.411virtual bool load() = 0;413//! Start client execution and provide a scheduler.414virtual void start(CScheduler& scheduler) = 0;416//! Shut down client.417virtual void stop() = 0;419//! Set mock time.420virtual void setMockTime(int64_t time) = 0;422//! Mock the scheduler to fast forward in time.423virtual void schedulerMockForward(std::chrono::seconds delta_seconds) = 0;424};426//! Return implementation of Chain interface.427std::unique_ptr<Chain> MakeChain(node::NodeContext& node);429} // namespace interfaces431#endif // BITCOIN_INTERFACES_CHAIN_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.