MCPcopy Create free account
hub / github.com/ElementsProject/elements / AlreadyHaveTx

Method AlreadyHaveTx

src/net_processing.cpp:1688–1709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1686
1687
1688bool 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
1711bool PeerManagerImpl::AlreadyHaveBlock(const uint256& block_hash)
1712{

Callers

nothing calls this directly

Calls 7

HaveTxMethod · 0.80
GetBlockHashMethod · 0.45
TipMethod · 0.45
resetMethod · 0.45
GetHashMethod · 0.45
containsMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected