aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2021-05-17 16:22:30 -0400
committerAndrew Chow <achow101-github@achow101.com>2021-05-30 14:05:15 -0400
commitcd1d6d3324a841087f6d5da723394e8d7df07ec7 (patch)
treea4cd0e3e35939f788c736ec1b4ae6885dd9cc573 /src/wallet
parentdac21c793f8fbb4d5debc55ac97c406c7c93ff48 (diff)
Rename nSubtractFeeFromAmount in CreateTransaction
Renamed to outputs_to_subtract_fee_from for clarity.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/spend.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index 3e69703788..70f29001d0 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -583,7 +583,7 @@ bool CWallet::CreateTransactionInternal(
CAmount recipients_sum = 0;
const OutputType change_type = TransactionChangeType(coin_control.m_change_type ? *coin_control.m_change_type : m_default_change_type, vecSend);
ReserveDestination reservedest(this, change_type);
- unsigned int nSubtractFeeFromAmount = 0;
+ unsigned int outputs_to_subtract_fee_from = 0; // The number of outputs which we are subtracting the fee from
for (const auto& recipient : vecSend)
{
if (recipients_sum < 0 || recipient.nAmount < 0)
@@ -594,7 +594,7 @@ bool CWallet::CreateTransactionInternal(
recipients_sum += recipient.nAmount;
if (recipient.fSubtractFeeFromAmount)
- nSubtractFeeFromAmount++;
+ outputs_to_subtract_fee_from++;
}
if (vecSend.empty())
{
@@ -684,7 +684,7 @@ bool CWallet::CreateTransactionInternal(
coin_selection_params.m_change_fee = coin_selection_params.m_effective_feerate.GetFee(coin_selection_params.change_output_size);
coin_selection_params.m_cost_of_change = coin_selection_params.m_discard_feerate.GetFee(coin_selection_params.change_spend_size) + coin_selection_params.m_change_fee;
- coin_selection_params.m_subtract_fee_outputs = nSubtractFeeFromAmount != 0; // If we are doing subtract fee from recipient, don't use effective values
+ coin_selection_params.m_subtract_fee_outputs = outputs_to_subtract_fee_from != 0; // If we are doing subtract fee from recipient, don't use effective values
// vouts to the payees
if (!coin_selection_params.m_subtract_fee_outputs) {
@@ -757,7 +757,7 @@ bool CWallet::CreateTransactionInternal(
// Subtract fee from the change output if not subtracting it from recipient outputs
CAmount fee_needed = nFeeRet;
- if (nSubtractFeeFromAmount == 0) {
+ if (outputs_to_subtract_fee_from == 0) {
change_position->nValue -= fee_needed;
}
@@ -783,7 +783,7 @@ bool CWallet::CreateTransactionInternal(
}
// Reduce output values for subtractFeeFromAmount
- if (nSubtractFeeFromAmount != 0) {
+ if (outputs_to_subtract_fee_from != 0) {
CAmount to_reduce = fee_needed + change_amount - change_and_fee;
int i = 0;
bool fFirst = true;
@@ -796,12 +796,12 @@ bool CWallet::CreateTransactionInternal(
if (recipient.fSubtractFeeFromAmount)
{
- txout.nValue -= to_reduce / nSubtractFeeFromAmount; // Subtract fee equally from each selected recipient
+ txout.nValue -= to_reduce / outputs_to_subtract_fee_from; // Subtract fee equally from each selected recipient
if (fFirst) // first receiver pays the remainder not divisible by output count
{
fFirst = false;
- txout.nValue -= to_reduce % nSubtractFeeFromAmount;
+ txout.nValue -= to_reduce % outputs_to_subtract_fee_from;
}
// Error if this output is reduced to be below dust