MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetPeginSpent

Method SetPeginSpent

src/coins.cpp:211–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211void CCoinsViewCache::SetPeginSpent(const std::pair<uint256, COutPoint> &outpoint, bool fSpent) {
212 assert(!outpoint.second.hash.IsNull());
213 assert(!outpoint.first.IsNull());
214
215 CCoinsMap::iterator it = cacheCoins.find(outpoint);
216
217 bool hadSpent;
218 if (it == cacheCoins.end())
219 hadSpent = base->IsPeginSpent(outpoint);
220 else
221 hadSpent = it->second.peginSpent;
222
223 // If we aren't changing spentness, don't do anything at all
224 if (hadSpent == fSpent)
225 return;
226
227 if (it == cacheCoins.end()) {
228 bool inserted;
229 std::tie(it, inserted) = cacheCoins.emplace(std::piecewise_construct,
230 std::forward_as_tuple(outpoint), std::tuple<>());
231 if (!hadSpent)
232 it->second.flags = CCoinsCacheEntry::FRESH;
233 }
234 it->second.peginSpent = fSpent;
235 it->second.flags |= CCoinsCacheEntry::PEGIN | CCoinsCacheEntry::DIRTY;
236}
237
238// END ELEMENTS
239//

Callers 3

UpdateCoinsFunction · 0.80
ApplyTxInUndoFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 4

findMethod · 0.80
IsNullMethod · 0.45
endMethod · 0.45
IsPeginSpentMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64