mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Lower tx fees 10x (#1632)
* Lower tx fees 10x * add DEFAULT_DIP0001_*FEE constants
This commit is contained in:
parent
825b3ccc97
commit
8f850c60fa
@ -9,6 +9,7 @@
|
||||
#include "masternode-payments.h"
|
||||
#include "masternode-sync.h"
|
||||
#include "privatesend-client.h"
|
||||
#include "txmempool.h"
|
||||
|
||||
void CDSNotificationInterface::InitializeCurrentBlockTip()
|
||||
{
|
||||
@ -39,9 +40,21 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
|
||||
|
||||
// DIP0001 updates
|
||||
|
||||
bool fDIP0001ActiveAtTipTmp = fDIP0001ActiveAtTip;
|
||||
// Update global flags
|
||||
fDIP0001LockedInAtTip = (VersionBitsState(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_LOCKED_IN);
|
||||
fDIP0001ActiveAtTip = (VersionBitsState(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_ACTIVE);
|
||||
|
||||
// Update min fees only if activation changed and we are using default minRelayTxFee
|
||||
if (fDIP0001ActiveAtTipTmp != fDIP0001ActiveAtTip) {
|
||||
if (!mapArgs.count("-minrelaytxfee")) {
|
||||
::minRelayTxFee = CFeeRate(fDIP0001ActiveAtTip ? DEFAULT_DIP0001_MIN_RELAY_TX_FEE : DEFAULT_LEGACY_MIN_RELAY_TX_FEE);
|
||||
mempool.UpdateMinFee(::minRelayTxFee);
|
||||
}
|
||||
if (!mapArgs.count("-mintxfee")) {
|
||||
CWallet::minTxFee = CFeeRate(fDIP0001ActiveAtTip ? DEFAULT_DIP0001_TRANSACTION_MINFEE : DEFAULT_LEGACY_TRANSACTION_MINFEE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlock *pblock)
|
||||
|
@ -478,7 +478,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-fallbackfee=<amt>", strprintf(_("A fee rate (in %s/kB) that will be used when fee estimation has insufficient data (default: %s)"),
|
||||
CURRENCY_UNIT, FormatMoney(DEFAULT_FALLBACK_FEE)));
|
||||
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for transaction creation (default: %s)"),
|
||||
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MINFEE)));
|
||||
CURRENCY_UNIT, FormatMoney(DEFAULT_LEGACY_TRANSACTION_MINFEE)));
|
||||
strUsage += HelpMessageOpt("-paytxfee=<amt>", strprintf(_("Fee (in %s/kB) to add to transactions you send (default: %s)"),
|
||||
CURRENCY_UNIT, FormatMoney(payTxFee.GetFeePerK())));
|
||||
strUsage += HelpMessageOpt("-rescan", _("Rescan the block chain for missing wallet transactions on startup"));
|
||||
@ -567,7 +567,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf("Limit size of signature cache to <n> MiB (default: %u)", DEFAULT_MAX_SIG_CACHE_SIZE));
|
||||
}
|
||||
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)"),
|
||||
CURRENCY_UNIT, FormatMoney(DEFAULT_MIN_RELAY_TX_FEE)));
|
||||
CURRENCY_UNIT, FormatMoney(DEFAULT_LEGACY_MIN_RELAY_TX_FEE)));
|
||||
strUsage += HelpMessageOpt("-printtoconsole", _("Send trace/debug info to console instead of debug.log file"));
|
||||
strUsage += HelpMessageOpt("-printtodebuglog", strprintf(_("Send trace/debug info to debug.log file (default: %u)"), 1));
|
||||
if (showDebug)
|
||||
|
@ -970,7 +970,7 @@ bool CTxLockRequest::IsValid() const
|
||||
|
||||
CAmount CTxLockRequest::GetMinFee() const
|
||||
{
|
||||
CAmount nMinFee = MIN_FEE;
|
||||
CAmount nMinFee = fDIP0001ActiveAtTip ? MIN_FEE / 10 : MIN_FEE;
|
||||
return std::max(nMinFee, CAmount(vin.size() * nMinFee));
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
|
||||
// not dust:
|
||||
t.vout[0].nValue = 6735;
|
||||
BOOST_CHECK(IsStandardTx(t, reason));
|
||||
minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
||||
minRelayTxFee = CFeeRate(DEFAULT_LEGACY_MIN_RELAY_TX_FEE);
|
||||
|
||||
t.vout[0].scriptPubKey = CScript() << OP_1;
|
||||
BOOST_CHECK(!IsStandardTx(t, reason));
|
||||
|
@ -1097,6 +1097,14 @@ CFeeRate CTxMemPool::GetMinFee(size_t sizelimit) const {
|
||||
return std::max(CFeeRate(rollingMinimumFeeRate), minReasonableRelayFee);
|
||||
}
|
||||
|
||||
void CTxMemPool::UpdateMinFee(const CFeeRate& _minReasonableRelayFee)
|
||||
{
|
||||
LOCK(cs);
|
||||
delete minerPolicyEstimator;
|
||||
minerPolicyEstimator = new CBlockPolicyEstimator(_minReasonableRelayFee);
|
||||
minReasonableRelayFee = _minReasonableRelayFee;
|
||||
}
|
||||
|
||||
void CTxMemPool::trackPackageRemoved(const CFeeRate& rate) {
|
||||
AssertLockHeld(cs);
|
||||
if (rate.GetFeePerK() > rollingMinimumFeeRate) {
|
||||
|
@ -537,6 +537,7 @@ public:
|
||||
* would otherwise be half of this, it is set to 0 instead.
|
||||
*/
|
||||
CFeeRate GetMinFee(size_t sizelimit) const;
|
||||
void UpdateMinFee(const CFeeRate& _minReasonableRelayFee);
|
||||
|
||||
/** Remove transactions from the mempool until its dynamic size is <= sizelimit.
|
||||
* pvNoSpendsRemaining, if set, will be populated with the list of transactions
|
||||
|
@ -91,7 +91,7 @@ std::atomic<bool> fDIP0001ActiveAtTip{false};
|
||||
uint256 hashAssumeValid;
|
||||
|
||||
/** Fees smaller than this (in duffs) are considered zero fee (for relaying, mining and transaction creation) */
|
||||
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
||||
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_LEGACY_MIN_RELAY_TX_FEE);
|
||||
|
||||
CTxMemPool mempool(::minRelayTxFee);
|
||||
map<uint256, int64_t> mapRejectedBlocks GUARDED_BY(cs_main);
|
||||
|
@ -56,8 +56,10 @@ static const bool DEFAULT_WHITELISTFORCERELAY = true;
|
||||
/** Default for -minrelaytxfee, minimum relay fee for transactions
|
||||
* We are ~100 times smaller then bitcoin now (2016-03-01), set minRelayTxFee only 10 times higher
|
||||
* so it's still 10 times lower comparing to bitcoin.
|
||||
* 2017-07: we are 10x smaller now, let's lower defaults 10x via the same BIP9 bit as DIP0001
|
||||
*/
|
||||
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 10000; // was 1000
|
||||
static const unsigned int DEFAULT_LEGACY_MIN_RELAY_TX_FEE = 10000; // was 1000
|
||||
static const unsigned int DEFAULT_DIP0001_MIN_RELAY_TX_FEE = 1000;
|
||||
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
|
||||
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
|
||||
/** Default for -limitancestorcount, max number of in-mempool ancestors */
|
||||
|
@ -52,7 +52,7 @@ bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS;
|
||||
* Fees smaller than this (in duffs) are considered zero fee (for transaction creation)
|
||||
* Override with -mintxfee
|
||||
*/
|
||||
CFeeRate CWallet::minTxFee = CFeeRate(DEFAULT_TRANSACTION_MINFEE);
|
||||
CFeeRate CWallet::minTxFee = CFeeRate(DEFAULT_LEGACY_TRANSACTION_MINFEE);
|
||||
/**
|
||||
* If fee estimation does not have enough data to provide estimates, use this fee instead.
|
||||
* Has no effect if not using fee estimation
|
||||
|
@ -53,8 +53,10 @@ static const CAmount DEFAULT_FALLBACK_FEE = 20000;
|
||||
/**
|
||||
* We are ~100 times smaller then bitcoin now (2016-03-01), set minTxFee 10 times higher
|
||||
* so it's still 10 times lower comparing to bitcoin.
|
||||
* 2017-07: we are 10x smaller now, let's lower defaults 10x via the same BIP9 bit as DIP0001
|
||||
*/
|
||||
static const CAmount DEFAULT_TRANSACTION_MINFEE = 10000; // was 1000
|
||||
static const CAmount DEFAULT_LEGACY_TRANSACTION_MINFEE = 10000; // was 1000
|
||||
static const CAmount DEFAULT_DIP0001_TRANSACTION_MINFEE = 1000;
|
||||
//! -maxtxfee default
|
||||
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.2 * COIN; // "smallest denom" + X * "denom tails"
|
||||
//! minimum change amount
|
||||
|
Loading…
Reference in New Issue
Block a user