Skip to content

Commit 535d8e4

Browse files
committed
scripted-diff: various renames for per-utxo consistency
>>> backports bitcoin/bitcoin@5898279 Thanks to John Newberry for pointing these out. -BEGIN VERIFY SCRIPT- sed -i 's/\<GetCoins\>/GetCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<HaveCoins\>/HaveCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<HaveCoinsInCache\>/HaveCoinInCache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<IsPruned\>/IsSpent/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<FetchCoins\>/FetchCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<CoinsEntry\>/CoinEntry/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<vHashTxnToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<vHashTxToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<fHadTxInCache\>/had_coin_in_cache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<coinbaseids\>/coinbase_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<disconnectedids\>/disconnected_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<duplicateids\>/duplicate_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h sed -i 's/\<oldcoins\>/old_coin/g' src/test/coins_tests.cpp sed -i 's/\<origcoins\>/orig_coin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h -END VERIFY SCRIPT-
1 parent 60c73ad commit 535d8e4

File tree

16 files changed

+121
-121
lines changed

16 files changed

+121
-121
lines changed

src/coins.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111

1212
#include <assert.h>
1313

14-
bool CCoinsView::GetCoins(const COutPoint& outpoint, Coin& coin) const { return false; }
15-
bool CCoinsView::HaveCoins(const COutPoint& outpoint) const { return false; }
14+
bool CCoinsView::GetCoin(const COutPoint& outpoint, Coin& coin) const { return false; }
15+
bool CCoinsView::HaveCoin(const COutPoint& outpoint) const { return false; }
1616
uint256 CCoinsView::GetBestBlock() const { return UINT256_ZERO; }
1717
bool CCoinsView::BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock) { return false; }
1818
CCoinsViewCursor *CCoinsView::Cursor() const { return 0; }
1919

2020
CCoinsViewBacked::CCoinsViewBacked(CCoinsView* viewIn) : base(viewIn) {}
21-
bool CCoinsViewBacked::GetCoins(const COutPoint& outpoint, Coin& coin) const { return base->GetCoins(outpoint, coin); }
22-
bool CCoinsViewBacked::HaveCoins(const COutPoint& outpoint) const { return base->HaveCoins(outpoint); }
21+
bool CCoinsViewBacked::GetCoin(const COutPoint& outpoint, Coin& coin) const { return base->GetCoin(outpoint, coin); }
22+
bool CCoinsViewBacked::HaveCoin(const COutPoint& outpoint) const { return base->HaveCoin(outpoint); }
2323
uint256 CCoinsViewBacked::GetBestBlock() const { return base->GetBestBlock(); }
2424
void CCoinsViewBacked::SetBackend(CCoinsView& viewIn) { base = &viewIn; }
2525
bool CCoinsViewBacked::BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock) { return base->BatchWrite(mapCoins, hashBlock); }
@@ -34,16 +34,16 @@ size_t CCoinsViewCache::DynamicMemoryUsage() const {
3434
return memusage::DynamicUsage(cacheCoins) + cachedCoinsUsage;
3535
}
3636

37-
CCoinsMap::iterator CCoinsViewCache::FetchCoins(const COutPoint& outpoint) const
37+
CCoinsMap::iterator CCoinsViewCache::FetchCoin(const COutPoint& outpoint) const
3838
{
3939
CCoinsMap::iterator it = cacheCoins.find(outpoint);
4040
if (it != cacheCoins.end())
4141
return it;
4242
Coin tmp;
43-
if (!base->GetCoins(outpoint, tmp))
43+
if (!base->GetCoin(outpoint, tmp))
4444
return cacheCoins.end();
4545
CCoinsMap::iterator ret = cacheCoins.emplace(std::piecewise_construct, std::forward_as_tuple(outpoint), std::forward_as_tuple(std::move(tmp))).first;
46-
if (ret->second.coin.IsPruned()) {
46+
if (ret->second.coin.IsSpent()) {
4747
// The parent only has an empty entry for this outpoint; we can consider our
4848
// version as fresh.
4949
ret->second.flags = CCoinsCacheEntry::FRESH;
@@ -52,9 +52,9 @@ CCoinsMap::iterator CCoinsViewCache::FetchCoins(const COutPoint& outpoint) const
5252
return ret;
5353
}
5454

55-
bool CCoinsViewCache::GetCoins(const COutPoint& outpoint, Coin& coin) const
55+
bool CCoinsViewCache::GetCoin(const COutPoint& outpoint, Coin& coin) const
5656
{
57-
CCoinsMap::const_iterator it = FetchCoins(outpoint);
57+
CCoinsMap::const_iterator it = FetchCoin(outpoint);
5858
if (it != cacheCoins.end()) {
5959
coin = it->second.coin;
6060
return true;
@@ -63,7 +63,7 @@ bool CCoinsViewCache::GetCoins(const COutPoint& outpoint, Coin& coin) const
6363
}
6464

6565
void CCoinsViewCache::AddCoin(const COutPoint& outpoint, Coin&& coin, bool possible_overwrite) {
66-
assert(!coin.IsPruned());
66+
assert(!coin.IsSpent());
6767
if (coin.out.scriptPubKey.IsUnspendable()) return;
6868
CCoinsMap::iterator it;
6969
bool inserted;
@@ -73,7 +73,7 @@ void CCoinsViewCache::AddCoin(const COutPoint& outpoint, Coin&& coin, bool possi
7373
cachedCoinsUsage -= it->second.coin.DynamicMemoryUsage();
7474
}
7575
if (!possible_overwrite) {
76-
if (!it->second.coin.IsPruned()) {
76+
if (!it->second.coin.IsSpent()) {
7777
throw std::logic_error("Adding new coin that replaces non-pruned entry");
7878
}
7979
fresh = !(it->second.flags & CCoinsCacheEntry::DIRTY);
@@ -95,7 +95,7 @@ void AddCoins(CCoinsViewCache& cache, const CTransaction& tx, int nHeight)
9595

9696
void CCoinsViewCache::SpendCoin(const COutPoint& outpoint, Coin* moveout)
9797
{
98-
CCoinsMap::iterator it = FetchCoins(outpoint);
98+
CCoinsMap::iterator it = FetchCoin(outpoint);
9999
if (it == cacheCoins.end()) return;
100100
cachedCoinsUsage -= it->second.coin.DynamicMemoryUsage();
101101
if (moveout) {
@@ -113,21 +113,21 @@ static const Coin coinEmpty;
113113

114114
const Coin& CCoinsViewCache::AccessCoin(const COutPoint& outpoint) const
115115
{
116-
CCoinsMap::const_iterator it = FetchCoins(outpoint);
116+
CCoinsMap::const_iterator it = FetchCoin(outpoint);
117117
if (it == cacheCoins.end()) {
118118
return coinEmpty;
119119
} else {
120120
return it->second.coin;
121121
}
122122
}
123123

124-
bool CCoinsViewCache::HaveCoins(const COutPoint& outpoint) const
124+
bool CCoinsViewCache::HaveCoin(const COutPoint& outpoint) const
125125
{
126-
CCoinsMap::const_iterator it = FetchCoins(outpoint);
127-
return (it != cacheCoins.end() && !it->second.coin.IsPruned());
126+
CCoinsMap::const_iterator it = FetchCoin(outpoint);
127+
return (it != cacheCoins.end() && !it->second.coin.IsSpent());
128128
}
129129

130-
bool CCoinsViewCache::HaveCoinsInCache(const COutPoint& outpoint) const
130+
bool CCoinsViewCache::HaveCoinInCache(const COutPoint& outpoint) const
131131
{
132132
CCoinsMap::const_iterator it = cacheCoins.find(outpoint);
133133
return it != cacheCoins.end();
@@ -152,7 +152,7 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlockIn
152152
if (itUs == cacheCoins.end()) {
153153
// The parent cache does not have an entry, while the child does
154154
// We can ignore it if it's both FRESH and pruned in the child
155-
if (!(it->second.flags & CCoinsCacheEntry::FRESH && it->second.coin.IsPruned())) {
155+
if (!(it->second.flags & CCoinsCacheEntry::FRESH && it->second.coin.IsSpent())) {
156156
// Otherwise we will need to create it in the parent
157157
// and move the data up and mark it as dirty
158158
CCoinsCacheEntry& entry = cacheCoins[it->first];
@@ -170,11 +170,11 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlockIn
170170
// parent cache entry has unspent outputs. If this ever happens,
171171
// it means the FRESH flag was misapplied and there is a logic
172172
// error in the calling code.
173-
if ((it->second.flags & CCoinsCacheEntry::FRESH) && !itUs->second.coin.IsPruned())
173+
if ((it->second.flags & CCoinsCacheEntry::FRESH) && !itUs->second.coin.IsSpent())
174174
throw std::logic_error("FRESH flag misapplied to cache entry for base transaction with spendable outputs");
175175

176176
// Found the entry in the parent cache
177-
if ((itUs->second.flags & CCoinsCacheEntry::FRESH) && it->second.coin.IsPruned()) {
177+
if ((itUs->second.flags & CCoinsCacheEntry::FRESH) && it->second.coin.IsSpent()) {
178178
// The grandparent does not have an entry, and the child is
179179
// modified and being pruned. This means we can just delete
180180
// it from the parent.
@@ -243,7 +243,7 @@ bool CCoinsViewCache::HaveInputs(const CTransaction& tx) const
243243
{
244244
if (!tx.IsCoinBase() && !tx.HasZerocoinSpendInputs()) {
245245
for (unsigned int i = 0; i < tx.vin.size(); i++) {
246-
if (!HaveCoins(tx.vin[i].prevout)) {
246+
if (!HaveCoin(tx.vin[i].prevout)) {
247247
return false;
248248
}
249249
}
@@ -259,7 +259,7 @@ double CCoinsViewCache::GetPriority(const CTransaction& tx, int nHeight, CAmount
259259
double dResult = 0.0;
260260
for (const CTxIn& txin : tx.vin) {
261261
const Coin& coin = AccessCoin(txin.prevout);
262-
if (coin.IsPruned()) continue;
262+
if (coin.IsSpent()) continue;
263263
if (coin.nHeight <= (unsigned)nHeight) {
264264
dResult += coin.out.nValue * (nHeight - coin.nHeight);
265265
inChainInputValue += coin.out.nValue;
@@ -275,7 +275,7 @@ const Coin& AccessByTxid(const CCoinsViewCache& view, const uint256& txid)
275275
COutPoint iter(txid, 0);
276276
while (iter.n < MAX_OUTPUTS_PER_BLOCK) {
277277
const Coin& alternate = view.AccessCoin(iter);
278-
if (!alternate.IsPruned()) return alternate;
278+
if (!alternate.IsSpent()) return alternate;
279279
++iter.n;
280280
}
281281
return coinEmpty;

src/coins.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Coin
6565

6666
template<typename Stream>
6767
void Serialize(Stream &s) const {
68-
assert(!IsPruned());
68+
assert(!IsSpent());
6969
uint32_t code = nHeight * 4 + (fCoinBase ? 2 : 0) + (fCoinStake ? 1 : 0);
7070
::Serialize(s, VARINT(code));
7171
::Serialize(s, CTxOutCompressor(REF(out)));
@@ -81,7 +81,7 @@ class Coin
8181
::Unserialize(s, REF(CTxOutCompressor(out)));
8282
}
8383

84-
bool IsPruned() const {
84+
bool IsSpent() const {
8585
return out.IsNull();
8686
}
8787

@@ -150,11 +150,11 @@ class CCoinsView
150150
{
151151
public:
152152
//! Retrieve the Coin (unspent transaction output) for a given outpoint.
153-
virtual bool GetCoins(const COutPoint& outpoint, Coin& coin) const;
153+
virtual bool GetCoin(const COutPoint& outpoint, Coin& coin) const;
154154

155155
//! Just check whether we have data for a given outpoint.
156156
//! This may (but cannot always) return true for spent outputs.
157-
virtual bool HaveCoins(const COutPoint& outpoint) const;
157+
virtual bool HaveCoin(const COutPoint& outpoint) const;
158158

159159
//! Retrieve the block hash whose state this CCoinsView currently represents
160160
virtual uint256 GetBestBlock() const;
@@ -182,8 +182,8 @@ class CCoinsViewBacked : public CCoinsView
182182

183183
public:
184184
CCoinsViewBacked(CCoinsView* viewIn);
185-
bool GetCoins(const COutPoint& outpoint, Coin& coin) const override;
186-
bool HaveCoins(const COutPoint& outpoint) const override;
185+
bool GetCoin(const COutPoint& outpoint, Coin& coin) const override;
186+
bool HaveCoin(const COutPoint& outpoint) const override;
187187
uint256 GetBestBlock() const override;
188188
void SetBackend(CCoinsView& viewIn);
189189
bool BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock) override;
@@ -214,22 +214,22 @@ class CCoinsViewCache : public CCoinsViewBacked
214214
CCoinsViewCache(CCoinsView *baseIn);
215215

216216
// Standard CCoinsView methods
217-
bool GetCoins(const COutPoint& outpoint, Coin& coin) const override;
218-
bool HaveCoins(const COutPoint& outpoint) const override;
217+
bool GetCoin(const COutPoint& outpoint, Coin& coin) const override;
218+
bool HaveCoin(const COutPoint& outpoint) const override;
219219
uint256 GetBestBlock() const override;
220220
void SetBestBlock(const uint256& hashBlock);
221221
bool BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock) override;
222222

223223
/**
224224
* Check if we have the given utxo already loaded in this cache.
225-
* The semantics are the same as HaveCoins(), but no calls to
225+
* The semantics are the same as HaveCoin(), but no calls to
226226
* the backing CCoinsView are made.
227227
*/
228-
bool HaveCoinsInCache(const COutPoint& outpoint) const;
228+
bool HaveCoinInCache(const COutPoint& outpoint) const;
229229

230230
/**
231231
* Return a reference to a Coin in the cache, or a pruned one if not found. This is
232-
* more efficient than GetCoins. Modifications to other cache entries are
232+
* more efficient than GetCoin. Modifications to other cache entries are
233233
* allowed while accessing the returned pointer.
234234
*/
235235
const Coin& AccessCoin(const COutPoint& output) const;
@@ -286,7 +286,7 @@ class CCoinsViewCache : public CCoinsViewBacked
286286
double GetPriority(const CTransaction& tx, int nHeight, CAmount &inChainInputValue) const;
287287

288288
private:
289-
CCoinsMap::iterator FetchCoins(const COutPoint& outpoint) const;
289+
CCoinsMap::iterator FetchCoin(const COutPoint& outpoint) const;
290290

291291
/**
292292
* By making the copy constructor private, we prevent accidentally using it when one intends to create a cache on top of a base cache.

src/consensus/zerocoin_verify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ CAmount GetInvalidUTXOValue()
289289
bool fSpent = false;
290290
CCoinsViewCache cache(pcoinsTip);
291291
const Coin& coin = cache.AccessCoin(out);
292-
if(coin.IsPruned())
292+
if(coin.IsSpent())
293293
fSpent = true;
294294
if (!fSpent)
295295
nValue += coin.out.nValue;

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ class CCoinsViewErrorCatcher : public CCoinsViewBacked
158158
{
159159
public:
160160
CCoinsViewErrorCatcher(CCoinsView* view) : CCoinsViewBacked(view) {}
161-
bool GetCoins(const COutPoint& outpoint, Coin& coin) const override
161+
bool GetCoin(const COutPoint& outpoint, Coin& coin) const override
162162
{
163163
try {
164-
return CCoinsViewBacked::GetCoins(outpoint, coin);
164+
return CCoinsViewBacked::GetCoin(outpoint, coin);
165165
} catch (const std::runtime_error& e) {
166166
uiInterface.ThreadSafeMessageBox(_("Error reading from database, shutting down."), "", CClientUIInterface::MSG_ERROR);
167167
LogPrintf("Error reading from database: %s\n", e.what());

src/main.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ int GetInputAge(CTxIn& vin)
755755

756756
const Coin& coin = view.AccessCoin(vin.prevout);
757757

758-
if (!coin.IsPruned()) {
758+
if (!coin.IsSpent()) {
759759
return WITH_LOCK(cs_main, return chainActive.Height() + 1) - coin.nHeight;
760760
} else
761761
return -1;
@@ -854,7 +854,7 @@ std::string FormatStateMessage(const CValidationState &state)
854854

855855
bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
856856
bool* pfMissingInputs, bool fOverrideMempoolLimit, bool fRejectAbsurdFee, bool ignoreFees,
857-
std::vector<COutPoint>& vHashTxnToUncache)
857+
std::vector<COutPoint>& coins_to_uncache)
858858
{
859859
AssertLockHeld(cs_main);
860860
if (pfMissingInputs)
@@ -940,21 +940,21 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
940940
// do we already have it?
941941
for (size_t out = 0; out < tx.vout.size(); out++) {
942942
COutPoint outpoint(hash, out);
943-
bool fHadTxInCache = pcoinsTip->HaveCoinsInCache(outpoint);
944-
if (view.HaveCoins(outpoint)) {
945-
if (!fHadTxInCache) {
946-
vHashTxnToUncache.push_back(outpoint);
943+
bool had_coin_in_cache = pcoinsTip->HaveCoinInCache(outpoint);
944+
if (view.HaveCoin(outpoint)) {
945+
if (!had_coin_in_cache) {
946+
coins_to_uncache.push_back(outpoint);
947947
}
948948
return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-known");
949949
}
950950
}
951951

952952
// do all inputs exist?
953953
for (const CTxIn& txin : tx.vin) {
954-
if (!pcoinsTip->HaveCoinsInCache(txin.prevout)) {
955-
vHashTxnToUncache.push_back(txin.prevout);
954+
if (!pcoinsTip->HaveCoinInCache(txin.prevout)) {
955+
coins_to_uncache.push_back(txin.prevout);
956956
}
957-
if (!view.HaveCoins(txin.prevout)) {
957+
if (!view.HaveCoin(txin.prevout)) {
958958
if (pfMissingInputs) {
959959
*pfMissingInputs = true;
960960
}
@@ -1133,10 +1133,10 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState &state, const C
11331133
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
11341134
bool* pfMissingInputs, bool fOverrideMempoolLimit, bool fRejectAbsurdFee, bool fIgnoreFees)
11351135
{
1136-
std::vector<COutPoint> vHashTxToUncache;
1137-
bool res = AcceptToMemoryPoolWorker(pool, state, tx, fLimitFree, pfMissingInputs, fOverrideMempoolLimit, fRejectAbsurdFee, fIgnoreFees, vHashTxToUncache);
1136+
std::vector<COutPoint> coins_to_uncache;
1137+
bool res = AcceptToMemoryPoolWorker(pool, state, tx, fLimitFree, pfMissingInputs, fOverrideMempoolLimit, fRejectAbsurdFee, fIgnoreFees, coins_to_uncache);
11381138
if (!res) {
1139-
for (const COutPoint& outpoint: vHashTxToUncache)
1139+
for (const COutPoint& outpoint: coins_to_uncache)
11401140
pcoinsTip->Uncache(outpoint);
11411141
}
11421142
return res;
@@ -1202,14 +1202,14 @@ bool AcceptableInputs(CTxMemPool& pool, CValidationState& state, const CTransact
12021202
// do we already have it?
12031203
for (size_t out = 0; out < tx.vout.size(); out++) {
12041204
COutPoint outpoint(hash, out);
1205-
if (view.HaveCoins(outpoint)) {
1205+
if (view.HaveCoin(outpoint)) {
12061206
return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-known");
12071207
}
12081208
}
12091209

12101210
// do all inputs exist?
12111211
for (const CTxIn& txin : tx.vin) {
1212-
if (!view.HaveCoins(txin.prevout)) {
1212+
if (!view.HaveCoin(txin.prevout)) {
12131213
if (pfMissingInputs) {
12141214
*pfMissingInputs = true;
12151215
}
@@ -1400,7 +1400,7 @@ bool GetTransaction(const uint256& hash, CTransaction& txOut, uint256& hashBlock
14001400

14011401
if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it
14021402
const Coin& coin = AccessByTxid(*pcoinsTip, hash);
1403-
if (!coin.IsPruned()) pindexSlow = chainActive[coin.nHeight];
1403+
if (!coin.IsSpent()) pindexSlow = chainActive[coin.nHeight];
14041404
}
14051405
}
14061406

@@ -1851,7 +1851,7 @@ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoins
18511851
for (unsigned int i = 0; i < tx.vin.size(); i++) {
18521852
const COutPoint &prevout = tx.vin[i].prevout;
18531853
const Coin& coin = inputs.AccessCoin(prevout);
1854-
assert(!coin.IsPruned());
1854+
assert(!coin.IsSpent());
18551855

18561856
// If prev is coinbase, check that it's matured
18571857
if (coin.IsCoinBase() || coin.IsCoinStake()) {
@@ -1904,7 +1904,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
19041904
for (unsigned int i = 0; i < tx.vin.size(); i++) {
19051905
const COutPoint& prevout = tx.vin[i].prevout;
19061906
const Coin& coin = inputs.AccessCoin(prevout);
1907-
assert(!coin.IsPruned());
1907+
assert(!coin.IsSpent());
19081908

19091909
// We very carefully only pass in things to CScriptCheck which
19101910
// are clearly committed to by tx' witness hash. This provides
@@ -2040,14 +2040,14 @@ int ApplyTxInUndo(Coin&& undo, CCoinsViewCache& view, const COutPoint& out)
20402040
{
20412041
bool fClean = true;
20422042

2043-
if (view.HaveCoins(out)) fClean = false; // overwriting transaction output
2043+
if (view.HaveCoin(out)) fClean = false; // overwriting transaction output
20442044

20452045
if (undo.nHeight == 0) {
20462046
// Missing undo metadata (height and coinbase/coinstake). Older versions included this
20472047
// information only in undo records for the last spend of a transactions'
20482048
// outputs. This implies that it must be present for some other output of the same tx.
20492049
const Coin& alternate = AccessByTxid(view, out.hash);
2050-
if (!alternate.IsPruned()) {
2050+
if (!alternate.IsSpent()) {
20512051
undo.nHeight = alternate.nHeight;
20522052
undo.fCoinBase = alternate.fCoinBase;
20532053
undo.fCoinStake = alternate.fCoinStake;
@@ -4040,7 +4040,7 @@ bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex** ppi
40404040
if(!stakeTxIn.HasZerocoinSpendInputs()) {
40414041
for (const CTxIn& in: stakeTxIn.vin) {
40424042
const Coin& coin = coins.AccessCoin(in.prevout);
4043-
if(coin.IsPruned() && !isBlockFromFork){
4043+
if(coin.IsSpent() && !isBlockFromFork){
40444044
// No coins on the main chain
40454045
return error("%s: coin stake inputs not-available/already-spent on main chain, received height %d vs current %d", __func__, nHeight, chainActive.Height());
40464046
}
@@ -4899,8 +4899,8 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
48994899
return recentRejects->contains(inv.hash) ||
49004900
mempool.exists(inv.hash) ||
49014901
mapOrphanTransactions.count(inv.hash) ||
4902-
pcoinsTip->HaveCoinsInCache(COutPoint(inv.hash, 0)) || // Best effort: only try output 0 and 1
4903-
pcoinsTip->HaveCoinsInCache(COutPoint(inv.hash, 1));
4902+
pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 0)) || // Best effort: only try output 0 and 1
4903+
pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 1));
49044904
}
49054905

49064906
case MSG_BLOCK:

0 commit comments

Comments
 (0)