MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetCoin

Method GetCoin

src/txmempool.cpp:980–994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

978CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView* baseIn, const CTxMemPool& mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { }
979
980bool CCoinsViewMemPool::GetCoin(const COutPoint &outpoint, CCoins &coin) const {
981 // If an entry in the mempool exists, always return that one, as it's guaranteed to never
982 // conflict with the underlying cache, and it cannot have pruned entries (as it contains full)
983 // transactions. First checking the underlying cache risks returning a pruned entry instead.
984 CTransactionRef ptx = mempool.get(outpoint.hash);
985 if (ptx) {
986 if (outpoint.n < ptx->vout.size()) {
987 coin = CCoins(*ptx, MEMPOOL_HEIGHT);
988 return true;
989 } else {
990 return false;
991 }
992 }
993 return (base->GetCoins(outpoint.hash, coin) /*&& !coin.IsSpent()*/);
994}
995
996bool CCoinsViewMemPool::HaveCoin(const COutPoint &outpoint) const {
997 return mempool.exists(outpoint) || base->HaveCoins(outpoint.hash);

Callers 2

gettxoutFunction · 0.80
CheckSequenceLocksFunction · 0.80

Calls 4

CCoinsClass · 0.70
getMethod · 0.45
sizeMethod · 0.45
GetCoinsMethod · 0.45

Tested by

no test coverage detected