| 1686 | |
| 1687 | |
| 1688 | bool PeerManagerImpl::AlreadyHaveTx(const GenTxid& gtxid) |
| 1689 | { |
| 1690 | if (m_chainman.ActiveChain().Tip()->GetBlockHash() != hashRecentRejectsChainTip) { |
| 1691 | // If the chain tip has changed previously rejected transactions |
| 1692 | // might be now valid, e.g. due to a nLockTime'd tx becoming valid, |
| 1693 | // or a double-spend. Reset the rejects filter and give those |
| 1694 | // txs a second chance. |
| 1695 | hashRecentRejectsChainTip = m_chainman.ActiveChain().Tip()->GetBlockHash(); |
| 1696 | m_recent_rejects.reset(); |
| 1697 | } |
| 1698 | |
| 1699 | const uint256& hash = gtxid.GetHash(); |
| 1700 | |
| 1701 | if (m_orphanage.HaveTx(gtxid)) return true; |
| 1702 | |
| 1703 | { |
| 1704 | LOCK(m_recent_confirmed_transactions_mutex); |
| 1705 | if (m_recent_confirmed_transactions.contains(hash)) return true; |
| 1706 | } |
| 1707 | |
| 1708 | return m_recent_rejects.contains(hash) || m_mempool.exists(gtxid); |
| 1709 | } |
| 1710 | |
| 1711 | bool PeerManagerImpl::AlreadyHaveBlock(const uint256& block_hash) |
| 1712 | { |