aboutsummaryrefslogtreecommitdiff
path: root/src/txorphanage.h
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2024-04-29 16:40:28 +0100
committerglozow <gloriajzhao@gmail.com>2024-05-14 10:32:28 +0100
commit8923edfc1f12ebc6a074651c084ba7d249074799 (patch)
tree2d5267b67f068bbdd8d2eef9cd85b48909f233e9 /src/txorphanage.h
parentc31f148166f01a9167d82501a77823785d28a841 (diff)
downloadbitcoin-8923edfc1f12ebc6a074651c084ba7d249074799.tar.xz
[p2p] allow entries with the same txid in TxOrphanage
Index by wtxid instead of txid to allow entries with the same txid but different witnesses in orphanage. This prevents an attacker from blocking a transaction from entering the orphanage by sending a mutated version of it.
Diffstat (limited to 'src/txorphanage.h')
-rw-r--r--src/txorphanage.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/txorphanage.h b/src/txorphanage.h
index a549fc7f9b..5f9888c969 100644
--- a/src/txorphanage.h
+++ b/src/txorphanage.h
@@ -77,12 +77,12 @@ protected:
size_t list_pos;
};
- /** Map from txid to orphan transaction record. Limited by
+ /** Map from wtxid to orphan transaction record. Limited by
* -maxorphantx/DEFAULT_MAX_ORPHAN_TRANSACTIONS */
- std::map<Txid, OrphanTx> m_orphans GUARDED_BY(m_mutex);
+ std::map<Wtxid, OrphanTx> m_orphans GUARDED_BY(m_mutex);
/** Which peer provided the orphans that need to be reconsidered */
- std::map<NodeId, std::set<Txid>> m_peer_work_set GUARDED_BY(m_mutex);
+ std::map<NodeId, std::set<Wtxid>> m_peer_work_set GUARDED_BY(m_mutex);
using OrphanMap = decltype(m_orphans);
@@ -102,10 +102,6 @@ protected:
/** Orphan transactions in vector for quick random eviction */
std::vector<OrphanMap::iterator> m_orphan_list GUARDED_BY(m_mutex);
- /** Index from wtxid into the m_orphans to lookup orphan
- * transactions using their witness ids. */
- std::map<Wtxid, OrphanMap::iterator> m_wtxid_to_orphan_it GUARDED_BY(m_mutex);
-
/** Erase an orphan by wtxid */
int EraseTxNoLock(const Wtxid& wtxid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex);
};