mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Disable wallet fallbackfee by default on mainnet
This commit is contained in:
parent
67447ba060
commit
8222e057fe
@ -175,6 +175,9 @@ public:
|
|||||||
// (the tx=... number in the SetBestChain debug.log lines)
|
// (the tx=... number in the SetBestChain debug.log lines)
|
||||||
3.5 // * estimated number of transactions per second after that timestamp
|
3.5 // * estimated number of transactions per second after that timestamp
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* disable fallback fee on mainnet */
|
||||||
|
m_fallback_fee_enabled = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -266,6 +269,8 @@ public:
|
|||||||
0.09
|
0.09
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* enable fallback fee on testnet */
|
||||||
|
m_fallback_fee_enabled = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -343,6 +348,9 @@ public:
|
|||||||
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
|
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
|
||||||
|
|
||||||
bech32_hrp = "bcrt";
|
bech32_hrp = "bcrt";
|
||||||
|
|
||||||
|
/* enable fallback fee on regtest */
|
||||||
|
m_fallback_fee_enabled = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ public:
|
|||||||
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
|
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
|
||||||
/** Return the BIP70 network string (main, test or regtest) */
|
/** Return the BIP70 network string (main, test or regtest) */
|
||||||
std::string NetworkIDString() const { return strNetworkID; }
|
std::string NetworkIDString() const { return strNetworkID; }
|
||||||
|
/** Return true if the fallback fee is by default enabled for this network */
|
||||||
|
bool IsFallbackFeeEnabled() const { return m_fallback_fee_enabled; }
|
||||||
/** Return the list of hostnames to look up for DNS seeds */
|
/** Return the list of hostnames to look up for DNS seeds */
|
||||||
const std::vector<std::string>& DNSSeeds() const { return vSeeds; }
|
const std::vector<std::string>& DNSSeeds() const { return vSeeds; }
|
||||||
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
|
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
|
||||||
@ -91,6 +93,7 @@ protected:
|
|||||||
bool fMineBlocksOnDemand;
|
bool fMineBlocksOnDemand;
|
||||||
CCheckpointData checkpointData;
|
CCheckpointData checkpointData;
|
||||||
ChainTxData chainTxData;
|
ChainTxData chainTxData;
|
||||||
|
bool m_fallback_fee_enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,6 +158,8 @@ void TestGUI()
|
|||||||
test.CreateAndProcessBlock({}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey()));
|
test.CreateAndProcessBlock({}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey()));
|
||||||
}
|
}
|
||||||
bitdb.MakeMock();
|
bitdb.MakeMock();
|
||||||
|
g_wallet_allow_fallback_fee = true;
|
||||||
|
|
||||||
std::unique_ptr<CWalletDBWrapper> dbw(new CWalletDBWrapper(&bitdb, "wallet_test.dat"));
|
std::unique_ptr<CWalletDBWrapper> dbw(new CWalletDBWrapper(&bitdb, "wallet_test.dat"));
|
||||||
CWallet wallet(std::move(dbw));
|
CWallet wallet(std::move(dbw));
|
||||||
bool firstRun;
|
bool firstRun;
|
||||||
|
@ -53,6 +53,9 @@ CAmount GetMinimumFee(unsigned int nTxBytes, const CCoinControl& coin_control, c
|
|||||||
// if we don't have enough data for estimateSmartFee, then use fallbackFee
|
// if we don't have enough data for estimateSmartFee, then use fallbackFee
|
||||||
fee_needed = CWallet::fallbackFee.GetFee(nTxBytes);
|
fee_needed = CWallet::fallbackFee.GetFee(nTxBytes);
|
||||||
if (feeCalc) feeCalc->reason = FeeReason::FALLBACK;
|
if (feeCalc) feeCalc->reason = FeeReason::FALLBACK;
|
||||||
|
|
||||||
|
// directly return if fallback fee is disabled (feerate 0 == disabled)
|
||||||
|
if (CWallet::fallbackFee.GetFee(1000) == 0) return fee_needed;
|
||||||
}
|
}
|
||||||
// Obey mempool min fee when using smart fee estimation
|
// Obey mempool min fee when using smart fee estimation
|
||||||
CAmount min_mempool_fee = pool.GetMinFee(gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFee(nTxBytes);
|
CAmount min_mempool_fee = pool.GetMinFee(gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFee(nTxBytes);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <wallet/init.h>
|
#include <wallet/init.h>
|
||||||
|
|
||||||
|
#include <chainparams.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
#include <utilmoneystr.h>
|
#include <utilmoneystr.h>
|
||||||
@ -123,6 +124,8 @@ bool WalletParameterInteraction()
|
|||||||
_("This is the minimum transaction fee you pay on every transaction."));
|
_("This is the minimum transaction fee you pay on every transaction."));
|
||||||
CWallet::minTxFee = CFeeRate(n);
|
CWallet::minTxFee = CFeeRate(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_wallet_allow_fallback_fee = Params().IsFallbackFeeEnabled();
|
||||||
if (gArgs.IsArgSet("-fallbackfee"))
|
if (gArgs.IsArgSet("-fallbackfee"))
|
||||||
{
|
{
|
||||||
CAmount nFeePerK = 0;
|
CAmount nFeePerK = 0;
|
||||||
@ -132,6 +135,7 @@ bool WalletParameterInteraction()
|
|||||||
InitWarning(AmountHighWarn("-fallbackfee") + " " +
|
InitWarning(AmountHighWarn("-fallbackfee") + " " +
|
||||||
_("This is the transaction fee you may pay when fee estimates are not available."));
|
_("This is the transaction fee you may pay when fee estimates are not available."));
|
||||||
CWallet::fallbackFee = CFeeRate(nFeePerK);
|
CWallet::fallbackFee = CFeeRate(nFeePerK);
|
||||||
|
g_wallet_allow_fallback_fee = nFeePerK != 0; //disable fallback fee in case value was set to 0, enable if non-null value
|
||||||
}
|
}
|
||||||
if (gArgs.IsArgSet("-discardfee"))
|
if (gArgs.IsArgSet("-discardfee"))
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,7 @@ WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
|
|||||||
TestingSetup(chainName)
|
TestingSetup(chainName)
|
||||||
{
|
{
|
||||||
bitdb.MakeMock();
|
bitdb.MakeMock();
|
||||||
|
g_wallet_allow_fallback_fee = true;
|
||||||
|
|
||||||
bool fFirstRun;
|
bool fFirstRun;
|
||||||
g_address_type = OUTPUT_TYPE_DEFAULT;
|
g_address_type = OUTPUT_TYPE_DEFAULT;
|
||||||
|
@ -44,6 +44,7 @@ bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE;
|
|||||||
bool fWalletRbf = DEFAULT_WALLET_RBF;
|
bool fWalletRbf = DEFAULT_WALLET_RBF;
|
||||||
OutputType g_address_type = OUTPUT_TYPE_NONE;
|
OutputType g_address_type = OUTPUT_TYPE_NONE;
|
||||||
OutputType g_change_type = OUTPUT_TYPE_NONE;
|
OutputType g_change_type = OUTPUT_TYPE_NONE;
|
||||||
|
bool g_wallet_allow_fallback_fee = false; //<! will be defined via chainparams
|
||||||
|
|
||||||
const char * DEFAULT_WALLET_DAT = "wallet.dat";
|
const char * DEFAULT_WALLET_DAT = "wallet.dat";
|
||||||
const uint32_t BIP32_HARDENED_KEY_LIMIT = 0x80000000;
|
const uint32_t BIP32_HARDENED_KEY_LIMIT = 0x80000000;
|
||||||
@ -2922,6 +2923,11 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
|
|||||||
}
|
}
|
||||||
|
|
||||||
nFeeNeeded = GetMinimumFee(nBytes, coin_control, ::mempool, ::feeEstimator, &feeCalc);
|
nFeeNeeded = GetMinimumFee(nBytes, coin_control, ::mempool, ::feeEstimator, &feeCalc);
|
||||||
|
if (feeCalc.reason == FeeReason::FALLBACK && !g_wallet_allow_fallback_fee) {
|
||||||
|
// eventually allow a fallback fee
|
||||||
|
strFailReason = _("Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// If we made it here and we aren't even able to meet the relay fee on the next pass, give up
|
// 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.
|
// because we must be at the maximum allowed fee.
|
||||||
|
@ -39,6 +39,7 @@ extern CFeeRate payTxFee;
|
|||||||
extern unsigned int nTxConfirmTarget;
|
extern unsigned int nTxConfirmTarget;
|
||||||
extern bool bSpendZeroConfChange;
|
extern bool bSpendZeroConfChange;
|
||||||
extern bool fWalletRbf;
|
extern bool fWalletRbf;
|
||||||
|
extern bool g_wallet_allow_fallback_fee;
|
||||||
|
|
||||||
static const unsigned int DEFAULT_KEYPOOL_SIZE = 1000;
|
static const unsigned int DEFAULT_KEYPOOL_SIZE = 1000;
|
||||||
//! -paytxfee default
|
//! -paytxfee default
|
||||||
@ -65,6 +66,7 @@ static const unsigned int DEFAULT_TX_CONFIRM_TARGET = 6;
|
|||||||
static const bool DEFAULT_WALLET_RBF = false;
|
static const bool DEFAULT_WALLET_RBF = false;
|
||||||
static const bool DEFAULT_WALLETBROADCAST = true;
|
static const bool DEFAULT_WALLETBROADCAST = true;
|
||||||
static const bool DEFAULT_DISABLE_WALLET = false;
|
static const bool DEFAULT_DISABLE_WALLET = false;
|
||||||
|
static const bool DEFAULT_WALLET_ALLOW_FALLBACKFEE = true;
|
||||||
|
|
||||||
extern const char * DEFAULT_WALLET_DAT;
|
extern const char * DEFAULT_WALLET_DAT;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user