@@ -2087,7 +2087,6 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
2087
2087
// List of values less than target
2088
2088
std::pair<CAmount, CInputCoin> coinLowestLarger;
2089
2089
coinLowestLarger.first = std::numeric_limits<CAmount>::max ();
2090
- coinLowestLarger.second .first = NULL ;
2091
2090
std::vector<std::pair<CAmount, CInputCoin> > vValue;
2092
2091
CAmount nTotalLower = 0 ;
2093
2092
@@ -2109,7 +2108,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
2109
2108
int i = output.i ;
2110
2109
CAmount n = pcoin->tx ->vout [i].nValue ;
2111
2110
2112
- std::pair<CAmount,CInputCoin> coin = std::make_pair (n,std::make_pair (pcoin, i));
2111
+ std::pair<CAmount,CInputCoin> coin = std::make_pair (n, CInputCoin (pcoin, i));
2113
2112
2114
2113
if (n == nTargetValue)
2115
2114
{
@@ -2140,7 +2139,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
2140
2139
2141
2140
if (nTotalLower < nTargetValue)
2142
2141
{
2143
- if (coinLowestLarger.second .first == NULL )
2142
+ if (coinLowestLarger.second .IsNull () )
2144
2143
return false ;
2145
2144
setCoinsRet.insert (coinLowestLarger.second );
2146
2145
nValueRet += coinLowestLarger.first ;
@@ -2159,7 +2158,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
2159
2158
2160
2159
// If we have a bigger coin and (either the stochastic approximation didn't find a good solution,
2161
2160
// or the next bigger coin is closer), return the bigger coin
2162
- if (coinLowestLarger.second .first &&
2161
+ if (coinLowestLarger.second .IsNull () &&
2163
2162
((nBest != nTargetValue && nBest < nTargetValue + MIN_CHANGE) || coinLowestLarger.first <= nBest))
2164
2163
{
2165
2164
setCoinsRet.insert (coinLowestLarger.second );
@@ -2199,7 +2198,7 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm
2199
2198
if (!out.fSpendable )
2200
2199
continue ;
2201
2200
nValueRet += out.tx ->tx ->vout [out.i ].nValue ;
2202
- setCoinsRet.insert (std::make_pair (out.tx , out.i ));
2201
+ setCoinsRet.insert (CInputCoin (out.tx , out.i ));
2203
2202
}
2204
2203
return (nValueRet >= nTargetValue);
2205
2204
}
@@ -2221,15 +2220,15 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm
2221
2220
if (pcoin->tx ->vout .size () <= outpoint.n )
2222
2221
return false ;
2223
2222
nValueFromPresetInputs += pcoin->tx ->vout [outpoint.n ].nValue ;
2224
- setPresetCoins.insert (std::make_pair (pcoin, outpoint.n ));
2223
+ setPresetCoins.insert (CInputCoin (pcoin, outpoint.n ));
2225
2224
} else
2226
2225
return false ; // TODO: Allow non-wallet inputs
2227
2226
}
2228
2227
2229
2228
// remove preset inputs from vCoins
2230
2229
for (std::vector<COutput>::iterator it = vCoins.begin (); it != vCoins.end () && coinControl && coinControl->HasSelected ();)
2231
2230
{
2232
- if (setPresetCoins.count (std::make_pair (it->tx , it->i )))
2231
+ if (setPresetCoins.count (CInputCoin (it->tx , it->i )))
2233
2232
it = vCoins.erase (it);
2234
2233
else
2235
2234
++it;
@@ -2554,7 +2553,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
2554
2553
// behavior."
2555
2554
bool rbf = coinControl ? coinControl->signalRbf : fWalletRbf ;
2556
2555
for (const auto & coin : setCoins)
2557
- txNew.vin .push_back (CTxIn (coin.first -> GetHash (),coin. second ,CScript (),
2556
+ txNew.vin .push_back (CTxIn (coin.outpoint ,CScript (),
2558
2557
std::numeric_limits<unsigned int >::max () - (rbf ? 2 : 1 )));
2559
2558
2560
2559
// Fill in dummy signatures for fee calculation.
@@ -2637,10 +2636,10 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
2637
2636
int nIn = 0 ;
2638
2637
for (const auto & coin : setCoins)
2639
2638
{
2640
- const CScript& scriptPubKey = coin.first -> tx -> vout [coin. second ] .scriptPubKey ;
2639
+ const CScript& scriptPubKey = coin.txout .scriptPubKey ;
2641
2640
SignatureData sigdata;
2642
2641
2643
- if (!ProduceSignature (TransactionSignatureCreator (this , &txNewConst, nIn, coin.first -> tx -> vout [coin. second ] .nValue , SIGHASH_ALL), scriptPubKey, sigdata))
2642
+ if (!ProduceSignature (TransactionSignatureCreator (this , &txNewConst, nIn, coin.txout .nValue , SIGHASH_ALL), scriptPubKey, sigdata))
2644
2643
{
2645
2644
strFailReason = _ (" Signing transaction failed" );
2646
2645
return false ;
0 commit comments