diff --git a/src/interfaces/node.h b/src/interfaces/node.h --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -19,6 +19,8 @@ #include #include +class CCoinControl; +class CFeeRate; struct CNodeStateStats; struct CNodeStats; class Config; @@ -149,9 +151,19 @@ //! Get network active. virtual bool getNetworkActive() = 0; + //! Get minimum fee. + virtual Amount getMinimumFee(unsigned int tx_bytes, + const CCoinControl &coin_control) = 0; + //! Get max tx fee. virtual Amount getMaxTxFee() = 0; + //! Get dust relay fee. + virtual CFeeRate getDustRelayFee() = 0; + + //! Get pay tx fee. + virtual CFeeRate getPayTxFee() = 0; + //! Execute rpc command. virtual UniValue executeRpc(Config &config, const std::string &command, const UniValue ¶ms, diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp --- a/src/interfaces/node.cpp +++ b/src/interfaces/node.cpp @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include #include #include @@ -30,6 +32,7 @@ #include #endif #ifdef ENABLE_WALLET +#include #include #define CHECK_WALLET(x) x #else @@ -208,7 +211,16 @@ bool getNetworkActive() override { return g_connman && g_connman->GetNetworkActive(); } + Amount getMinimumFee(unsigned int tx_bytes, + const CCoinControl &coin_control) override { + Amount result; + CHECK_WALLET(result = + GetMinimumFee(tx_bytes, g_mempool, coin_control)); + return result; + } Amount getMaxTxFee() override { return ::maxTxFee; } + CFeeRate getDustRelayFee() override { return ::dustRelayFee; } + CFeeRate getPayTxFee() override { CHECK_WALLET(return ::payTxFee); } UniValue executeRpc(Config &config, const std::string &command, const UniValue ¶ms, const std::string &uri) override { diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -6,6 +6,7 @@ #define BITCOIN_INTERFACES_WALLET_H #include // For Amount +#include // For CTxOut #include