@@ -583,7 +583,7 @@ bool CWallet::CreateTransactionInternal(
583
583
CAmount recipients_sum = 0 ;
584
584
const OutputType change_type = TransactionChangeType (coin_control.m_change_type ? *coin_control.m_change_type : m_default_change_type, vecSend);
585
585
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
587
587
for (const auto & recipient : vecSend)
588
588
{
589
589
if (recipients_sum < 0 || recipient.nAmount < 0 )
@@ -594,7 +594,7 @@ bool CWallet::CreateTransactionInternal(
594
594
recipients_sum += recipient.nAmount ;
595
595
596
596
if (recipient.fSubtractFeeFromAmount )
597
- nSubtractFeeFromAmount ++;
597
+ outputs_to_subtract_fee_from ++;
598
598
}
599
599
if (vecSend.empty ())
600
600
{
@@ -684,7 +684,7 @@ bool CWallet::CreateTransactionInternal(
684
684
coin_selection_params.m_change_fee = coin_selection_params.m_effective_feerate .GetFee (coin_selection_params.change_output_size );
685
685
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 ;
686
686
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
688
688
689
689
// vouts to the payees
690
690
if (!coin_selection_params.m_subtract_fee_outputs ) {
@@ -757,7 +757,7 @@ bool CWallet::CreateTransactionInternal(
757
757
758
758
// Subtract fee from the change output if not subtracting it from recipient outputs
759
759
CAmount fee_needed = nFeeRet;
760
- if (nSubtractFeeFromAmount == 0 ) {
760
+ if (outputs_to_subtract_fee_from == 0 ) {
761
761
change_position->nValue -= fee_needed;
762
762
}
763
763
@@ -783,7 +783,7 @@ bool CWallet::CreateTransactionInternal(
783
783
}
784
784
785
785
// Reduce output values for subtractFeeFromAmount
786
- if (nSubtractFeeFromAmount != 0 ) {
786
+ if (outputs_to_subtract_fee_from != 0 ) {
787
787
CAmount to_reduce = fee_needed + change_amount - change_and_fee;
788
788
int i = 0 ;
789
789
bool fFirst = true ;
@@ -796,12 +796,12 @@ bool CWallet::CreateTransactionInternal(
796
796
797
797
if (recipient.fSubtractFeeFromAmount )
798
798
{
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
800
800
801
801
if (fFirst ) // first receiver pays the remainder not divisible by output count
802
802
{
803
803
fFirst = false ;
804
- txout.nValue -= to_reduce % nSubtractFeeFromAmount ;
804
+ txout.nValue -= to_reduce % outputs_to_subtract_fee_from ;
805
805
}
806
806
807
807
// Error if this output is reduced to be below dust
0 commit comments