| 780 | } |
| 781 | |
| 782 | CWallet::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 | |
| 805 | void CWallet::AddToSpends(const COutPoint& outpoint, const Txid& txid) |
| 806 | { |
no test coverage detected