@@ -2180,9 +2180,9 @@ CAmount CWallet::GetBalance(const isminefilter& filter, const int min_depth) con
2180
2180
LOCK (cs_wallet);
2181
2181
for (const auto & entry : mapWallet)
2182
2182
{
2183
- const CWalletTx* pcoin = & entry.second ;
2184
- if (pcoin-> IsTrusted (*locked_chain) && pcoin-> GetDepthInMainChain (*locked_chain) >= min_depth) {
2185
- nTotal += pcoin-> GetAvailableCredit (*locked_chain, true , filter);
2183
+ const CWalletTx& wtx = entry.second ;
2184
+ if (wtx. IsTrusted (*locked_chain) && wtx. GetDepthInMainChain (*locked_chain) >= min_depth) {
2185
+ nTotal += wtx. GetAvailableCredit (*locked_chain, true , filter);
2186
2186
}
2187
2187
}
2188
2188
}
@@ -2198,9 +2198,9 @@ CAmount CWallet::GetUnconfirmedBalance() const
2198
2198
LOCK (cs_wallet);
2199
2199
for (const auto & entry : mapWallet)
2200
2200
{
2201
- const CWalletTx* pcoin = & entry.second ;
2202
- if (!pcoin-> IsTrusted (*locked_chain) && pcoin-> GetDepthInMainChain (*locked_chain) == 0 && pcoin-> InMempool ())
2203
- nTotal += pcoin-> GetAvailableCredit (*locked_chain);
2201
+ const CWalletTx& wtx = entry.second ;
2202
+ if (!wtx. IsTrusted (*locked_chain) && wtx. GetDepthInMainChain (*locked_chain) == 0 && wtx. InMempool ())
2203
+ nTotal += wtx. GetAvailableCredit (*locked_chain);
2204
2204
}
2205
2205
}
2206
2206
return nTotal;
@@ -2214,8 +2214,8 @@ CAmount CWallet::GetImmatureBalance() const
2214
2214
LOCK (cs_wallet);
2215
2215
for (const auto & entry : mapWallet)
2216
2216
{
2217
- const CWalletTx* pcoin = & entry.second ;
2218
- nTotal += pcoin-> GetImmatureCredit (*locked_chain);
2217
+ const CWalletTx& wtx = entry.second ;
2218
+ nTotal += wtx. GetImmatureCredit (*locked_chain);
2219
2219
}
2220
2220
}
2221
2221
return nTotal;
@@ -2229,9 +2229,9 @@ CAmount CWallet::GetUnconfirmedWatchOnlyBalance() const
2229
2229
LOCK (cs_wallet);
2230
2230
for (const auto & entry : mapWallet)
2231
2231
{
2232
- const CWalletTx* pcoin = & entry.second ;
2233
- if (!pcoin-> IsTrusted (*locked_chain) && pcoin-> GetDepthInMainChain (*locked_chain) == 0 && pcoin-> InMempool ())
2234
- nTotal += pcoin-> GetAvailableCredit (*locked_chain, true , ISMINE_WATCH_ONLY);
2232
+ const CWalletTx& wtx = entry.second ;
2233
+ if (!wtx. IsTrusted (*locked_chain) && wtx. GetDepthInMainChain (*locked_chain) == 0 && wtx. InMempool ())
2234
+ nTotal += wtx. GetAvailableCredit (*locked_chain, true , ISMINE_WATCH_ONLY);
2235
2235
}
2236
2236
}
2237
2237
return nTotal;
@@ -2245,8 +2245,8 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const
2245
2245
LOCK (cs_wallet);
2246
2246
for (const auto & entry : mapWallet)
2247
2247
{
2248
- const CWalletTx* pcoin = & entry.second ;
2249
- nTotal += pcoin-> GetImmatureWatchOnlyCredit (*locked_chain);
2248
+ const CWalletTx& wtx = entry.second ;
2249
+ nTotal += wtx. GetImmatureWatchOnlyCredit (*locked_chain);
2250
2250
}
2251
2251
}
2252
2252
return nTotal;
@@ -2319,25 +2319,25 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
2319
2319
for (const auto & entry : mapWallet)
2320
2320
{
2321
2321
const uint256& wtxid = entry.first ;
2322
- const CWalletTx* pcoin = & entry.second ;
2322
+ const CWalletTx& wtx = entry.second ;
2323
2323
2324
- if (!locked_chain.checkFinalTx (*pcoin-> tx )) {
2324
+ if (!locked_chain.checkFinalTx (*wtx. tx )) {
2325
2325
continue ;
2326
2326
}
2327
2327
2328
- if (pcoin-> IsImmatureCoinBase (locked_chain))
2328
+ if (wtx. IsImmatureCoinBase (locked_chain))
2329
2329
continue ;
2330
2330
2331
- int nDepth = pcoin-> GetDepthInMainChain (locked_chain);
2331
+ int nDepth = wtx. GetDepthInMainChain (locked_chain);
2332
2332
if (nDepth < 0 )
2333
2333
continue ;
2334
2334
2335
2335
// We should not consider coins which aren't at least in our mempool
2336
2336
// It's possible for these to be conflicted via ancestors which we may never be able to detect
2337
- if (nDepth == 0 && !pcoin-> InMempool ())
2337
+ if (nDepth == 0 && !wtx. InMempool ())
2338
2338
continue ;
2339
2339
2340
- bool safeTx = pcoin-> IsTrusted (locked_chain);
2340
+ bool safeTx = wtx. IsTrusted (locked_chain);
2341
2341
2342
2342
// We should not consider coins from transactions that are replacing
2343
2343
// other transactions.
@@ -2354,7 +2354,7 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
2354
2354
// be a 1-block reorg away from the chain where transactions A and C
2355
2355
// were accepted to another chain where B, B', and C were all
2356
2356
// accepted.
2357
- if (nDepth == 0 && pcoin-> mapValue .count (" replaces_txid" )) {
2357
+ if (nDepth == 0 && wtx. mapValue .count (" replaces_txid" )) {
2358
2358
safeTx = false ;
2359
2359
}
2360
2360
@@ -2366,7 +2366,7 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
2366
2366
// intending to replace A', but potentially resulting in a scenario
2367
2367
// where A, A', and D could all be accepted (instead of just B and
2368
2368
// D, or just A and A' like the user would want).
2369
- if (nDepth == 0 && pcoin-> mapValue .count (" replaced_by_txid" )) {
2369
+ if (nDepth == 0 && wtx. mapValue .count (" replaced_by_txid" )) {
2370
2370
safeTx = false ;
2371
2371
}
2372
2372
@@ -2377,8 +2377,8 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
2377
2377
if (nDepth < nMinDepth || nDepth > nMaxDepth)
2378
2378
continue ;
2379
2379
2380
- for (unsigned int i = 0 ; i < pcoin-> tx ->vout .size (); i++) {
2381
- if (pcoin-> tx ->vout [i].nValue < nMinimumAmount || pcoin-> tx ->vout [i].nValue > nMaximumAmount)
2380
+ for (unsigned int i = 0 ; i < wtx. tx ->vout .size (); i++) {
2381
+ if (wtx. tx ->vout [i].nValue < nMinimumAmount || wtx. tx ->vout [i].nValue > nMaximumAmount)
2382
2382
continue ;
2383
2383
2384
2384
if (coinControl && coinControl->HasSelected () && !coinControl->fAllowOtherInputs && !coinControl->IsSelected (COutPoint (entry.first , i)))
@@ -2390,20 +2390,20 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
2390
2390
if (IsSpent (locked_chain, wtxid, i))
2391
2391
continue ;
2392
2392
2393
- isminetype mine = IsMine (pcoin-> tx ->vout [i]);
2393
+ isminetype mine = IsMine (wtx. tx ->vout [i]);
2394
2394
2395
2395
if (mine == ISMINE_NO) {
2396
2396
continue ;
2397
2397
}
2398
2398
2399
- bool solvable = IsSolvable (*this , pcoin-> tx ->vout [i].scriptPubKey );
2399
+ bool solvable = IsSolvable (*this , wtx. tx ->vout [i].scriptPubKey );
2400
2400
bool spendable = ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || (((mine & ISMINE_WATCH_ONLY) != ISMINE_NO) && (coinControl && coinControl->fAllowWatchOnly && solvable));
2401
2401
2402
- vCoins.push_back (COutput (pcoin , i, nDepth, spendable, solvable, safeTx, (coinControl && coinControl->fAllowWatchOnly )));
2402
+ vCoins.push_back (COutput (&wtx , i, nDepth, spendable, solvable, safeTx, (coinControl && coinControl->fAllowWatchOnly )));
2403
2403
2404
2404
// Checks the sum amount of all UTXO's.
2405
2405
if (nMinimumSumAmount != MAX_MONEY) {
2406
- nTotal += pcoin-> tx ->vout [i].nValue ;
2406
+ nTotal += wtx. tx ->vout [i].nValue ;
2407
2407
2408
2408
if (nTotal >= nMinimumSumAmount) {
2409
2409
return ;
@@ -2562,13 +2562,13 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm
2562
2562
std::map<uint256, CWalletTx>::const_iterator it = mapWallet.find (outpoint.hash );
2563
2563
if (it != mapWallet.end ())
2564
2564
{
2565
- const CWalletTx* pcoin = & it->second ;
2565
+ const CWalletTx& wtx = it->second ;
2566
2566
// Clearly invalid input, fail
2567
- if (pcoin-> tx ->vout .size () <= outpoint.n )
2567
+ if (wtx. tx ->vout .size () <= outpoint.n )
2568
2568
return false ;
2569
2569
// Just to calculate the marginal byte size
2570
- nValueFromPresetInputs += pcoin-> tx ->vout [outpoint.n ].nValue ;
2571
- setPresetCoins.insert (CInputCoin (pcoin-> tx , outpoint.n ));
2570
+ nValueFromPresetInputs += wtx. tx ->vout [outpoint.n ].nValue ;
2571
+ setPresetCoins.insert (CInputCoin (wtx. tx , outpoint.n ));
2572
2572
} else
2573
2573
return false ; // TODO: Allow non-wallet inputs
2574
2574
}
@@ -3606,27 +3606,27 @@ std::map<CTxDestination, CAmount> CWallet::GetAddressBalances(interfaces::Chain:
3606
3606
LOCK (cs_wallet);
3607
3607
for (const auto & walletEntry : mapWallet)
3608
3608
{
3609
- const CWalletTx *pcoin = & walletEntry.second ;
3609
+ const CWalletTx& wtx = walletEntry.second ;
3610
3610
3611
- if (!pcoin-> IsTrusted (locked_chain))
3611
+ if (!wtx. IsTrusted (locked_chain))
3612
3612
continue ;
3613
3613
3614
- if (pcoin-> IsImmatureCoinBase (locked_chain))
3614
+ if (wtx. IsImmatureCoinBase (locked_chain))
3615
3615
continue ;
3616
3616
3617
- int nDepth = pcoin-> GetDepthInMainChain (locked_chain);
3618
- if (nDepth < (pcoin-> IsFromMe (ISMINE_ALL) ? 0 : 1 ))
3617
+ int nDepth = wtx. GetDepthInMainChain (locked_chain);
3618
+ if (nDepth < (wtx. IsFromMe (ISMINE_ALL) ? 0 : 1 ))
3619
3619
continue ;
3620
3620
3621
- for (unsigned int i = 0 ; i < pcoin-> tx ->vout .size (); i++)
3621
+ for (unsigned int i = 0 ; i < wtx. tx ->vout .size (); i++)
3622
3622
{
3623
3623
CTxDestination addr;
3624
- if (!IsMine (pcoin-> tx ->vout [i]))
3624
+ if (!IsMine (wtx. tx ->vout [i]))
3625
3625
continue ;
3626
- if (!ExtractDestination (pcoin-> tx ->vout [i].scriptPubKey , addr))
3626
+ if (!ExtractDestination (wtx. tx ->vout [i].scriptPubKey , addr))
3627
3627
continue ;
3628
3628
3629
- CAmount n = IsSpent (locked_chain, walletEntry.first , i) ? 0 : pcoin-> tx ->vout [i].nValue ;
3629
+ CAmount n = IsSpent (locked_chain, walletEntry.first , i) ? 0 : wtx. tx ->vout [i].nValue ;
3630
3630
3631
3631
if (!balances.count (addr))
3632
3632
balances[addr] = 0 ;
@@ -3646,13 +3646,13 @@ std::set< std::set<CTxDestination> > CWallet::GetAddressGroupings()
3646
3646
3647
3647
for (const auto & walletEntry : mapWallet)
3648
3648
{
3649
- const CWalletTx *pcoin = & walletEntry.second ;
3649
+ const CWalletTx& wtx = walletEntry.second ;
3650
3650
3651
- if (pcoin-> tx ->vin .size () > 0 )
3651
+ if (wtx. tx ->vin .size () > 0 )
3652
3652
{
3653
3653
bool any_mine = false ;
3654
3654
// group all input addresses with each other
3655
- for (const CTxIn& txin : pcoin-> tx ->vin )
3655
+ for (const CTxIn& txin : wtx. tx ->vin )
3656
3656
{
3657
3657
CTxDestination address;
3658
3658
if (!IsMine (txin)) /* If this input isn't mine, ignore it */
@@ -3666,7 +3666,7 @@ std::set< std::set<CTxDestination> > CWallet::GetAddressGroupings()
3666
3666
// group change with input addresses
3667
3667
if (any_mine)
3668
3668
{
3669
- for (const CTxOut& txout : pcoin-> tx ->vout )
3669
+ for (const CTxOut& txout : wtx. tx ->vout )
3670
3670
if (IsChange (txout))
3671
3671
{
3672
3672
CTxDestination txoutAddr;
@@ -3683,7 +3683,7 @@ std::set< std::set<CTxDestination> > CWallet::GetAddressGroupings()
3683
3683
}
3684
3684
3685
3685
// group lone addrs by themselves
3686
- for (const auto & txout : pcoin-> tx ->vout )
3686
+ for (const auto & txout : wtx. tx ->vout )
3687
3687
if (IsMine (txout))
3688
3688
{
3689
3689
CTxDestination address;
0 commit comments