Browse Source

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.
0.8
Pieter Wuille 13 years ago
parent
commit
db9f2e0117
  1. 7
      src/main.cpp

7
src/main.cpp

@ -1138,8 +1138,15 @@ bool CTransaction::ConnectInputs(MapPrevTx inputs,
{ {
// Verify signature // Verify signature
if (!VerifySignature(txPrev, *this, i, fStrictPayToScriptHash, 0)) if (!VerifySignature(txPrev, *this, i, fStrictPayToScriptHash, 0))
{
// only during transition phase for P2SH: do not invoke 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 DoS(100,error("ConnectInputs() : %s VerifySignature failed", GetHash().ToString().substr(0,10).c_str())); return DoS(100,error("ConnectInputs() : %s VerifySignature failed", GetHash().ToString().substr(0,10).c_str()));
} }
}
// Mark outpoints as spent // Mark outpoints as spent
txindex.vSpent[prevout.n] = posThisTx; txindex.vSpent[prevout.n] = posThisTx;

Loading…
Cancel
Save