@@ -43,20 +43,20 @@ CCoinsMap::iterator CCoinsViewCache::FetchCoins(const COutPoint& outpoint) const
4343 if (!base->GetCoins (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 .coins .IsPruned ()) {
46+ if (ret->second .coin .IsPruned ()) {
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;
5050 }
51- cachedCoinsUsage += memusage::DynamicUsage (ret->second .coins );
51+ cachedCoinsUsage += memusage::DynamicUsage (ret->second .coin );
5252 return ret;
5353}
5454
5555bool CCoinsViewCache::GetCoins (const COutPoint& outpoint, Coin& coin) const
5656{
5757 CCoinsMap::const_iterator it = FetchCoins (outpoint);
5858 if (it != cacheCoins.end ()) {
59- coin = it->second .coins ;
59+ coin = it->second .coin ;
6060 return true ;
6161 }
6262 return false ;
@@ -70,17 +70,17 @@ void CCoinsViewCache::AddCoin(const COutPoint& outpoint, Coin&& coin, bool possi
7070 std::tie (it, inserted) = cacheCoins.emplace (std::piecewise_construct, std::forward_as_tuple (outpoint), std::tuple<>());
7171 bool fresh = false ;
7272 if (!inserted) {
73- cachedCoinsUsage -= it->second .coins .DynamicMemoryUsage ();
73+ cachedCoinsUsage -= it->second .coin .DynamicMemoryUsage ();
7474 }
7575 if (!possible_overwrite) {
76- if (!it->second .coins .IsPruned ()) {
76+ if (!it->second .coin .IsPruned ()) {
7777 throw std::logic_error (" Adding new coin that replaces non-pruned entry" );
7878 }
7979 fresh = !(it->second .flags & CCoinsCacheEntry::DIRTY);
8080 }
81- it->second .coins = std::move (coin);
81+ it->second .coin = std::move (coin);
8282 it->second .flags |= CCoinsCacheEntry::DIRTY | (fresh ? CCoinsCacheEntry::FRESH : 0 );
83- cachedCoinsUsage += it->second .coins .DynamicMemoryUsage ();
83+ cachedCoinsUsage += it->second .coin .DynamicMemoryUsage ();
8484}
8585
8686void AddCoins (CCoinsViewCache& cache, const CTransaction& tx, int nHeight)
@@ -97,15 +97,15 @@ void CCoinsViewCache::SpendCoin(const COutPoint& outpoint, Coin* moveout)
9797{
9898 CCoinsMap::iterator it = FetchCoins (outpoint);
9999 if (it == cacheCoins.end ()) return ;
100- cachedCoinsUsage -= it->second .coins .DynamicMemoryUsage ();
100+ cachedCoinsUsage -= it->second .coin .DynamicMemoryUsage ();
101101 if (moveout) {
102- *moveout = std::move (it->second .coins );
102+ *moveout = std::move (it->second .coin );
103103 }
104104 if (it->second .flags & CCoinsCacheEntry::FRESH) {
105105 cacheCoins.erase (it);
106106 } else {
107107 it->second .flags |= CCoinsCacheEntry::DIRTY;
108- it->second .coins .Clear ();
108+ it->second .coin .Clear ();
109109 }
110110}
111111
@@ -117,14 +117,14 @@ const Coin& CCoinsViewCache::AccessCoin(const COutPoint& outpoint) const
117117 if (it == cacheCoins.end ()) {
118118 return coinEmpty;
119119 } else {
120- return it->second .coins ;
120+ return it->second .coin ;
121121 }
122122}
123123
124124bool CCoinsViewCache::HaveCoins (const COutPoint& outpoint) const
125125{
126126 CCoinsMap::const_iterator it = FetchCoins (outpoint);
127- return (it != cacheCoins.end () && !it->second .coins .IsPruned ());
127+ return (it != cacheCoins.end () && !it->second .coin .IsPruned ());
128128}
129129
130130bool CCoinsViewCache::HaveCoinsInCache (const COutPoint& outpoint) const
@@ -152,12 +152,12 @@ 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 .coins .IsPruned ())) {
155+ if (!(it->second .flags & CCoinsCacheEntry::FRESH && it->second .coin .IsPruned ())) {
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 ];
159- entry.coins = std::move (it->second .coins );
160- cachedCoinsUsage += memusage::DynamicUsage (entry.coins );
159+ entry.coin = std::move (it->second .coin );
160+ cachedCoinsUsage += memusage::DynamicUsage (entry.coin );
161161 entry.flags = CCoinsCacheEntry::DIRTY;
162162 // We can mark it FRESH in the parent if it was FRESH in the child
163163 // Otherwise it might have just been flushed from the parent's cache
@@ -170,21 +170,21 @@ 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 .coins .IsPruned ())
173+ if ((it->second .flags & CCoinsCacheEntry::FRESH) && !itUs->second .coin .IsPruned ())
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 .coins .IsPruned ()) {
177+ if ((itUs->second .flags & CCoinsCacheEntry::FRESH) && it->second .coin .IsPruned ()) {
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.
181- cachedCoinsUsage -= memusage::DynamicUsage (itUs->second .coins );
181+ cachedCoinsUsage -= memusage::DynamicUsage (itUs->second .coin );
182182 cacheCoins.erase (itUs);
183183 } else {
184184 // A normal modification.
185- cachedCoinsUsage -= memusage::DynamicUsage (itUs->second .coins );
186- itUs->second .coins = std::move (it->second .coins );
187- cachedCoinsUsage += memusage::DynamicUsage (itUs->second .coins );
185+ cachedCoinsUsage -= memusage::DynamicUsage (itUs->second .coin );
186+ itUs->second .coin = std::move (it->second .coin );
187+ cachedCoinsUsage += memusage::DynamicUsage (itUs->second .coin );
188188 itUs->second .flags |= CCoinsCacheEntry::DIRTY;
189189 // NOTE: It is possible the child has a FRESH flag here in
190190 // the event the entry we found in the parent is pruned. But
@@ -213,7 +213,7 @@ void CCoinsViewCache::Uncache(const COutPoint& outpoint)
213213{
214214 CCoinsMap::iterator it = cacheCoins.find (outpoint);
215215 if (it != cacheCoins.end () && it->second .flags == 0 ) {
216- cachedCoinsUsage -= it->second .coins .DynamicMemoryUsage ();
216+ cachedCoinsUsage -= it->second .coin .DynamicMemoryUsage ();
217217 cacheCoins.erase (it);
218218 }
219219}
0 commit comments