diff options
author | glozow <gloriajzhao@gmail.com> | 2024-04-29 16:40:28 +0100 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2024-05-14 10:32:28 +0100 |
commit | 8923edfc1f12ebc6a074651c084ba7d249074799 (patch) | |
tree | 2d5267b67f068bbdd8d2eef9cd85b48909f233e9 /src/net_processing.cpp | |
parent | c31f148166f01a9167d82501a77823785d28a841 (diff) | |
download | bitcoin-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/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 5ae76e01bf..73c15d76b7 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2302,7 +2302,10 @@ bool PeerManagerImpl::AlreadyHaveTx(const GenTxid& gtxid, bool include_reconside // 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 // not to request the transaction based on this result, an attacker could prevent us from - // downloading a transaction by intentionally creating a malleated version of it. + // downloading a transaction by intentionally creating a malleated version of it. While + // only one (or none!) of these transactions can ultimately be confirmed, we have no way of + // discerning which one that is, so the orphanage can store multiple transactions with the + // same txid. // // 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 |