mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 06:39:15 +02:00
[refactor] TxOrphanage::HaveTx only by wtxid
This commit is contained in:
@@ -2297,7 +2297,7 @@ bool PeerManagerImpl::AlreadyHaveTx(const GenTxid& gtxid, bool include_reconside
|
||||
|
||||
if (gtxid.IsWtxid()) {
|
||||
// Normal query by wtxid.
|
||||
if (m_orphanage.HaveTx(gtxid)) return true;
|
||||
if (m_orphanage.HaveTx(Wtxid::FromUint256(hash))) return true;
|
||||
} else {
|
||||
// Never query by txid: it is possible that the transaction in the orphanage has the same
|
||||
// txid but a different witness, which would give us a false positive result. If we decided
|
||||
@@ -2307,7 +2307,7 @@ bool PeerManagerImpl::AlreadyHaveTx(const GenTxid& gtxid, bool include_reconside
|
||||
// While we won't query by txid, we can try to "guess" what the wtxid is based on the txid.
|
||||
// A non-segwit transaction's txid == wtxid. Query this txid "casted" to a wtxid. This will
|
||||
// help us find non-segwit transactions, saving bandwidth, and should have no false positives.
|
||||
if (m_orphanage.HaveTx(GenTxid::Wtxid(hash))) return true;
|
||||
if (m_orphanage.HaveTx(Wtxid::FromUint256(hash))) return true;
|
||||
}
|
||||
|
||||
if (include_reconsiderable && m_recent_rejects_reconsiderable.contains(hash)) return true;
|
||||
|
||||
Reference in New Issue
Block a user