@@ -640,24 +640,6 @@ bool CWallet::CreateTransactionInternal(
640
640
641
641
CMutableTransaction txNew;
642
642
FeeCalculation feeCalc;
643
-
644
- CoinSelectionParams coin_selection_params; // Parameters for coin selection, init with dummy
645
- coin_selection_params.m_discard_feerate = coin_control.m_discard_feerate ? *coin_control.m_discard_feerate : GetDiscardRate (*this );
646
-
647
- // Get the fee rate to use effective values in coin selection
648
- coin_selection_params.m_effective_feerate = GetMinimumFeeRate (*this , coin_control, &feeCalc);
649
- // Do not, ever, assume that it's fine to change the fee rate if the user has explicitly
650
- // provided one
651
- if (coin_control.m_feerate && coin_selection_params.m_effective_feerate > *coin_control.m_feerate ) {
652
- error = strprintf (_ (" Fee rate (%s) is lower than the minimum fee rate setting (%s)" ), coin_control.m_feerate ->ToString (FeeEstimateMode::DUFF_B), coin_selection_params.m_effective_feerate .ToString (FeeEstimateMode::DUFF_B));
653
- return false ;
654
- }
655
- if (feeCalc.reason == FeeReason::FALLBACK && !m_allow_fallback_fee) {
656
- // eventually allow a fallback fee
657
- error = _ (" Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee." );
658
- return false ;
659
- }
660
-
661
643
int nBytes{0 };
662
644
{
663
645
std::set<CInputCoin> setCoins;
@@ -667,14 +649,14 @@ bool CWallet::CreateTransactionInternal(
667
649
CAmount nAmountAvailable{0 };
668
650
std::vector<COutput> vAvailableCoins;
669
651
AvailableCoins (vAvailableCoins, &coin_control, 1 , MAX_MONEY, MAX_MONEY, 0 );
670
- coin_selection_params.use_bnb = false ; // never use BnB
652
+ CoinSelectionParams coin_selection_params; // Parameters for coin selection, init with dummy
653
+ coin_selection_params.m_avoid_partial_spends = coin_control.m_avoid_partial_spends ;
671
654
672
655
for (auto out : vAvailableCoins) {
673
656
if (out.fSpendable ) {
674
657
nAmountAvailable += out.tx ->tx ->vout [out.i ].nValue ;
675
658
}
676
659
}
677
- coin_selection_params.m_avoid_partial_spends = coin_control.m_avoid_partial_spends ;
678
660
679
661
// Create change script that will be used if we need change
680
662
// TODO: pass in scriptChange instead of reservedest so
@@ -705,9 +687,30 @@ bool CWallet::CreateTransactionInternal(
705
687
CHECK_NONFATAL (IsValidDestination (dest) != scriptChange.empty ());
706
688
}
707
689
690
+ // Set discard feerate
691
+ coin_selection_params.m_discard_feerate = coin_control.m_discard_feerate ? *coin_control.m_discard_feerate : GetDiscardRate (*this );
692
+
693
+ // Get the fee rate to use effective values in coin selection
694
+ coin_selection_params.m_effective_feerate = GetMinimumFeeRate (*this , coin_control, &feeCalc);
695
+ // Do not, ever, assume that it's fine to change the fee rate if the user has explicitly
696
+ // provided one
697
+ if (coin_control.m_feerate && coin_selection_params.m_effective_feerate > *coin_control.m_feerate ) {
698
+ error = strprintf (_ (" Fee rate (%s) is lower than the minimum fee rate setting (%s)" ), coin_control.m_feerate ->ToString (FeeEstimateMode::DUFF_B), coin_selection_params.m_effective_feerate .ToString (FeeEstimateMode::DUFF_B));
699
+ return false ;
700
+ }
701
+ if (feeCalc.reason == FeeReason::FALLBACK && !m_allow_fallback_fee) {
702
+ // eventually allow a fallback fee
703
+ error = _ (" Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee." );
704
+ return false ;
705
+ }
706
+
708
707
nFeeRet = 0 ;
709
708
bool pick_new_inputs = true ;
710
709
CAmount nValueIn = 0 ;
710
+
711
+ // BnB selector is the only selector used when this is true.
712
+ coin_selection_params.use_bnb = false ; // Dash: never use BnB
713
+
711
714
CAmount nAmountToSelectAdditional{0 };
712
715
// Start with nAmountToSelectAdditional=0 and loop until there is enough to cover the request + fees, try it 500 times.
713
716
int nMaxTries = 500 ;
0 commit comments