revert all changes regarding attempts to lower fee

This commit is contained in:
UdjinM6 2015-07-18 03:26:43 +03:00
parent 59024b1b46
commit 990e32f3c0

View File

@ -2036,8 +2036,6 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
if(useIX && nFeePay < CENT) nFeePay = CENT; if(useIX && nFeePay < CENT) nFeePay = CENT;
CAmount nValue = 0; CAmount nValue = 0;
CAmount nFeeDelta = 0;
int nAttemptsToLowerFee = 0;
BOOST_FOREACH (const PAIRTYPE(CScript, CAmount)& s, vecSend) BOOST_FOREACH (const PAIRTYPE(CScript, CAmount)& s, vecSend)
{ {
@ -2069,7 +2067,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
txNew.vout.clear(); txNew.vout.clear();
wtxNew.fFromMe = true; wtxNew.fFromMe = true;
CAmount nTotalValue = nValue + nFeeRet + nFeeDelta; CAmount nTotalValue = nValue + nFeeRet;
double dPriority = 0; double dPriority = 0;
// vouts to the payees // vouts to the payees
BOOST_FOREACH (const PAIRTYPE(CScript, CAmount)& s, vecSend) BOOST_FOREACH (const PAIRTYPE(CScript, CAmount)& s, vecSend)
@ -2163,10 +2161,8 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
CTxOut newTxOut(nChange, scriptChange); CTxOut newTxOut(nChange, scriptChange);
// Never create dust outputs; if we would, just // Never create dust outputs; if we would, just
// add the dust to the fee // add the dust to the fee.
// OR if we didn't try to lower fees yet, if (newTxOut.IsDust(::minRelayTxFee))
// let's see what fee we can get if there is no change
if (newTxOut.IsDust(::minRelayTxFee) || nAttemptsToLowerFee == 0)
{ {
nFeeRet += nChange; nFeeRet += nChange;
nChange = 0; nChange = 0;
@ -2231,19 +2227,9 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
return false; return false;
} }
if (nFeeRet == nFeeNeeded || // Done, enough fee included if (nFeeRet >= nFeeNeeded) // Done, enough fee included
(nFeeRet > nFeeNeeded && (nAttemptsToLowerFee > 1 || coin_type == ONLY_DENOMINATED)))
break; 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. // Include more fee and try again.
nFeeRet = nFeeNeeded; nFeeRet = nFeeNeeded;
continue; continue;