@@ -2592,18 +2592,18 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nC
2592
2592
{
2593
2593
std::vector<CRecipient> vecSend;
2594
2594
2595
- // Turn the txout set into a CRecipient vector
2596
- for (size_t idx = 0 ; idx < tx.vout .size (); idx++)
2597
- {
2595
+ // Turn the txout set into a CRecipient vector.
2596
+ for (size_t idx = 0 ; idx < tx.vout .size (); idx++) {
2598
2597
const CTxOut& txOut = tx.vout [idx];
2599
2598
CRecipient recipient = {txOut.scriptPubKey , txOut.nValue , setSubtractFeeFromOutputs.count (idx) == 1 };
2600
2599
vecSend.push_back (recipient);
2601
2600
}
2602
2601
2603
2602
coinControl.fAllowOtherInputs = true ;
2604
2603
2605
- for (const CTxIn& txin : tx.vin )
2604
+ for (const CTxIn& txin : tx.vin ) {
2606
2605
coinControl.Select (txin.prevout );
2606
+ }
2607
2607
2608
2608
CReserveKey reservekey (this );
2609
2609
CWalletTx wtx;
@@ -2613,31 +2613,29 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nC
2613
2613
2614
2614
if (nChangePosInOut != -1 ) {
2615
2615
tx.vout .insert (tx.vout .begin () + nChangePosInOut, wtx.tx ->vout [nChangePosInOut]);
2616
- // we don't have the normal Create/Commit cycle, and don't want to risk reusing change,
2617
- // so just remove the key from the keypool here.
2616
+ // We don't have the normal Create/Commit cycle, and don't want to risk
2617
+ // reusing change, so just remove the key from the keypool here.
2618
2618
reservekey.KeepKey ();
2619
2619
}
2620
2620
2621
- // Copy output sizes from new transaction; they may have had the fee subtracted from them
2622
- for (unsigned int idx = 0 ; idx < tx.vout .size (); idx++)
2621
+ // Copy output sizes from new transaction; they may have had the fee
2622
+ // subtracted from them.
2623
+ for (unsigned int idx = 0 ; idx < tx.vout .size (); idx++) {
2623
2624
tx.vout [idx].nValue = wtx.tx ->vout [idx].nValue ;
2625
+ }
2624
2626
2625
- // Add new txins (keeping original txin scriptSig/order)
2626
- for (const CTxIn& txin : wtx.tx ->vin )
2627
- {
2628
- if (!coinControl.IsSelected (txin.prevout ))
2629
- {
2627
+ // Add new txins while keeping original txin scriptSig/order.
2628
+ for (const CTxIn& txin : wtx.tx ->vin ) {
2629
+ if (!coinControl.IsSelected (txin.prevout )) {
2630
2630
tx.vin .push_back (txin);
2631
2631
2632
- if (lockUnspents)
2633
- {
2634
- LOCK2 (cs_main, cs_wallet);
2635
- LockCoin (txin.prevout );
2632
+ if (lockUnspents) {
2633
+ LOCK2 (cs_main, cs_wallet);
2634
+ LockCoin (txin.prevout );
2636
2635
}
2637
2636
}
2638
2637
}
2639
2638
2640
-
2641
2639
return true ;
2642
2640
}
2643
2641
0 commit comments