Skip to content

Commit

Permalink
[Cleanup] Remove unused (always false) fAllowFree arg in GetMinRelayFee
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed Jul 8, 2021
1 parent 03d2ee9 commit dcddcaf
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/qt/coincontroldialog.cpp
Expand Up @@ -561,7 +561,7 @@ TotalAmounts CoinControlDialog::getTotals() const
t.nBytes += (GetCompactSize(nTransIns) + GetCompactSize(nTransOuts));

// Fee (default K fixed for shielded fee for now)
t.nPayFee = GetMinRelayFee(t.nBytes, false) * (isShieldedTx ? DEFAULT_SHIELDEDTXFEE_K : 1);
t.nPayFee = GetMinRelayFee(t.nBytes) * (isShieldedTx ? DEFAULT_SHIELDEDTXFEE_K : 1);

if (t.nPayAmount > 0) {
t.nChange = t.nAmount - t.nPayFee - t.nPayAmount;
Expand Down
2 changes: 1 addition & 1 deletion src/qt/pivx/send.cpp
Expand Up @@ -722,7 +722,7 @@ void SendWidget::onShieldCoinsClicked()
nBytesInputs += 1;
// nVersion, nType, nLockTime and vin/vout len sizes
nBytesInputs += 10;
CAmount nPayFee = GetMinRelayFee(nBytesInputs, false) * DEFAULT_SHIELDEDTXFEE_K;
CAmount nPayFee = GetMinRelayFee(nBytesInputs) * DEFAULT_SHIELDEDTXFEE_K;

// load recipient
QList<SendCoinsRecipient> recipients;
Expand Down
2 changes: 1 addition & 1 deletion src/sapling/sapling_operation.cpp
Expand Up @@ -212,7 +212,7 @@ OperationResult SaplingOperation::build()
// Now check fee
bool isShielded = opTx->IsShieldedTx();
const CAmount& nFeeNeeded = isShielded ? GetShieldedTxMinFee(*opTx) :
GetMinRelayFee(opTx->GetTotalSize(), false);
GetMinRelayFee(opTx->GetTotalSize());
if (nFeeNeeded <= nFeeRet) {
// Check that the fee is not too high.
CAmount nMaxFee = nFeeNeeded * (isShielded ? 100 : 10000);
Expand Down
20 changes: 7 additions & 13 deletions src/validation.cpp
Expand Up @@ -281,7 +281,7 @@ void LimitMempoolSize(CTxMemPool& pool, size_t limit, unsigned long age) {
pcoinsTip->Uncache(removed);
}

CAmount GetMinRelayFee(const CTransaction& tx, const CTxMemPool& pool, unsigned int nBytes, bool fAllowFree)
CAmount GetMinRelayFee(const CTransaction& tx, const CTxMemPool& pool, unsigned int nBytes)
{
if (tx.IsShieldedTx()) {
return GetShieldedTxMinFee(tx);
Expand All @@ -293,21 +293,15 @@ CAmount GetMinRelayFee(const CTransaction& tx, const CTxMemPool& pool, unsigned
if (dPriorityDelta > 0 || nFeeDelta > 0)
return 0;

return GetMinRelayFee(nBytes, fAllowFree);
return GetMinRelayFee(nBytes);
}

CAmount GetMinRelayFee(unsigned int nBytes, bool fAllowFree)
CAmount GetMinRelayFee(unsigned int nBytes)
{
CAmount nMinFee = ::minRelayTxFee.GetFee(nBytes);

if (fAllowFree) {
// There is a free transaction area in blocks created by most miners,
// !TODO: remove
nMinFee = 0;
}

if (!Params().GetConsensus().MoneyRange(nMinFee))
if (!Params().GetConsensus().MoneyRange(nMinFee)) {
nMinFee = Params().GetConsensus().nMaxMoneyOut;
}
return nMinFee;
}

Expand Down Expand Up @@ -561,7 +555,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C

// Don't accept it if it can't get into a block
if (!ignoreFees) {
const CAmount txMinFee = GetMinRelayFee(tx, pool, nSize, false);
const CAmount txMinFee = GetMinRelayFee(tx, pool, nSize);
if (fLimitFree && nFees < txMinFee)
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient fee", false,
strprintf("%d < %d", nFees, txMinFee));
Expand Down Expand Up @@ -596,7 +590,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C

if (fRejectAbsurdFee) {
const CAmount nMaxFee = tx.IsShieldedTx() ? GetShieldedTxMinFee(tx) * 100 :
GetMinRelayFee(nSize, false) * 10000;
GetMinRelayFee(nSize) * 10000;
if (nFees > nMaxFee)
return state.Invalid(false, REJECT_HIGHFEE, "absurdly-high-fee",
strprintf("%d > %d", nFees, nMaxFee));
Expand Down
4 changes: 2 additions & 2 deletions src/validation.h
Expand Up @@ -226,8 +226,8 @@ bool AcceptToMemoryPoolWithTime(CTxMemPool& pool, CValidationState &state, const
/** Convert CValidationState to a human-readable message for logging */
std::string FormatStateMessage(const CValidationState &state);

CAmount GetMinRelayFee(const CTransaction& tx, const CTxMemPool& pool, unsigned int nBytes, bool fAllowFree);
CAmount GetMinRelayFee(unsigned int nBytes, bool fAllowFree);
CAmount GetMinRelayFee(const CTransaction& tx, const CTxMemPool& pool, unsigned int nBytes);
CAmount GetMinRelayFee(unsigned int nBytes);
/**
* Return the minimum fee for a shielded tx.
*/
Expand Down

0 comments on commit dcddcaf

Please sign in to comment.