mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-13 14:14:00 +01:00
[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.
This commit is contained in:
@@ -30,8 +30,8 @@ public:
|
||||
CTransactionRef RandomOrphan() EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
|
||||
{
|
||||
LOCK(m_mutex);
|
||||
std::map<Txid, OrphanTx>::iterator it;
|
||||
it = m_orphans.lower_bound(Txid::FromUint256(InsecureRand256()));
|
||||
std::map<Wtxid, OrphanTx>::iterator it;
|
||||
it = m_orphans.lower_bound(Wtxid::FromUint256(InsecureRand256()));
|
||||
if (it == m_orphans.end())
|
||||
it = m_orphans.begin();
|
||||
return it->second.tx;
|
||||
|
||||
Reference in New Issue
Block a user