From 8923edfc1f12ebc6a074651c084ba7d249074799 Mon Sep 17 00:00:00 2001 From: glozow Date: Mon, 29 Apr 2024 16:40:28 +0100 Subject: [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. --- src/txorphanage.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/txorphanage.h') 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 m_orphans GUARDED_BY(m_mutex); + std::map m_orphans GUARDED_BY(m_mutex); /** Which peer provided the orphans that need to be reconsidered */ - std::map> m_peer_work_set GUARDED_BY(m_mutex); + std::map> 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 m_orphan_list GUARDED_BY(m_mutex); - /** Index from wtxid into the m_orphans to lookup orphan - * transactions using their witness ids. */ - std::map m_wtxid_to_orphan_it GUARDED_BY(m_mutex); - /** Erase an orphan by wtxid */ int EraseTxNoLock(const Wtxid& wtxid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex); }; -- cgit v1.2.3