Changeset View
Changeset View
Standalone View
Standalone View
src/qt/coincontroldialog.cpp
Show First 20 Lines • Show All 463 Lines • ▼ Show 20 Lines | void CoinControlDialog::updateLabels(WalletModel *model, QDialog *dialog) { | ||||
CMutableTransaction txDummy; | CMutableTransaction txDummy; | ||||
for (const Amount amount : CoinControlDialog::payAmounts) { | for (const Amount amount : CoinControlDialog::payAmounts) { | ||||
nPayAmount += amount; | nPayAmount += amount; | ||||
if (amount > Amount::zero()) { | if (amount > Amount::zero()) { | ||||
CTxOut txout(amount, | CTxOut txout(amount, | ||||
static_cast<CScript>(std::vector<uint8_t>(24, 0))); | static_cast<CScript>(std::vector<uint8_t>(24, 0))); | ||||
txDummy.vout.push_back(txout); | txDummy.vout.push_back(txout); | ||||
if (txout.IsDust(model->node().getDustRelayFee())) { | fDust |= IsDust(txout, model->node().getDustRelayFee()); | ||||
fDust = true; | |||||
} | |||||
} | } | ||||
} | } | ||||
Amount nAmount = Amount::zero(); | Amount nAmount = Amount::zero(); | ||||
Amount nPayFee = Amount::zero(); | Amount nPayFee = Amount::zero(); | ||||
Amount nAfterFee = Amount::zero(); | Amount nAfterFee = Amount::zero(); | ||||
Amount nChange = Amount::zero(); | Amount nChange = Amount::zero(); | ||||
unsigned int nBytes = 0; | unsigned int nBytes = 0; | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | if (nQuantity > 0) { | ||||
nChange -= nPayFee; | nChange -= nPayFee; | ||||
} | } | ||||
// Never create dust outputs; if we would, just add the dust to the | // Never create dust outputs; if we would, just add the dust to the | ||||
// fee. | // fee. | ||||
if (nChange > Amount::zero() && nChange < MIN_CHANGE) { | if (nChange > Amount::zero() && nChange < MIN_CHANGE) { | ||||
CTxOut txout(nChange, | CTxOut txout(nChange, | ||||
static_cast<CScript>(std::vector<uint8_t>(24, 0))); | static_cast<CScript>(std::vector<uint8_t>(24, 0))); | ||||
if (txout.IsDust(model->node().getDustRelayFee())) { | if (IsDust(txout, model->node().getDustRelayFee())) { | ||||
// dust-change will be raised until no dust | // dust-change will be raised until no dust | ||||
if (CoinControlDialog::fSubtractFeeFromAmount) { | if (CoinControlDialog::fSubtractFeeFromAmount) { | ||||
nChange = txout.GetDustThreshold( | nChange = GetDustThreshold( | ||||
model->node().getDustRelayFee()); | txout, model->node().getDustRelayFee()); | ||||
} else { | } else { | ||||
nPayFee += nChange; | nPayFee += nChange; | ||||
nChange = Amount::zero(); | nChange = Amount::zero(); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (nChange == Amount::zero() && | if (nChange == Amount::zero() && | ||||
▲ Show 20 Lines • Show All 259 Lines • Show Last 20 Lines |