diff options
| author | Patrick Lodder <[email protected]> | 2021-07-31 20:58:53 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-31 20:58:53 +0200 |
| commit | 7abb81b2ea3bd11e6d01476b2c1739d793006a83 (patch) | |
| tree | 7765fbeda190b3630de9810f4b246a7c1c0c5e75 /src/wallet | |
| parent | Merge pull request #2426 from xanimo/1.14.4-qa (diff) | |
| parent | Initial back end framework to separate wallet and relay fees + dust. (diff) | |
| download | discoin-7abb81b2ea3bd11e6d01476b2c1739d793006a83.tar.xz discoin-7abb81b2ea3bd11e6d01476b2c1739d793006a83.zip | |
Merge pull request #2368 from michilumin/1.14.4-fees
1.14.4 fees backend improvements
Diffstat (limited to 'src/wallet')
| -rw-r--r-- | src/wallet/wallet.cpp | 19 | ||||
| -rw-r--r-- | src/wallet/wallet.h | 7 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 35e534ea0..d9187e383 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -9,6 +9,7 @@ #include "checkpoints.h" #include "chain.h" #include "dogecoin.h" +#include "dogecoin-fees.h" #include "wallet/coincontrol.h" #include "consensus/consensus.h" #include "consensus/validation.h" @@ -38,6 +39,8 @@ using namespace std; CWallet* pwalletMain = NULL; /** Transaction fee set by the user */ CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE); +//mlumin 5/2021: Add minimum wallet tx fee. This really should be expressed as a rate not a final fee. +CFeeRate minWalletTxFeeRate = CFeeRate(DEFAULT_MIN_WALLET_TX_FEE); unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET; bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE; bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS; @@ -2680,7 +2683,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt // If we made it here and we aren't even able to meet the relay fee on the next pass, give up // because we must be at the maximum allowed fee. - if (nFeeNeeded < ::minRelayTxFee.GetFee(nBytes)) + if (nFeeNeeded < ::minRelayTxFeeRate.GetFee(nBytes)) { strFailReason = _("Transaction too large for fee policy"); return false; @@ -2843,12 +2846,12 @@ bool CWallet::AddAccountingEntry(const CAccountingEntry& acentry, CWalletDB *pwa CAmount CWallet::GetRequiredFee(const CMutableTransaction& tx, unsigned int nTxBytes) { // Dogecoin: Add an increased fee for each dust output - return std::max(minTxFee.GetFee(nTxBytes) + GetDogecoinDustFee(tx.vout, minTxFee), ::minRelayTxFee.GetFee(nTxBytes)); + return std::max(minTxFee.GetFee(nTxBytes) + GetDogecoinDustFee(tx.vout, minTxFee), ::minRelayTxFeeRate.GetFee(nTxBytes)); } CAmount CWallet::GetRequiredFee(unsigned int nTxBytes) { - return std::max(minTxFee.GetFee(nTxBytes), ::minRelayTxFee.GetFee(nTxBytes)); + return std::max(minTxFee.GetFee(nTxBytes), ::minRelayTxFeeRate.GetFee(nTxBytes)); } CAmount CWallet::GetMinimumFee(const CMutableTransaction& tx, unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool) @@ -3852,7 +3855,7 @@ bool CWallet::ParameterInteraction() if (GetArg("-prune", 0) && GetBoolArg("-rescan", false)) return InitError(_("Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again.")); - if (::minRelayTxFee.GetFeePerK() > HIGH_TX_FEE_PER_KB) + if (::minRelayTxFeeRate.GetFeePerK() > HIGH_TX_FEE_PER_KB) InitWarning(AmountHighWarn("-minrelaytxfee") + " " + _("The wallet will avoid paying less than the minimum relay fee.")); @@ -3886,10 +3889,10 @@ bool CWallet::ParameterInteraction() _("This is the transaction fee you will pay if you send a transaction.")); payTxFee = CFeeRate(nFeePerK, 1000); - if (payTxFee < ::minRelayTxFee) + if (payTxFee < ::minRelayTxFeeRate) { return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"), - GetArg("-paytxfee", ""), ::minRelayTxFee.ToString())); + GetArg("-paytxfee", ""), ::minRelayTxFeeRate.ToString())); } } if (IsArgSet("-maxtxfee")) @@ -3900,10 +3903,10 @@ bool CWallet::ParameterInteraction() if (nMaxFee > HIGH_MAX_TX_FEE) InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction.")); maxTxFee = nMaxFee; - if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee) + if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFeeRate) { return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"), - GetArg("-maxtxfee", ""), ::minRelayTxFee.ToString())); + GetArg("-maxtxfee", ""), ::minRelayTxFeeRate.ToString())); } } nTxConfirmTarget = GetArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index e1a9be1c2..329923aa3 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -38,6 +38,8 @@ extern CWallet* pwalletMain; * Settings */ extern CFeeRate payTxFee; +//mlumin 5/2021: add minWalletTxFee to separate out wallet and relay. +extern CFeeRate minWalletTxFeeRate; extern unsigned int nTxConfirmTarget; extern bool bSpendZeroConfChange; extern bool fSendFreeTransactions; @@ -45,11 +47,14 @@ extern bool fWalletRbf; static const unsigned int DEFAULT_KEYPOOL_SIZE = 100; //! -paytxfee default -static const CAmount DEFAULT_TRANSACTION_FEE = 0; +static const CAmount DEFAULT_TRANSACTION_FEE = COIN; //! -fallbackfee default +//mlumin: 5/2021 scaled minimum, this likely will have to change for fee reduction static const CAmount DEFAULT_FALLBACK_FEE = COIN; //! -mintxfee default static const CAmount DEFAULT_TRANSACTION_MINFEE = COIN; +//mlumin 5/2021: adding a minimum Wallet fee vs relay, currently still 1 COIN, to be reduced. +static const unsigned int DEFAULT_MIN_WALLET_TX_FEE = COIN; //! minimum recommended increment for BIP 125 replacement txs static const CAmount WALLET_INCREMENTAL_RELAY_FEE = COIN * 5; //! target minimum change amount |