|
6 | 6 | #define BITCOIN_INTERFACES_CHAIN_H
|
7 | 7 |
|
8 | 8 | #include <optional.h> // For Optional and nullopt
|
9 |
| -#include <policy/rbf.h> // For RBFTransactionState |
10 | 9 | #include <primitives/transaction.h> // For CTransactionRef
|
11 | 10 |
|
12 | 11 | #include <memory>
|
|
16 | 15 | #include <vector>
|
17 | 16 |
|
18 | 17 | class CBlock;
|
| 18 | +class CFeeRate; |
19 | 19 | class CScheduler;
|
20 | 20 | class CValidationState;
|
21 | 21 | class uint256;
|
| 22 | +enum class RBFTransactionState; |
22 | 23 | struct CBlockLocator;
|
23 | 24 | struct FeeCalculation;
|
24 | 25 |
|
25 | 26 | namespace interfaces {
|
26 | 27 |
|
27 | 28 | class Wallet;
|
28 | 29 |
|
29 |
| -//! Interface for giving wallet processes access to blockchain state. |
| 30 | +//! Interface giving clients (wallet processes, maybe other analysis tools in |
| 31 | +//! the future) ability to access to the chain state, receive notifications, |
| 32 | +//! estimate fees, and submit transactions. |
| 33 | +//! |
| 34 | +//! TODO: Current chain methods are too low level, exposing too much of the |
| 35 | +//! internal workings of the bitcoin node, and not being very convenient to use. |
| 36 | +//! Chain methods should be cleaned up and simplified over time. Examples: |
| 37 | +//! |
| 38 | +//! * The Chain::lock() method, which lets clients delay chain tip updates |
| 39 | +//! should be removed when clients are able to respond to updates |
| 40 | +//! asynchronously |
| 41 | +//! (https://github.com/bitcoin/bitcoin/pull/10973#issuecomment-380101269). |
| 42 | +//! |
| 43 | +//! * The relayTransactions() and submitToMemoryPool() methods could be replaced |
| 44 | +//! with a higher-level broadcastTransaction method |
| 45 | +//! (https://github.com/bitcoin/bitcoin/pull/14978#issuecomment-459373984). |
| 46 | +//! |
| 47 | +//! * The initMessages() and loadWallet() methods which the wallet uses to send |
| 48 | +//! notifications to the GUI should go away when GUI and wallet can directly |
| 49 | +//! communicate with each other without going through the node |
| 50 | +//! (https://github.com/bitcoin/bitcoin/pull/15288#discussion_r253321096). |
30 | 51 | class Chain
|
31 | 52 | {
|
32 | 53 | public:
|
@@ -114,8 +135,9 @@ class Chain
|
114 | 135 | virtual bool checkFinalTx(const CTransaction& tx) = 0;
|
115 | 136 |
|
116 | 137 | //! Add transaction to memory pool if the transaction fee is below the
|
117 |
| - //! amount specified by absurd_fee (as a safeguard). */ |
118 |
| - virtual bool submitToMemoryPool(CTransactionRef tx, CAmount absurd_fee, CValidationState& state) = 0; |
| 138 | + //! amount specified by absurd_fee. Returns false if the transaction |
| 139 | + //! could not be added due to the fee or for another reason. |
| 140 | + virtual bool submitToMemoryPool(const CTransactionRef& tx, CAmount absurd_fee, CValidationState& state) = 0; |
119 | 141 | };
|
120 | 142 |
|
121 | 143 | //! Return Lock interface. Chain is locked when this is called, and
|
@@ -154,19 +176,19 @@ class Chain
|
154 | 176 | //! Calculate mempool ancestor and descendant counts for the given transaction.
|
155 | 177 | virtual void getTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) = 0;
|
156 | 178 |
|
157 |
| - //! Check chain limits. |
158 |
| - virtual bool checkChainLimits(CTransactionRef tx) = 0; |
| 179 | + //! Check if transaction will pass the mempool's chain limits. |
| 180 | + virtual bool checkChainLimits(const CTransactionRef& tx) = 0; |
159 | 181 |
|
160 | 182 | //! Estimate smart fee.
|
161 | 183 | virtual CFeeRate estimateSmartFee(int num_blocks, bool conservative, FeeCalculation* calc = nullptr) = 0;
|
162 | 184 |
|
163 | 185 | //! Fee estimator max target.
|
164 | 186 | virtual unsigned int estimateMaxBlocks() = 0;
|
165 | 187 |
|
166 |
| - //! Pool min fee. |
| 188 | + //! Mempool minimum fee. |
167 | 189 | virtual CFeeRate mempoolMinFee() = 0;
|
168 | 190 |
|
169 |
| - //! Get node max tx fee setting (-maxtxfee). |
| 191 | + //! Node max tx fee setting (-maxtxfee). |
170 | 192 | //! This could be replaced by a per-wallet max fee, as proposed at
|
171 | 193 | //! https://github.com/bitcoin/bitcoin/issues/15355
|
172 | 194 | //! But for the time being, wallets call this to access the node setting.
|
|
0 commit comments