5 #ifndef BITCOIN_INTERFACES_CHAIN_H 6 #define BITCOIN_INTERFACES_CHAIN_H 58 m_max_time = &max_time;
62 m_mtp_time = &mtp_time;
73 int *m_height =
nullptr;
74 int64_t *m_time =
nullptr;
75 int64_t *m_max_time =
nullptr;
76 int64_t *m_mtp_time =
nullptr;
112 virtual std::optional<int> getHeight() = 0;
117 virtual std::optional<int> getBlockHeight(
const BlockHash &hash) = 0;
120 virtual BlockHash getBlockHash(
int height) = 0;
124 virtual bool haveBlockOnDisk(
int height) = 0;
132 virtual std::optional<int>
133 findFirstBlockWithTimeAndHeight(int64_t time,
int height,
142 virtual std::optional<int>
147 contextualCheckTransactionForCurrentBlock(
const CTransaction &tx,
152 virtual bool findBlock(
const BlockHash &hash,
160 findFirstBlockWithTimeAndHeight(int64_t min_time,
int min_height,
166 virtual bool findNextBlock(
const BlockHash &block_hash,
int block_height,
168 bool *reorg =
nullptr) = 0;
172 virtual bool findAncestorByHeight(
const BlockHash &block_hash,
178 virtual bool findAncestorByHash(
const BlockHash &block_hash,
184 virtual bool findCommonAncestor(
const BlockHash &block_hash1,
193 virtual void findCoins(std::map<COutPoint, Coin> &coins) = 0;
197 virtual double guessVerificationProgress(
const BlockHash &block_hash) = 0;
202 virtual bool hasBlocks(
const BlockHash &block_hash,
int min_height = 0,
203 std::optional<int> max_height = {}) = 0;
206 virtual bool hasDescendantsInMempool(
const TxId &txid) = 0;
212 virtual bool broadcastTransaction(
const Config &config,
214 const Amount &max_tx_fee,
bool relay,
215 std::string &err_string) = 0;
219 virtual void getTransactionAncestry(
const TxId &txid,
size_t &ancestors,
220 size_t &descendants) = 0;
225 virtual void getPackageLimits(
size_t &limit_ancestor_count,
226 size_t &limit_descendant_count) = 0;
232 virtual CFeeRate estimateFee()
const = 0;
239 virtual CFeeRate relayDustFee() = 0;
242 virtual bool havePruned() = 0;
245 virtual bool isReadyToBroadcast() = 0;
248 virtual bool isInitialBlockDownload() = 0;
251 virtual bool shutdownRequested() = 0;
254 virtual int64_t getAdjustedTime() = 0;
257 virtual void initMessage(
const std::string &message) = 0;
266 virtual void showProgress(
const std::string &title,
int progress,
267 bool resume_possible) = 0;
283 virtual std::unique_ptr<Handler>
284 handleNotifications(std::shared_ptr<Notifications> notifications) = 0;
288 virtual void waitForNotificationsIfTipChanged(
const BlockHash &old_tip) = 0;
292 virtual std::unique_ptr<Handler> handleRpc(
const CRPCCommand &command) = 0;
295 virtual bool rpcEnableDeprecated(
const std::string &method) = 0;
299 virtual void rpcRunLater(
const std::string &
name, std::function<
void()> fn,
300 int64_t seconds) = 0;
303 virtual int rpcSerializationFlags() = 0;
313 virtual void requestMempoolTransactions(
Notifications ¬ifications) = 0;
326 virtual void registerRpcs() = 0;
329 virtual bool verify(
const CChainParams &chainParams) = 0;
335 virtual void start(
CScheduler &scheduler) = 0;
338 virtual void flush() = 0;
341 virtual void stop() = 0;
344 virtual void setMockTime(int64_t time) = 0;
347 virtual std::vector<std::unique_ptr<Wallet>> getWallets() = 0;
361 std::unique_ptr<ChainClient>
363 std::vector<std::string> wallet_filenames);
367 #endif // BITCOIN_INTERFACES_CHAIN_H std::shared_ptr< const CTransaction > CTransactionRef
Helper for findBlock to selectively return pieces of block data.
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
virtual void updatedBlockTip()
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
FoundBlock & hash(BlockHash &hash)
virtual void transactionAddedToMempool(const CTransactionRef &tx)
FoundBlock & data(CBlock &data)
Read block data from disk.
virtual void blockDisconnected(const CBlock &block, int height)
virtual void blockConnected(const CBlock &block, int height)
NodeContext struct containing references to chain state and connection state.
FoundBlock & maxTime(int64_t &max_time)
virtual void transactionRemovedFromMempool(const CTransactionRef &ptx)
A BlockHash is a unqiue identifier for a block.
Interface to let node manage chain clients (wallets, or maybe tools for monitoring and analysis in th...
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
const CChainParams & Params()
Return the currently selected parameters.
A TxId is the identifier of a transaction.
virtual void chainStateFlushed(const CBlockLocator &locator)
static UniValue stop(const Config &config, const JSONRPCRequest &jsonRequest)
Fee rate in satoshis per kilobyte: Amount / kB.
FoundBlock & height(int &height)
The basic transaction that is broadcasted on the network and contained in blocks. ...
FoundBlock & mtpTime(int64_t &mtp_time)
std::unique_ptr< ChainClient > MakeWalletClient(Chain &chain, ArgsManager &args, std::vector< std::string > wallet_filenames)
Return implementation of ChainClient interface for a wallet client.
FoundBlock & time(int64_t &time)
std::unique_ptr< Chain > MakeChain(NodeContext &node, const CChainParams ¶ms)
Return implementation of Chain interface.