diff options
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/node.cpp | 14 | ||||
-rw-r--r-- | src/interfaces/node.h | 14 | ||||
-rw-r--r-- | src/interfaces/wallet.cpp | 17 | ||||
-rw-r--r-- | src/interfaces/wallet.h | 14 |
4 files changed, 31 insertions, 28 deletions
diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp index e55cba3c65..55786c807f 100644 --- a/src/interfaces/node.cpp +++ b/src/interfaces/node.cpp @@ -191,20 +191,6 @@ class NodeImpl : public Node } } bool getNetworkActive() override { return g_connman && g_connman->GetNetworkActive(); } - unsigned int getTxConfirmTarget() override { CHECK_WALLET(return ::nTxConfirmTarget); } - CAmount getRequiredFee(unsigned int tx_bytes) override { CHECK_WALLET(return GetRequiredFee(tx_bytes)); } - CAmount getMinimumFee(unsigned int tx_bytes, - const CCoinControl& coin_control, - int* returned_target, - FeeReason* reason) override - { - FeeCalculation fee_calc; - CAmount result; - CHECK_WALLET(result = GetMinimumFee(tx_bytes, coin_control, ::mempool, ::feeEstimator, &fee_calc)); - if (returned_target) *returned_target = fee_calc.returnedTarget; - if (reason) *reason = fee_calc.reason; - return result; - } CAmount getMaxTxFee() override { return ::maxTxFee; } CFeeRate estimateSmartFee(int num_blocks, bool conservative, int* returned_target = nullptr) override { diff --git a/src/interfaces/node.h b/src/interfaces/node.h index 84e869100a..3cebe53eb0 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -26,11 +26,9 @@ class Coin; class RPCTimerInterface; class UniValue; class proxyType; -enum class FeeReason; struct CNodeStateStats; namespace interfaces { - class Handler; class Wallet; @@ -152,18 +150,6 @@ public: //! Get network active. virtual bool getNetworkActive() = 0; - //! Get tx confirm target. - virtual unsigned int getTxConfirmTarget() = 0; - - //! Get required fee. - virtual CAmount getRequiredFee(unsigned int tx_bytes) = 0; - - //! Get minimum fee. - virtual CAmount getMinimumFee(unsigned int tx_bytes, - const CCoinControl& coin_control, - int* returned_target, - FeeReason* reason) = 0; - //! Get max tx fee. virtual CAmount getMaxTxFee() = 0; diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 3e6f0d6728..f4dfdae8ae 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -9,6 +9,8 @@ #include <consensus/validation.h> #include <interfaces/handler.h> #include <net.h> +#include <policy/feerate.h> +#include <policy/fees.h> #include <policy/policy.h> #include <primitives/transaction.h> #include <script/ismine.h> @@ -20,6 +22,7 @@ #include <uint256.h> #include <validation.h> #include <wallet/feebumper.h> +#include <wallet/fees.h> #include <wallet/wallet.h> namespace interfaces { @@ -403,6 +406,20 @@ public: } return result; } + CAmount getRequiredFee(unsigned int tx_bytes) override { return GetRequiredFee(m_wallet, tx_bytes); } + CAmount getMinimumFee(unsigned int tx_bytes, + const CCoinControl& coin_control, + int* returned_target, + FeeReason* reason) override + { + FeeCalculation fee_calc; + CAmount result; + result = GetMinimumFee(m_wallet, tx_bytes, coin_control, ::mempool, ::feeEstimator, &fee_calc); + if (returned_target) *returned_target = fee_calc.returnedTarget; + if (reason) *reason = fee_calc.reason; + return result; + } + unsigned int getConfirmTarget() override { return m_wallet.m_confirm_target; } bool hdEnabled() override { return m_wallet.IsHDEnabled(); } OutputType getDefaultAddressType() override { return m_wallet.m_default_address_type; } OutputType getDefaultChangeType() override { return m_wallet.m_default_change_type; } diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 9d4830d189..2a03f6c60a 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -22,8 +22,10 @@ #include <vector> class CCoinControl; +class CFeeRate; class CKey; class CWallet; +enum class FeeReason; enum class OutputType; struct CRecipient; @@ -218,6 +220,18 @@ public: //! Return wallet transaction output information. virtual std::vector<WalletTxOut> getCoins(const std::vector<COutPoint>& outputs) = 0; + //! Get required fee. + virtual CAmount getRequiredFee(unsigned int tx_bytes) = 0; + + //! Get minimum fee. + virtual CAmount getMinimumFee(unsigned int tx_bytes, + const CCoinControl& coin_control, + int* returned_target, + FeeReason* reason) = 0; + + //! Get tx confirm target. + virtual unsigned int getConfirmTarget() = 0; + // Return whether HD enabled. virtual bool hdEnabled() = 0; |