Bitcoin
|
#include <chain.h>
Classes | |
class | Lock |
class | Notifications |
Chain notifications. More... | |
Public Member Functions | |
virtual | ~Chain () |
virtual std::unique_ptr< Lock > | lock (bool try_lock=false)=0 |
virtual bool | findBlock (const uint256 &hash, CBlock *block=nullptr, int64_t *time=nullptr, int64_t *max_time=nullptr)=0 |
virtual void | findCoins (std::map< COutPoint, Coin > &coins)=0 |
virtual double | guessVerificationProgress (const uint256 &block_hash)=0 |
virtual RBFTransactionState | isRBFOptIn (const CTransaction &tx)=0 |
Check if transaction is RBF opt in. More... | |
virtual bool | hasDescendantsInMempool (const uint256 &txid)=0 |
Check if transaction has descendants in mempool. More... | |
virtual void | relayTransaction (const uint256 &txid)=0 |
Relay transaction. More... | |
virtual void | getTransactionAncestry (const uint256 &txid, size_t &ancestors, size_t &descendants)=0 |
Calculate mempool ancestor and descendant counts for the given transaction. More... | |
virtual bool | 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 | p2pEnabled ()=0 |
Check if p2p enabled. 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 int64_t | getAdjustedTime ()=0 |
Get adjusted time. More... | |
virtual void | initMessage (const std::string &message)=0 |
Send init message. More... | |
virtual void | initWarning (const std::string &message)=0 |
Send init warning. More... | |
virtual void | initError (const std::string &message)=0 |
Send init error. More... | |
virtual void | loadWallet (std::unique_ptr< Wallet > wallet)=0 |
Send wallet load notification to the GUI. More... | |
virtual void | showProgress (const std::string &title, int progress, bool resume_possible)=0 |
Send progress indicator. More... | |
virtual std::unique_ptr< Handler > | handleNotifications (Notifications ¬ifications)=0 |
Register handler for notifications. More... | |
virtual void | waitForNotificationsIfNewBlocksConnected (const uint256 &old_tip)=0 |
virtual std::unique_ptr< Handler > | handleRpc (const CRPCCommand &command)=0 |
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 int | rpcSerializationFlags ()=0 |
Current RPC serialization flags. More... | |
virtual void | requestMempoolTransactions (Notifications ¬ifications)=0 |
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:
|
inlinevirtual |
|
pure virtual |
Check if transaction will pass the mempool's chain limits.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Fee estimator max target.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Estimate smart fee.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Return whether node has the block and optionally return block metadata or contents.
If a block pointer is provided to retrieve the block contents, and the block exists but doesn't have data (for example due to pruning), the block will be empty and all fields set to null.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
Look up unspent output information. Returns coins in the mempool and in the current chain UTXO set. Iterates through all the keys in the map and populates the values.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Get adjusted time.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Calculate mempool ancestor and descendant counts for the given transaction.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Estimate fraction of total transactions verified if blocks up to the specified block hash are verified.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Register handler for notifications.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Register handler for RPC. Command is not copied, so reference needs to remain valid until Handler is disconnected.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Check if transaction has descendants in mempool.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Check if any block has been pruned.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Send init error.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Send init message.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Send init warning.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Check if in IBD.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Check if transaction is RBF opt in.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Check if the node is ready to broadcast transactions.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Send wallet load notification to the GUI.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Return Lock interface. Chain is locked when this is called, and unlocked when the returned interface is freed.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Mempool minimum fee.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Check if p2p enabled.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Relay dust fee setting (-dustrelayfee), reflecting lowest rate it's economical to spend.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Relay incremental fee setting (-incrementalrelayfee), reflecting cost of relay.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Relay current minimum fee (from -minrelaytxfee and -incrementalrelayfee settings).
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Relay transaction.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Synchronously send TransactionAddedToMempool notifications about all current mempool transactions to the specified handler and return after the last one is sent. These notifications aren't coordinated with async notifications sent by handleNotifications, so out of date async notifications from handleNotifications can arrive during and after synchronous notifications from requestMempoolTransactions. Clients need to be prepared to handle this by ignoring notifications about unknown removed transactions and already added new transactions.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Check if deprecated RPC is enabled.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Run function after given number of seconds. Cancel any previous calls with same name.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Current RPC serialization flags.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Send progress indicator.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Check if shutdown requested.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.
|
pure virtual |
Wait for pending notifications to be processed unless block hash points to the current chain tip, or to a possible descendant of the current chain tip that isn't currently connected.
Implemented in interfaces::anonymous_namespace{chain.cpp}::ChainImpl.