@@ -165,24 +165,27 @@ CoinsResult AvailableCoins(const CWallet& wallet,
165
165
bool tx_from_me = CachedTxIsFromMe (wallet, wtx, ISMINE_ALL);
166
166
167
167
for (unsigned int i = 0 ; i < wtx.tx ->vout .size (); i++) {
168
+ const CTxOut& output = wtx.tx ->vout [i];
169
+ const COutPoint outpoint (wtxid, i);
170
+
168
171
// Only consider selected coins if add_inputs is false
169
- if (coinControl && !coinControl->m_add_inputs && !coinControl->IsSelected (COutPoint (entry. first , i) )) {
172
+ if (coinControl && !coinControl->m_add_inputs && !coinControl->IsSelected (outpoint )) {
170
173
continue ;
171
174
}
172
175
173
- if (wtx. tx -> vout [i]. nValue < nMinimumAmount || wtx. tx -> vout [i] .nValue > nMaximumAmount)
176
+ if (output. nValue < nMinimumAmount || output .nValue > nMaximumAmount)
174
177
continue ;
175
178
176
- if (coinControl && coinControl->HasSelected () && !coinControl->fAllowOtherInputs && !coinControl->IsSelected (COutPoint (entry. first , i) ))
179
+ if (coinControl && coinControl->HasSelected () && !coinControl->fAllowOtherInputs && !coinControl->IsSelected (outpoint ))
177
180
continue ;
178
181
179
- if (wallet.IsLockedCoin (entry. first , i))
182
+ if (wallet.IsLockedCoin (wtxid , i))
180
183
continue ;
181
184
182
185
if (wallet.IsSpent (wtxid, i))
183
186
continue ;
184
187
185
- isminetype mine = wallet.IsMine (wtx. tx -> vout [i] );
188
+ isminetype mine = wallet.IsMine (output );
186
189
187
190
if (mine == ISMINE_NO) {
188
191
continue ;
@@ -192,16 +195,16 @@ CoinsResult AvailableCoins(const CWallet& wallet,
192
195
continue ;
193
196
}
194
197
195
- std::unique_ptr<SigningProvider> provider = wallet.GetSolvingProvider (wtx. tx -> vout [i] .scriptPubKey );
198
+ std::unique_ptr<SigningProvider> provider = wallet.GetSolvingProvider (output .scriptPubKey );
196
199
197
- bool solvable = provider ? IsSolvable (*provider, wtx. tx -> vout [i] .scriptPubKey ) : false ;
200
+ bool solvable = provider ? IsSolvable (*provider, output .scriptPubKey ) : false ;
198
201
bool spendable = ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || (((mine & ISMINE_WATCH_ONLY) != ISMINE_NO) && (coinControl && coinControl->fAllowWatchOnly && solvable));
199
202
int input_bytes = GetTxSpendSize (wallet, wtx, i, (coinControl && coinControl->fAllowWatchOnly ));
200
- result.coins .emplace_back (COutPoint (wtx. GetHash (), i), wtx. tx -> vout . at (i) , nDepth, input_bytes, spendable, solvable, safeTx, wtx.GetTxTime (), tx_from_me, feerate);
203
+ result.coins .emplace_back (outpoint, output , nDepth, input_bytes, spendable, solvable, safeTx, wtx.GetTxTime (), tx_from_me, feerate);
201
204
202
205
// Checks the sum amount of all UTXO's.
203
206
if (nMinimumSumAmount != MAX_MONEY) {
204
- nTotal += wtx. tx -> vout [i] .nValue ;
207
+ nTotal += output .nValue ;
205
208
206
209
if (nTotal >= nMinimumSumAmount) {
207
210
return result;
0 commit comments