aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGavin Andresen <[email protected]>2011-08-08 11:16:40 -0700
committerGavin Andresen <[email protected]>2011-08-08 11:16:40 -0700
commit4e5d88ce26b7829856e206107fd82e99d58b4211 (patch)
treea2e5e4711d97a4c8ac83834089a98e4b1bca3f42 /src
parentMerge branch 'tmp2' (diff)
parentCheck for duplicate txins in CheckTransaction. (diff)
downloaddiscoin-4e5d88ce26b7829856e206107fd82e99d58b4211.tar.xz
discoin-4e5d88ce26b7829856e206107fd82e99d58b4211.zip
Merge pull request #443 from TheBlueMatt/dupin
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 b57974f57..dccc1727f 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)