Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.12.0.x revert attempts to lower fee #439

Merged
merged 1 commit into from
Jul 18, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2036,8 +2036,6 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
if(useIX && nFeePay < CENT) nFeePay = CENT;

CAmount nValue = 0;
CAmount nFeeDelta = 0;
int nAttemptsToLowerFee = 0;

BOOST_FOREACH (const PAIRTYPE(CScript, CAmount)& s, vecSend)
{
Expand Down Expand Up @@ -2069,7 +2067,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
txNew.vout.clear();
wtxNew.fFromMe = true;

CAmount nTotalValue = nValue + nFeeRet + nFeeDelta;
CAmount nTotalValue = nValue + nFeeRet;
double dPriority = 0;
// vouts to the payees
BOOST_FOREACH (const PAIRTYPE(CScript, CAmount)& s, vecSend)
Expand Down Expand Up @@ -2163,10 +2161,8 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
CTxOut newTxOut(nChange, scriptChange);

// Never create dust outputs; if we would, just
// add the dust to the fee
// OR if we didn't try to lower fees yet,
// let's see what fee we can get if there is no change
if (newTxOut.IsDust(::minRelayTxFee) || nAttemptsToLowerFee == 0)
// add the dust to the fee.
if (newTxOut.IsDust(::minRelayTxFee))
{
nFeeRet += nChange;
nChange = 0;
Expand Down Expand Up @@ -2231,19 +2227,9 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
return false;
}

if (nFeeRet == nFeeNeeded || // Done, enough fee included
(nFeeRet > nFeeNeeded && (nAttemptsToLowerFee > 1 || coin_type == ONLY_DENOMINATED)))
if (nFeeRet >= nFeeNeeded) // Done, enough fee included
break;

if (nFeeRet > nFeeNeeded) {
// Try to lower fee
nAttemptsToLowerFee++;
nFeeDelta = nFeeRet - nFeeNeeded;
}
else {
nFeeDelta = 0; //not enough fee so no delta too
}

// Include more fee and try again.
nFeeRet = nFeeNeeded;
continue;
Expand Down