diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-02-25 19:02:30 +0100 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2012-04-04 09:50:48 -0400 |
commit | 60f89779a3586f8afae47bb8e9c374cd5fe7f8b6 (patch) | |
tree | d5e59445bc62847ac9e41443d1f148d1dd9dacaa /src/main.cpp | |
parent | fea0a27ddc30f2d51c386d268499d6c50363c202 (diff) | |
download | bitcoin-60f89779a3586f8afae47bb8e9c374cd5fe7f8b6.tar.xz |
Do not invoke anti-DoS system for invalid BIP16 transactions
Doing so would allow an attack on old nodes, which would relay a
standard transaction spending a BIP16 output in an invalid way,
until reaching a new node, which will disconnect their peer.
Reported by makomk on IRC.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 5c1b138dc3..4316d242f9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1028,7 +1028,15 @@ bool CTransaction::ConnectInputs(MapPrevTx inputs, // Verify signature if (!VerifySignature(txPrev, *this, i, fStrictPayToScriptHash, 0)) + { + // only during transition phase for P2SH: do not invoke (external) + // anti-DoS code for potentially old clients relaying bad P2SH + // transactions + if (fStrictPayToScriptHash && VerifySignature(txPrev, *this, i, false, 0)) + return error("ConnectInputs() : %s P2SH VerifySignature failed", GetHash().ToString().substr(0,10).c_str()); + return error("ConnectInputs() : %s VerifySignature failed", GetHash().ToString().substr(0,10).c_str()); + } // Mark outpoints as spent txindex.vSpent[prevout.n] = posThisTx; |