Skip to content

Commit faa3a24

Browse files
author
MarcoFalke
committed
scripted-diff: wallet: Rename pcoin to wtx
-BEGIN VERIFY SCRIPT- sed -i --regexp-extended -e 's/const CWalletTx ?\* ?pcoin = &/const CWalletTx\& wtx = /g' src/wallet/wallet.cpp sed -i -e 's/\<pcoin->/wtx./g' src/wallet/wallet.cpp sed -i -e 's/\<pcoin\>/\&wtx/g' src/wallet/wallet.cpp -END VERIFY SCRIPT-
1 parent fae5f87 commit faa3a24

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

src/wallet/wallet.cpp

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,9 +2180,9 @@ CAmount CWallet::GetBalance(const isminefilter& filter, const int min_depth) con
21802180
LOCK(cs_wallet);
21812181
for (const auto& entry : mapWallet)
21822182
{
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);
21862186
}
21872187
}
21882188
}
@@ -2198,9 +2198,9 @@ CAmount CWallet::GetUnconfirmedBalance() const
21982198
LOCK(cs_wallet);
21992199
for (const auto& entry : mapWallet)
22002200
{
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);
22042204
}
22052205
}
22062206
return nTotal;
@@ -2214,8 +2214,8 @@ CAmount CWallet::GetImmatureBalance() const
22142214
LOCK(cs_wallet);
22152215
for (const auto& entry : mapWallet)
22162216
{
2217-
const CWalletTx* pcoin = &entry.second;
2218-
nTotal += pcoin->GetImmatureCredit(*locked_chain);
2217+
const CWalletTx& wtx = entry.second;
2218+
nTotal += wtx.GetImmatureCredit(*locked_chain);
22192219
}
22202220
}
22212221
return nTotal;
@@ -2229,9 +2229,9 @@ CAmount CWallet::GetUnconfirmedWatchOnlyBalance() const
22292229
LOCK(cs_wallet);
22302230
for (const auto& entry : mapWallet)
22312231
{
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);
22352235
}
22362236
}
22372237
return nTotal;
@@ -2245,8 +2245,8 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const
22452245
LOCK(cs_wallet);
22462246
for (const auto& entry : mapWallet)
22472247
{
2248-
const CWalletTx* pcoin = &entry.second;
2249-
nTotal += pcoin->GetImmatureWatchOnlyCredit(*locked_chain);
2248+
const CWalletTx& wtx = entry.second;
2249+
nTotal += wtx.GetImmatureWatchOnlyCredit(*locked_chain);
22502250
}
22512251
}
22522252
return nTotal;
@@ -2319,25 +2319,25 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
23192319
for (const auto& entry : mapWallet)
23202320
{
23212321
const uint256& wtxid = entry.first;
2322-
const CWalletTx* pcoin = &entry.second;
2322+
const CWalletTx& wtx = entry.second;
23232323

2324-
if (!locked_chain.checkFinalTx(*pcoin->tx)) {
2324+
if (!locked_chain.checkFinalTx(*wtx.tx)) {
23252325
continue;
23262326
}
23272327

2328-
if (pcoin->IsImmatureCoinBase(locked_chain))
2328+
if (wtx.IsImmatureCoinBase(locked_chain))
23292329
continue;
23302330

2331-
int nDepth = pcoin->GetDepthInMainChain(locked_chain);
2331+
int nDepth = wtx.GetDepthInMainChain(locked_chain);
23322332
if (nDepth < 0)
23332333
continue;
23342334

23352335
// We should not consider coins which aren't at least in our mempool
23362336
// 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())
23382338
continue;
23392339

2340-
bool safeTx = pcoin->IsTrusted(locked_chain);
2340+
bool safeTx = wtx.IsTrusted(locked_chain);
23412341

23422342
// We should not consider coins from transactions that are replacing
23432343
// other transactions.
@@ -2354,7 +2354,7 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
23542354
// be a 1-block reorg away from the chain where transactions A and C
23552355
// were accepted to another chain where B, B', and C were all
23562356
// accepted.
2357-
if (nDepth == 0 && pcoin->mapValue.count("replaces_txid")) {
2357+
if (nDepth == 0 && wtx.mapValue.count("replaces_txid")) {
23582358
safeTx = false;
23592359
}
23602360

@@ -2366,7 +2366,7 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
23662366
// intending to replace A', but potentially resulting in a scenario
23672367
// where A, A', and D could all be accepted (instead of just B and
23682368
// 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")) {
23702370
safeTx = false;
23712371
}
23722372

@@ -2377,8 +2377,8 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
23772377
if (nDepth < nMinDepth || nDepth > nMaxDepth)
23782378
continue;
23792379

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)
23822382
continue;
23832383

23842384
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<
23902390
if (IsSpent(locked_chain, wtxid, i))
23912391
continue;
23922392

2393-
isminetype mine = IsMine(pcoin->tx->vout[i]);
2393+
isminetype mine = IsMine(wtx.tx->vout[i]);
23942394

23952395
if (mine == ISMINE_NO) {
23962396
continue;
23972397
}
23982398

2399-
bool solvable = IsSolvable(*this, pcoin->tx->vout[i].scriptPubKey);
2399+
bool solvable = IsSolvable(*this, wtx.tx->vout[i].scriptPubKey);
24002400
bool spendable = ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || (((mine & ISMINE_WATCH_ONLY) != ISMINE_NO) && (coinControl && coinControl->fAllowWatchOnly && solvable));
24012401

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)));
24032403

24042404
// Checks the sum amount of all UTXO's.
24052405
if (nMinimumSumAmount != MAX_MONEY) {
2406-
nTotal += pcoin->tx->vout[i].nValue;
2406+
nTotal += wtx.tx->vout[i].nValue;
24072407

24082408
if (nTotal >= nMinimumSumAmount) {
24092409
return;
@@ -2562,13 +2562,13 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm
25622562
std::map<uint256, CWalletTx>::const_iterator it = mapWallet.find(outpoint.hash);
25632563
if (it != mapWallet.end())
25642564
{
2565-
const CWalletTx* pcoin = &it->second;
2565+
const CWalletTx& wtx = it->second;
25662566
// Clearly invalid input, fail
2567-
if (pcoin->tx->vout.size() <= outpoint.n)
2567+
if (wtx.tx->vout.size() <= outpoint.n)
25682568
return false;
25692569
// 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));
25722572
} else
25732573
return false; // TODO: Allow non-wallet inputs
25742574
}
@@ -3606,27 +3606,27 @@ std::map<CTxDestination, CAmount> CWallet::GetAddressBalances(interfaces::Chain:
36063606
LOCK(cs_wallet);
36073607
for (const auto& walletEntry : mapWallet)
36083608
{
3609-
const CWalletTx *pcoin = &walletEntry.second;
3609+
const CWalletTx& wtx = walletEntry.second;
36103610

3611-
if (!pcoin->IsTrusted(locked_chain))
3611+
if (!wtx.IsTrusted(locked_chain))
36123612
continue;
36133613

3614-
if (pcoin->IsImmatureCoinBase(locked_chain))
3614+
if (wtx.IsImmatureCoinBase(locked_chain))
36153615
continue;
36163616

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))
36193619
continue;
36203620

3621-
for (unsigned int i = 0; i < pcoin->tx->vout.size(); i++)
3621+
for (unsigned int i = 0; i < wtx.tx->vout.size(); i++)
36223622
{
36233623
CTxDestination addr;
3624-
if (!IsMine(pcoin->tx->vout[i]))
3624+
if (!IsMine(wtx.tx->vout[i]))
36253625
continue;
3626-
if(!ExtractDestination(pcoin->tx->vout[i].scriptPubKey, addr))
3626+
if(!ExtractDestination(wtx.tx->vout[i].scriptPubKey, addr))
36273627
continue;
36283628

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;
36303630

36313631
if (!balances.count(addr))
36323632
balances[addr] = 0;
@@ -3646,13 +3646,13 @@ std::set< std::set<CTxDestination> > CWallet::GetAddressGroupings()
36463646

36473647
for (const auto& walletEntry : mapWallet)
36483648
{
3649-
const CWalletTx *pcoin = &walletEntry.second;
3649+
const CWalletTx& wtx = walletEntry.second;
36503650

3651-
if (pcoin->tx->vin.size() > 0)
3651+
if (wtx.tx->vin.size() > 0)
36523652
{
36533653
bool any_mine = false;
36543654
// group all input addresses with each other
3655-
for (const CTxIn& txin : pcoin->tx->vin)
3655+
for (const CTxIn& txin : wtx.tx->vin)
36563656
{
36573657
CTxDestination address;
36583658
if(!IsMine(txin)) /* If this input isn't mine, ignore it */
@@ -3666,7 +3666,7 @@ std::set< std::set<CTxDestination> > CWallet::GetAddressGroupings()
36663666
// group change with input addresses
36673667
if (any_mine)
36683668
{
3669-
for (const CTxOut& txout : pcoin->tx->vout)
3669+
for (const CTxOut& txout : wtx.tx->vout)
36703670
if (IsChange(txout))
36713671
{
36723672
CTxDestination txoutAddr;
@@ -3683,7 +3683,7 @@ std::set< std::set<CTxDestination> > CWallet::GetAddressGroupings()
36833683
}
36843684

36853685
// group lone addrs by themselves
3686-
for (const auto& txout : pcoin->tx->vout)
3686+
for (const auto& txout : wtx.tx->vout)
36873687
if (IsMine(txout))
36883688
{
36893689
CTxDestination address;

0 commit comments

Comments
 (0)