From 33208fb5575d76a19163e830617eaaf32dbacda8 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 30 Jul 2011 23:01:45 +0200 Subject: Check for duplicate txins in CheckTransaction. --- src/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index b57974f577..dccc1727f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -314,6 +314,15 @@ bool CTransaction::CheckTransaction() const return error("CTransaction::CheckTransaction() : txout total out of range"); } + // Check for duplicate inputs + set 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) -- cgit v1.2.3