diff options
| author | Patrick Lodder <[email protected]> | 2021-08-16 23:00:43 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-08-16 23:00:43 +0200 |
| commit | 9de15dd687243d2b0c11228209e40c63282591c2 (patch) | |
| tree | bf1977b415cc973a80cbc0191163a1455706e2b2 /src/wallet/wallet.cpp | |
| parent | Merge pull request #2456 from rnicoll/1.14.4-intellij (diff) | |
| parent | qa: fix bumpfee now that paytxfee works (diff) | |
| download | discoin-9de15dd687243d2b0c11228209e40c63282591c2.tar.xz discoin-9de15dd687243d2b0c11228209e40c63282591c2.zip | |
Merge pull request #2446 from patricklodder/1.14.4-mintxfee-tests
Implements, tests and assures wallet operator ease-of-sovereignty and making
sure that user-defined fee logic persists through versions in the future by
fixing and testing -paytxfee
1. There was an override of ANY user-defined value to CWallet::GetMinimumFee
- Former logic: always override any value with either -mintxfee or
-mintxrelayfee, whichever is highest
- Proposed logic in this pull request:
- if the user specifies a value, only override when it is lower than
-mintxfee or -mintxrelayfee - this works because we set any default
-mintxfee to be the same as -paytxfee, unless the user explicitly
sets a -mintxfee.
- if no value has been specified, use the rate from -mintxfee or
-mintxrelayfee, whichever is highest
2. Test that the interaction between the wallet parameters -paytxfee and
-mintxfee function as intended. This has to be done using rpc tests rather
than unit tests because it tests the actual parameters passed to the
executables.
3. Undoing the override exposed a misconfiguration in the bumpfee.py test,
where fees were explicitly set higher, yet ignored in subsequent bumps.
Diffstat (limited to 'src/wallet/wallet.cpp')
| -rw-r--r-- | src/wallet/wallet.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 9ad4fb7f0..fa8526686 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2865,19 +2865,24 @@ CAmount CWallet::GetMinimumFee(const CMutableTransaction& tx, unsigned int nTxBy CAmount nFeeNeeded = targetFee; // User didn't set: use -txconfirmtarget to estimate... if (nFeeNeeded == 0) { - int estimateFoundTarget = nConfirmTarget; - nFeeNeeded = pool.estimateSmartFee(nConfirmTarget, &estimateFoundTarget).GetFee(nTxBytes); - // ... unless we don't have enough mempool data for estimatefee, then use fallbackFee - if (nFeeNeeded == 0) - nFeeNeeded = fallbackFee.GetFee(nTxBytes); + //int estimateFoundTarget = nConfirmTarget; + //nFeeNeeded = pool.estimateSmartFee(nConfirmTarget, &estimateFoundTarget).GetFee(nTxBytes); + //// ... unless we don't have enough mempool data for estimatefee, then use fallbackFee + //if (nFeeNeeded == 0) + // nFeeNeeded = fallbackFee.GetFee(nTxBytes); + + // Dogecoin: Drop the smart fee estimate, use GetRequiredFee + nFeeNeeded = GetRequiredFee(tx, nTxBytes); } // prevent user from paying a fee below minRelayTxFee or minTxFee - // Dogecoin: Drop the smart fee estimate, use GetRequiredFee - // nFeeNeeded = std::max(nFeeNeeded, GetRequiredFee(tx, nTxBytes)); - nFeeNeeded = GetRequiredFee(tx, nTxBytes); + // Dogecoin: as we're adapting minTxFee to never be higher than + // payTxFee unless explicitly set, this should be fine + nFeeNeeded = std::max(nFeeNeeded, GetRequiredFee(tx, nTxBytes)); + // But always obey the maximum if (nFeeNeeded > maxTxFee) nFeeNeeded = maxTxFee; + return nFeeNeeded; } |