5#ifndef BITCOIN_INTERFACES_CHAIN_H
6#define BITCOIN_INTERFACES_CHAIN_H
8#include <blockfilter.h>
177 virtual void findCoins(std::map<COutPoint, Coin>& coins) = 0;
186 virtual bool hasBlocks(
const uint256& block_hash,
int min_height = 0, std::optional<int> max_height = {}) = 0;
209 std::string& err_string) = 0;
254 virtual void getPackageLimits(
unsigned int& limit_ancestor_count,
unsigned int& limit_descendant_count) = 0;
302 virtual void showProgress(
const std::string& title,
int progress,
bool resume_possible) = 0;
352 virtual std::vector<common::SettingsValue>
getSettingsList(
const std::string& arg) = 0;
int64_t CAmount
Amount in satoshis (Can be negative).
Undo information for a CBlock.
Fee rate in satoshis per virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac.
Simple class for background tasks that should be run periodically or once "after a while".
The basic transaction that is broadcasted on the network and contained in blocks.
std::unordered_set< Element, ByteVectorHash > ElementSet
virtual void transactionRemovedFromMempool(const CTransactionRef &tx, MemPoolRemovalReason reason)
virtual void chainStateFlushed(const kernel::ChainstateRole &role, const CBlockLocator &locator)
virtual void blockDisconnected(const BlockInfo &block)
virtual void updatedBlockTip()
virtual void transactionAddedToMempool(const CTransactionRef &tx)
virtual ~Notifications()=default
virtual void blockConnected(const kernel::ChainstateRole &role, const BlockInfo &block)
virtual void schedulerMockForward(std::chrono::seconds delta_seconds)=0
Mock the scheduler to fast forward in time.
virtual void stop()=0
Shut down client.
virtual ~ChainClient()=default
virtual bool load()=0
Load saved state.
virtual void registerRpcs()=0
Register rpcs.
virtual void start(CScheduler &scheduler)=0
Start client execution and provide a scheduler.
virtual bool verify()=0
Check for errors before loading.
virtual void setMockTime(int64_t time)=0
Set mock time.
virtual std::unique_ptr< Handler > handleRpc(const CRPCCommand &command)=0
virtual bool isInitialBlockDownload()=0
Check if in IBD.
virtual std::optional< int > getHeight()=0
virtual std::optional< bool > blockFilterMatchesAny(BlockFilterType filter_type, const uint256 &block_hash, const GCSFilter::ElementSet &filter_set)=0
virtual bool overwriteRwSetting(const std::string &name, common::SettingsValue value, SettingsAction action=SettingsAction::WRITE)=0
virtual bool rpcEnableDeprecated(const std::string &method)=0
Check if deprecated RPC is enabled.
virtual bool hasBlocks(const uint256 &block_hash, int min_height=0, std::optional< int > max_height={})=0
virtual std::unique_ptr< Handler > handleNotifications(std::shared_ptr< Notifications > notifications)=0
virtual RBFTransactionState isRBFOptIn(const CTransaction &tx)=0
Check if transaction is RBF opt in.
virtual bool findCommonAncestor(const uint256 &block_hash1, const uint256 &block_hash2, const FoundBlock &ancestor_out={}, const FoundBlock &block1_out={}, const FoundBlock &block2_out={})=0
virtual uint256 getBlockHash(int height)=0
Get block hash. Height must be valid or this function will abort.
virtual bool findFirstBlockWithTimeAndHeight(int64_t min_time, int min_height, const FoundBlock &block={})=0
virtual bool findAncestorByHash(const uint256 &block_hash, const uint256 &ancestor_hash, const FoundBlock &ancestor_out={})=0
virtual node::NodeContext * context()
virtual bool deleteRwSettings(const std::string &name, SettingsAction action=SettingsAction::WRITE)=0
virtual void showProgress(const std::string &title, int progress, bool resume_possible)=0
Send progress indicator.
virtual bool havePruned()=0
Check if any block has been pruned.
virtual bool updateRwSetting(const std::string &name, const SettingsUpdate &update_function)=0
virtual void findCoins(std::map< COutPoint, Coin > &coins)=0
virtual bool shutdownRequested()=0
Check if shutdown requested.
virtual bool hasBlockFilterIndex(BlockFilterType filter_type)=0
Returns whether a block filter index is available.
virtual common::SettingsValue getRwSetting(const std::string &name)=0
Return <datadir>/settings.json setting value.
virtual bool hasDescendantsInMempool(const Txid &txid)=0
Check if transaction has descendants in mempool.
virtual void waitForNotifications()=0
Wait for all pending notifications up to this point to be processed.
virtual common::SettingsValue getSetting(const std::string &arg)=0
Get settings value.
virtual bool isReadyToBroadcast()=0
Check if the node is ready to broadcast transactions.
virtual bool hasAssumedValidChain()=0
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.
virtual bool isInMempool(const Txid &txid)=0
Check if transaction is in mempool.
virtual bool findAncestorByHeight(const uint256 &block_hash, int ancestor_height, const FoundBlock &ancestor_out={})=0
virtual bool findBlock(const uint256 &hash, const FoundBlock &block={})=0
virtual double guessVerificationProgress(const uint256 &block_hash)=0
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.
virtual void waitForNotificationsIfTipChanged(const uint256 &old_tip)=0
virtual CFeeRate mempoolMinFee()=0
Mempool minimum fee.
virtual void initMessage(const std::string &message)=0
Send init message.
virtual unsigned int estimateMaxBlocks()=0
Fee estimator max target.
virtual void getPackageLimits(unsigned int &limit_ancestor_count, unsigned int &limit_descendant_count)=0
virtual std::optional< int > findLocatorFork(const CBlockLocator &locator)=0
virtual bool haveBlockOnDisk(int height)=0
virtual bool broadcastTransaction(const CTransactionRef &tx, const CAmount &max_tx_fee, node::TxBroadcast broadcast_method, std::string &err_string)=0
virtual util::Result< void > checkChainLimits(const CTransactionRef &tx)=0
Check if transaction will pass the mempool's chain limits.
virtual void getTransactionAncestry(const Txid &txid, size_t &ancestors, size_t &cluster_count, size_t *ancestorsize=nullptr, CAmount *ancestorfees=nullptr)=0
Calculate mempool ancestor and cluster counts for the given transaction.
virtual std::vector< common::SettingsValue > getSettingsList(const std::string &arg)=0
Get list of settings values.
virtual CFeeRate relayDustFee()=0
Relay dust fee setting (-dustrelayfee), reflecting lowest rate it's economical to spend.
virtual void requestMempoolTransactions(Notifications ¬ifications)=0
virtual void initError(const bilingual_str &message)=0
Send init error.
virtual void initWarning(const bilingual_str &message)=0
Send init warning.
virtual CFeeRate estimateSmartFee(int num_blocks, bool conservative, FeeCalculation *calc=nullptr)=0
Estimate smart fee.
virtual CFeeRate relayMinFee()=0
Relay current minimum fee (from -minrelaytxfee and -incrementalrelayfee settings).
virtual CFeeRate relayIncrementalFee()=0
Relay incremental fee setting (-incrementalrelayfee), reflecting cost of relay.
virtual std::optional< int > getPruneHeight()=0
Get the current prune height.
FoundBlock & time(int64_t &time)
FoundBlock & hash(uint256 &hash)
const FoundBlock * m_next_block
FoundBlock & mtpTime(int64_t &mtp_time)
FoundBlock & locator(CBlockLocator &locator)
Return locator if block is in the active chain.
FoundBlock & nextBlock(const FoundBlock &next_block)
Return next block in the active chain if current block is in the active chain.
FoundBlock & maxTime(int64_t &max_time)
FoundBlock & height(int &height)
FoundBlock & inActiveChain(bool &in_active_chain)
Return whether block is in the active (most-work) chain.
FoundBlock & data(CBlock &data)
CBlockLocator * m_locator
Interface for accessing a wallet.
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
std::function< std::optional< interfaces::SettingsAction >(common::SettingsValue &)> SettingsUpdate
std::unique_ptr< Chain > MakeChain(node::NodeContext &node)
Return implementation of Chain interface.
TxBroadcast
How to broadcast a local transaction.
RBFTransactionState
The rbf state of unconfirmed transactions.
std::shared_ptr< const CTransaction > CTransactionRef
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
Options specifying which chain notifications are required.
Block data sent with blockConnected, blockDisconnected notifications.
bool connect_undo_data
Include undo data with block connected notifications.
bool disconnect_undo_data
Include undo data with block disconnected notifications.
bool disconnect_data
Include block data with block disconnected notifications.
Information about chainstate that notifications are sent from.
transaction_identifier< false > Txid
Txid commits to all transaction fields except the witness.