@@ -2085,7 +2085,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
2085
2085
nValueRet = 0 ;
2086
2086
2087
2087
// List of values less than target
2088
- CInputCoin coinLowestLarger;
2088
+ boost::optional< CInputCoin> coinLowestLarger;
2089
2089
std::vector<CInputCoin> vValue;
2090
2090
CAmount nTotalLower = 0 ;
2091
2091
@@ -2119,7 +2119,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
2119
2119
vValue.push_back (coin);
2120
2120
nTotalLower += coin.txout .nValue ;
2121
2121
}
2122
- else if (coinLowestLarger. IsNull () || coin.txout .nValue < coinLowestLarger. txout .nValue )
2122
+ else if (! coinLowestLarger || coin.txout .nValue < coinLowestLarger-> txout .nValue )
2123
2123
{
2124
2124
coinLowestLarger = coin;
2125
2125
}
@@ -2137,10 +2137,10 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
2137
2137
2138
2138
if (nTotalLower < nTargetValue)
2139
2139
{
2140
- if (coinLowestLarger. IsNull () )
2140
+ if (! coinLowestLarger)
2141
2141
return false ;
2142
- setCoinsRet.insert (coinLowestLarger);
2143
- nValueRet += coinLowestLarger. txout .nValue ;
2142
+ setCoinsRet.insert (coinLowestLarger. get () );
2143
+ nValueRet += coinLowestLarger-> txout .nValue ;
2144
2144
return true ;
2145
2145
}
2146
2146
@@ -2156,11 +2156,11 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
2156
2156
2157
2157
// If we have a bigger coin and (either the stochastic approximation didn't find a good solution,
2158
2158
// or the next bigger coin is closer), return the bigger coin
2159
- if (! coinLowestLarger. IsNull () &&
2160
- ((nBest != nTargetValue && nBest < nTargetValue + MIN_CHANGE) || coinLowestLarger. txout .nValue <= nBest))
2159
+ if (coinLowestLarger &&
2160
+ ((nBest != nTargetValue && nBest < nTargetValue + MIN_CHANGE) || coinLowestLarger-> txout .nValue <= nBest))
2161
2161
{
2162
- setCoinsRet.insert (coinLowestLarger);
2163
- nValueRet += coinLowestLarger. txout .nValue ;
2162
+ setCoinsRet.insert (coinLowestLarger. get () );
2163
+ nValueRet += coinLowestLarger-> txout .nValue ;
2164
2164
}
2165
2165
else {
2166
2166
for (unsigned int i = 0 ; i < vValue.size (); i++)
0 commit comments