changeset 833:2d64c5debf03 draft

Check for duplicate txins in CheckTransaction.
author Matt Corallo <matt@bluematt.me>
date Sat, 30 Jul 2011 23:01:45 +0200
parents eb0d43b3bb67
children da37a88ccbaf
files src/main.cpp
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -314,6 +314,15 @@
             return error("CTransaction::CheckTransaction() : txout total out of range");
     }
 
+    // Check for duplicate inputs
+    set<COutPoint> vInOutPoints;
+    BOOST_FOREACH(const CTxIn& txin, vin)
+    {
+        if (vInOutPoints.count(txin.prevout))
+            return false;
+        vInOutPoints.insert(txin.prevout);
+    }
+
     if (IsCoinBase())
     {
         if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 100)