* Outpoint is spent if any non-conflicted transaction * spends it: */
| 631 | * spends it: |
| 632 | */ |
| 633 | bool CWallet::IsSpent(const uint256& hash, unsigned int n) const |
| 634 | { |
| 635 | const COutPoint outpoint(hash, n); |
| 636 | std::pair<TxSpends::const_iterator, TxSpends::const_iterator> range; |
| 637 | range = mapTxSpends.equal_range(outpoint); |
| 638 | |
| 639 | for (TxSpends::const_iterator it = range.first; it != range.second; ++it) |
| 640 | { |
| 641 | const uint256& wtxid = it->second; |
| 642 | std::map<uint256, CWalletTx>::const_iterator mit = mapWallet.find(wtxid); |
| 643 | if (mit != mapWallet.end()) { |
| 644 | int depth = GetTxDepthInMainChain(mit->second); |
| 645 | if (depth > 0 || (depth == 0 && !mit->second.isAbandoned())) |
| 646 | return true; // Spent |
| 647 | } |
| 648 | } |
| 649 | return false; |
| 650 | } |
| 651 | |
| 652 | void CWallet::AddToSpends(const COutPoint& outpoint, const uint256& wtxid, WalletBatch* batch) |
| 653 | { |