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

Method IsSpent

src/wallet.cpp:620–636  ·  view source on GitHub ↗

* Outpoint is spent if any non-conflicted transaction * spends it: */

Source from the content-addressed store, hash-verified

618 * spends it:
619 */
620bool CWallet::IsSpent(const uint256& hash, unsigned int n) const
621{
622 const COutPoint outpoint(hash, n);
623 pair<TxSpends::const_iterator, TxSpends::const_iterator> range;
624 range = mapTxSpends.equal_range(outpoint);
625
626 for (TxSpends::const_iterator it = range.first; it != range.second; ++it) {
627 const uint256& wtxid = it->second;
628 std::map<uint256, CWalletTx>::const_iterator mit = mapWallet.find(wtxid);
629 if (mit != mapWallet.end()) {
630 int depth = mit->second.GetDepthInMainChain();
631 if (depth > 0 || (depth == 0 && !mit->second.isAbandoned()))
632 return true; // Spent
633 }
634 }
635 return false;
636}
637
638void CWallet::AddToSpends(const COutPoint& outpoint, const uint256& wtxid)
639{

Callers 7

ProcessBlockFoundFunction · 0.45
GetAvailableCreditMethod · 0.45
GetAnonymizableCreditMethod · 0.45
GetAnonymizedCreditMethod · 0.45
GetDenominatedCreditMethod · 0.45
isSpentMethod · 0.45

Calls 5

isAbandonedMethod · 0.80
equal_rangeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
GetDepthInMainChainMethod · 0.45

Tested by

no test coverage detected