aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ Ross Nicoll <[email protected]>2015-09-03 21:34:03 +0100
committerJ Ross Nicoll <[email protected]>2015-09-06 11:37:03 +0100
commitce196a9bfc2007b4ce79a1ec874c18fdda453caa (patch)
tree1e369abc14f87d54cc3213699f092ce01336c747 /src
parentMerge pull request #1277 from patricklodder/1.10-fix-travis-extra-compiler (diff)
downloaddiscoin-ce196a9bfc2007b4ce79a1ec874c18fdda453caa.tar.xz
discoin-ce196a9bfc2007b4ce79a1ec874c18fdda453caa.zip
Match fee calculation to legacy code
Purge all support for zero-fee transactions Disable IsDust() for backwards compatibility
Diffstat (limited to 'src')
-rw-r--r--src/dogecoin.cpp5
-rw-r--r--src/init.cpp11
-rw-r--r--src/main.cpp5
-rw-r--r--src/main.h2
-rw-r--r--src/primitives/transaction.h11
-rw-r--r--src/qt/coincontroldialog.cpp22
-rw-r--r--src/test/transaction_tests.cpp5
-rw-r--r--src/wallet/wallet.cpp10
-rw-r--r--src/wallet/wallet.h6
9 files changed, 46 insertions, 31 deletions
diff --git a/src/dogecoin.cpp b/src/dogecoin.cpp
index 0321a6527..83e9b8b02 100644
--- a/src/dogecoin.cpp
+++ b/src/dogecoin.cpp
@@ -150,9 +150,10 @@ CAmount GetDogecoinBlockSubsidy(int nHeight, const Consensus::Params& consensusP
int64_t GetDogecoinDustFee(const std::vector<CTxOut> &vout, CFeeRate &baseFeeRate) {
int64_t nFee = 0;
- // To limit dust spam, add base fee for each output less than DUST_SOFT_LIMIT
+ // To limit dust spam, add base fee for each dust output
BOOST_FOREACH(const CTxOut& txout, vout)
- if (txout.IsDust(::minRelayTxFee))
+ // if (txout.IsDust(::minRelayTxFee))
+ if (txout.nValue < COIN)
nFee += baseFeeRate.GetFeePerK();
return nFee;
diff --git a/src/init.cpp b/src/init.cpp
index b8ef781a8..e770df012 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -346,7 +346,9 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-salvagewallet", _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup"));
strUsage += HelpMessageOpt("-sendfreetransactions", strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), 0));
strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), 1));
- strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET));
+ // Dogecoin: Disable TX confirm target as the dust prevention fees make
+ // the fee estimation code produce bizarre results.
+ // strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET));
strUsage += HelpMessageOpt("-maxtxfee=<amt>", strprintf(_("Maximum total fees to use in a single wallet transaction; setting this too low may abort large transactions (default: %s)"),
FormatMoney(maxTxFee)));
strUsage += HelpMessageOpt("-upgradewallet", _("Upgrade wallet to latest format") + " " + _("on startup"));
@@ -355,7 +357,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-walletnotify=<cmd>", _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)"));
strUsage += HelpMessageOpt("-zapwallettxes=<mode>", _("Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup") +
" " + _("(1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)"));
-
+
#endif
strUsage += HelpMessageGroup(_("Debugging/Testing options:"));
@@ -869,7 +871,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
mapArgs["-maxtxfee"], ::minRelayTxFee.ToString()));
}
}
- nTxConfirmTarget = GetArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET);
+
+ // Dogecoin: Disable txconfirmtarget
+ // nTxConfirmTarget = GetArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET);
+ nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;
bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", true);
fSendFreeTransactions = GetBoolArg("-sendfreetransactions", false);
diff --git a/src/main.cpp b/src/main.cpp
index 8e52b5a8e..6c82434c8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -872,8 +872,7 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF
CAmount nMinFee = ::minRelayTxFee.GetFee(nBytes);
nMinFee += GetDogecoinDustFee(tx.vout, ::minRelayTxFee);
- // Dogecoin: Disable free transactions
- /* if (fAllowFree)
+ if (fAllowFree)
{
// There is a free transaction area in blocks created by most miners,
// * If we are relaying we allow transactions up to DEFAULT_BLOCK_PRIORITY_SIZE - 1000
@@ -881,7 +880,7 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF
// multiple transactions instead of one big transaction to avoid fees.
if (nBytes < (DEFAULT_BLOCK_PRIORITY_SIZE - 1000))
nMinFee = 0;
- } */
+ }
if (!MoneyRange(nMinFee))
nMinFee = MAX_MONEY;
diff --git a/src/main.h b/src/main.h
index d656526c6..4a35ddfc1 100644
--- a/src/main.h
+++ b/src/main.h
@@ -51,7 +51,7 @@ struct CNodeStateStats;
static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000;
static const unsigned int DEFAULT_BLOCK_MIN_SIZE = 0;
/** Default for -blockprioritysize, maximum space for zero/low-fee transactions **/
-static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 50000;
+static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 27000;
/** Default for accepting alerts from the P2P network. */
static const bool DEFAULT_ALERTS = true;
/** The maximum size for transactions we're willing to relay/mine */
diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h
index 6cfd93a9a..15b31c251 100644
--- a/src/primitives/transaction.h
+++ b/src/primitives/transaction.h
@@ -145,13 +145,18 @@ public:
// need a CTxIn of at least 148 bytes to spend:
// so dust is a txout less than 546 satoshis
// with default minRelayTxFee.
- size_t nSize = GetSerializeSize(SER_DISK,0)+148u;
- return 3*minRelayTxFee.GetFee(nSize);
+ // size_t nSize = GetSerializeSize(SER_DISK,0)+148u;
+ // return 3*minRelayTxFee.GetFee(nSize);
+ // Dogecoin: Dust is 1 COIN
+ return COIN;
}
bool IsDust(const CFeeRate &minRelayTxFee) const
{
- return (nValue < GetDustThreshold(minRelayTxFee));
+ // Dogecoin: IsDust() detection disabled, allows any valid dust to be relayed.
+ // The fees imposed on each dust txo is considered sufficient spam deterrant.
+ // return (nValue < GetDustThreshold(minRelayTxFee));
+ return false;
}
friend bool operator==(const CTxOut& a, const CTxOut& b)
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index e2679958f..071fb5a85 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -551,14 +551,15 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
nPayFee = CWallet::GetMinimumFee(txDummy, nBytes, nTxConfirmTarget, mempool);
// Allow free?
- double dPriorityNeeded = mempoolEstimatePriority;
- if (dPriorityNeeded <= 0)
- dPriorityNeeded = AllowFreeThreshold(); // not enough data, back to hard-coded
- fAllowFree = (dPriority >= dPriorityNeeded);
+ // Dogecoin: No free transactions
+ // double dPriorityNeeded = mempoolEstimatePriority;
+ // if (dPriorityNeeded <= 0)
+ // dPriorityNeeded = AllowFreeThreshold(); // not enough data, back to hard-coded
+ // fAllowFree = (dPriority >= dPriorityNeeded);
- if (fSendFreeTransactions)
- if (fAllowFree && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
- nPayFee = 0;
+ // if (fSendFreeTransactions)
+ // if (fAllowFree && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
+ // nPayFee = 0;
if (nPayAmount > 0)
{
@@ -570,8 +571,9 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
if (nChange > 0 && nChange < CENT)
{
CTxOut txout(nChange, (CScript)vector<unsigned char>(24, 0));
- if (txout.IsDust(::minRelayTxFee))
- {
+ // Dogecoin: Anything below 1 DOGE is considered dust
+ // if (txout.IsDust(::minRelayTxFee))
+ // {
if (CoinControlDialog::fSubtractFeeFromAmount) // dust-change will be raised until no dust
nChange = txout.GetDustThreshold(::minRelayTxFee);
else
@@ -579,7 +581,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
nPayFee += nChange;
nChange = 0;
}
- }
+ //}
}
if (nChange == 0 && !CoinControlDialog::fSubtractFeeFromAmount)
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index 7f7133793..b4d669663 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -340,8 +340,9 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
string reason;
BOOST_CHECK(IsStandardTx(t, reason));
- t.vout[0].nValue = 501; // dust
- BOOST_CHECK(!IsStandardTx(t, reason));
+ // Dogecoin: Dogecoin allows dust transactions
+ // t.vout[0].nValue = 501; // dust
+ // BOOST_CHECK(!IsStandardTx(t, reason));
t.vout[0].nValue = COIN; // not dust
BOOST_CHECK(IsStandardTx(t, reason));
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index c635d21db..d57c8c082 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1923,7 +1923,8 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend,
dPriority = wtxNew.ComputePriority(dPriority, nBytes);
// Can we complete this as a free transaction?
- if (fSendFreeTransactions && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
+ // Dogecoin: Disable free transactions
+ /* if (fSendFreeTransactions && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
{
// Not enough fee: enough priority?
double dPriorityNeeded = mempool.estimatePriority(nTxConfirmTarget);
@@ -1934,7 +1935,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend,
// Small enough, and priority high enough, to send for free
if (dPriorityNeeded > 0 && dPriority >= dPriorityNeeded)
break;
- }
+ } */
CAmount nFeeNeeded = GetMinimumFee(txNew, nBytes, nTxConfirmTarget, mempool);
@@ -2023,8 +2024,9 @@ CAmount CWallet::GetMinimumFee(const CMutableTransaction& tx, unsigned int nTxBy
if (fPayAtLeastCustomFee && nFeeNeeded > 0 && nFeeNeeded < payTxFee.GetFeePerK())
nFeeNeeded = payTxFee.GetFeePerK();
// User didn't set: use -txconfirmtarget to estimate...
- if (nFeeNeeded == 0)
- nFeeNeeded = pool.estimateFee(nConfirmTarget).GetFee(nTxBytes);
+ // Dogecoin: Disable txconfirmtarget
+ //if (nFeeNeeded == 0)
+ // nFeeNeeded = pool.estimateFee(nConfirmTarget).GetFee(nTxBytes);
// ... unless we don't have enough mempool data, in which case fall
// back to a hard-coded fee
if (nFeeNeeded == 0) {
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 8fcb09b40..2cf7b69c0 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -42,15 +42,15 @@ extern bool fPayAtLeastCustomFee;
//! -paytxfee default
static const CAmount DEFAULT_TRANSACTION_FEE = 0;
//! -paytxfee will warn if called with a higher fee than this amount (in satoshis) per KB
-static const CAmount nHighTransactionFeeWarning = 10 * COIN;
+static const CAmount nHighTransactionFeeWarning = 25 * COIN;
//! -maxtxfee default
-static const CAmount DEFAULT_TRANSACTION_MAXFEE = 100 * COIN;
+static const CAmount DEFAULT_TRANSACTION_MAXFEE = 250 * COIN;
//! -txconfirmtarget default
static const unsigned int DEFAULT_TX_CONFIRM_TARGET = 2;
//! -maxtxfee will warn if called with a higher fee than this amount (in satoshis)
static const CAmount nHighTransactionMaxFeeWarning = 100 * nHighTransactionFeeWarning;
//! Largest (in bytes) free transaction we're willing to create
-static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
+static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 0;
class CAccountingEntry;
class CBlockIndex;