MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / HowSpent

Method HowSpent

src/wallet/wallet.cpp:782–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

780}
781
782CWallet::SpendType CWallet::HowSpent(const COutPoint& outpoint) const
783{
784 SpendType st{SpendType::UNSPENT};
785
786 std::pair<TxSpends::const_iterator, TxSpends::const_iterator> range;
787 range = mapTxSpends.equal_range(outpoint);
788
789 for (TxSpends::const_iterator it = range.first; it != range.second; ++it) {
790 const Txid& txid = it->second;
791 const auto mit = mapWallet.find(txid);
792 if (mit != mapWallet.end()) {
793 const auto& wtx = mit->second;
794 if (wtx.isConfirmed()) return SpendType::CONFIRMED;
795 if (wtx.InMempool()) {
796 st = SpendType::MEMPOOL;
797 } else if (!wtx.isAbandoned() && !wtx.isBlockConflicted() && !wtx.isMempoolConflicted()) {
798 if (st == SpendType::UNSPENT) st = SpendType::NONMEMPOOL;
799 }
800 }
801 }
802 return st;
803}
804
805void CWallet::AddToSpends(const COutPoint& outpoint, const Txid& txid)
806{

Callers 1

GetBalanceFunction · 0.80

Calls 7

findMethod · 0.80
isConfirmedMethod · 0.80
InMempoolMethod · 0.80
isAbandonedMethod · 0.80
isBlockConflictedMethod · 0.80
isMempoolConflictedMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected