upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4bc9c4d..c3fb33b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -282,6 +282,16 @@ void AddOrphanTx(const CDataStream& vMsg)
282 uint256 hash = tx.GetHash(); 282 uint256 hash = tx.GetHash();
283 if (mapOrphanTransactions.count(hash)) 283 if (mapOrphanTransactions.count(hash))
284 return; 284 return;
285
286 // Do not allow an orphan to have an unbounded number of inputs.
287 // 10,000 inputs is enough for massive legitimate sweeps, but bounds the total
288 // memory in mapOrphanTransactionsByPrev to ~10,000 * MAX_ORPHAN_TRANSACTIONS.
289 if (tx.vin.size() > 10000)
290 {
291 if (LogAcceptsCategory("net")) printf("AddOrphanTx() : orphan with %d inputs rejected\n", (int)tx.vin.size());
292 return;
293 }
294
285 CDataStream* pvMsg = mapOrphanTransactions[hash] = new CDataStream(vMsg); 295 CDataStream* pvMsg = mapOrphanTransactions[hash] = new CDataStream(vMsg);
286 foreach(const CTxIn& txin, tx.vin) 296 foreach(const CTxIn& txin, tx.vin)
287 mapOrphanTransactionsByPrev.insert(make_pair(txin.prevout.hash, pvMsg)); 297 mapOrphanTransactionsByPrev.insert(make_pair(txin.prevout.hash, pvMsg));