| 517 | } |
| 518 | |
| 519 | std::set<uint256> CWallet::GetConflicts(const uint256& txid) const |
| 520 | { |
| 521 | std::set<uint256> result; |
| 522 | AssertLockHeld(cs_wallet); |
| 523 | |
| 524 | std::map<uint256, CWalletTx>::const_iterator it = mapWallet.find(txid); |
| 525 | if (it == mapWallet.end()) |
| 526 | return result; |
| 527 | const CWalletTx& wtx = it->second; |
| 528 | |
| 529 | std::pair<TxSpends::const_iterator, TxSpends::const_iterator> range; |
| 530 | |
| 531 | for (const CTxIn& txin : wtx.tx->vin) |
| 532 | { |
| 533 | if (mapTxSpends.count(txin.prevout) <= 1) |
| 534 | continue; // No conflict if zero or one spends |
| 535 | range = mapTxSpends.equal_range(txin.prevout); |
| 536 | for (TxSpends::const_iterator _it = range.first; _it != range.second; ++_it) |
| 537 | result.insert(_it->second); |
| 538 | } |
| 539 | return result; |
| 540 | } |
| 541 | |
| 542 | bool CWallet::HasWalletSpend(const uint256& txid) const |
| 543 | { |