aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Corallo <matt@bluematt.me>2011-07-30 23:01:45 +0200
committerMatt Corallo <matt@bluematt.me>2011-07-31 14:20:10 +0200
commit33208fb5575d76a19163e830617eaaf32dbacda8 (patch)
tree0454499fa257f2e44518285897f07b183e370543 /src
parente1f13129e89f46df631f9523eea4c0e0448c9b7b (diff)
downloadbitcoin-33208fb5575d76a19163e830617eaaf32dbacda8.tar.xz
Check for duplicate txins in CheckTransaction.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp9
1 files changed, 9 insertions, 0 deletions
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<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)