* Outpoint is spent if any non-conflicted transaction * spends it: */
| 618 | * spends it: |
| 619 | */ |
| 620 | bool 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 | |
| 638 | void CWallet::AddToSpends(const COutPoint& outpoint, const uint256& wtxid) |
| 639 | { |
no test coverage detected