Skip to content

Commit cd1d6d3

Browse files
committed
Rename nSubtractFeeFromAmount in CreateTransaction
Renamed to outputs_to_subtract_fee_from for clarity.
1 parent dac21c7 commit cd1d6d3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/wallet/spend.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ bool CWallet::CreateTransactionInternal(
583583
CAmount recipients_sum = 0;
584584
const OutputType change_type = TransactionChangeType(coin_control.m_change_type ? *coin_control.m_change_type : m_default_change_type, vecSend);
585585
ReserveDestination reservedest(this, change_type);
586-
unsigned int nSubtractFeeFromAmount = 0;
586+
unsigned int outputs_to_subtract_fee_from = 0; // The number of outputs which we are subtracting the fee from
587587
for (const auto& recipient : vecSend)
588588
{
589589
if (recipients_sum < 0 || recipient.nAmount < 0)
@@ -594,7 +594,7 @@ bool CWallet::CreateTransactionInternal(
594594
recipients_sum += recipient.nAmount;
595595

596596
if (recipient.fSubtractFeeFromAmount)
597-
nSubtractFeeFromAmount++;
597+
outputs_to_subtract_fee_from++;
598598
}
599599
if (vecSend.empty())
600600
{
@@ -684,7 +684,7 @@ bool CWallet::CreateTransactionInternal(
684684
coin_selection_params.m_change_fee = coin_selection_params.m_effective_feerate.GetFee(coin_selection_params.change_output_size);
685685
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;
686686

687-
coin_selection_params.m_subtract_fee_outputs = nSubtractFeeFromAmount != 0; // If we are doing subtract fee from recipient, don't use effective values
687+
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
688688

689689
// vouts to the payees
690690
if (!coin_selection_params.m_subtract_fee_outputs) {
@@ -757,7 +757,7 @@ bool CWallet::CreateTransactionInternal(
757757

758758
// Subtract fee from the change output if not subtracting it from recipient outputs
759759
CAmount fee_needed = nFeeRet;
760-
if (nSubtractFeeFromAmount == 0) {
760+
if (outputs_to_subtract_fee_from == 0) {
761761
change_position->nValue -= fee_needed;
762762
}
763763

@@ -783,7 +783,7 @@ bool CWallet::CreateTransactionInternal(
783783
}
784784

785785
// Reduce output values for subtractFeeFromAmount
786-
if (nSubtractFeeFromAmount != 0) {
786+
if (outputs_to_subtract_fee_from != 0) {
787787
CAmount to_reduce = fee_needed + change_amount - change_and_fee;
788788
int i = 0;
789789
bool fFirst = true;
@@ -796,12 +796,12 @@ bool CWallet::CreateTransactionInternal(
796796

797797
if (recipient.fSubtractFeeFromAmount)
798798
{
799-
txout.nValue -= to_reduce / nSubtractFeeFromAmount; // Subtract fee equally from each selected recipient
799+
txout.nValue -= to_reduce / outputs_to_subtract_fee_from; // Subtract fee equally from each selected recipient
800800

801801
if (fFirst) // first receiver pays the remainder not divisible by output count
802802
{
803803
fFirst = false;
804-
txout.nValue -= to_reduce % nSubtractFeeFromAmount;
804+
txout.nValue -= to_reduce % outputs_to_subtract_fee_from;
805805
}
806806

807807
// Error if this output is reduced to be below dust

0 commit comments

Comments
 (0)