diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-11-13 23:03:25 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-11-15 23:00:16 +0100 |
commit | 99d0d0f356c3237ad1ef416f179c45797cecb89b (patch) | |
tree | 72c34c5fe86b95be861f02fdfe5e497f24b56117 /src/main.cpp | |
parent | 6caffb5358b1e403b293846b3c832433fa928e46 (diff) | |
download | bitcoin-99d0d0f356c3237ad1ef416f179c45797cecb89b.tar.xz |
Introduce script verification flags
These flags select features to be enabled/disabled during script
evaluation/checking, instead of several booleans passed along.
Currently these flags are defined:
* SCRIPT_VERIFY_P2SH: enable BIP16-style subscript evaluation
* SCRIPT_VERIFY_STRICTENC: enforce strict adherence to pubkey/sig encoding standards.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index f0bf4755b7..56012a131a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -771,7 +771,7 @@ bool CTxMemPool::accept(CTransaction &tx, bool fCheckInputs, // Check against previous transactions // This is done last to help prevent CPU exhaustion denial-of-service attacks. - if (!tx.CheckInputs(view, CS_ALWAYS, true, false)) + if (!tx.CheckInputs(view, CS_ALWAYS, SCRIPT_VERIFY_P2SH)) { return error("CTxMemPool::accept() : ConnectInputs failed %s", hash.ToString().substr(0,10).c_str()); } @@ -1327,7 +1327,7 @@ bool CTransaction::HaveInputs(CCoinsViewCache &inputs) const return true; } -bool CTransaction::CheckInputs(CCoinsViewCache &inputs, enum CheckSig_mode csmode, bool fStrictPayToScriptHash, bool fStrictEncodings) const +bool CTransaction::CheckInputs(CCoinsViewCache &inputs, enum CheckSig_mode csmode, unsigned int flags) const { if (!IsCoinBase()) { @@ -1384,7 +1384,7 @@ bool CTransaction::CheckInputs(CCoinsViewCache &inputs, enum CheckSig_mode csmod const CCoins &coins = inputs.GetCoins(prevout.hash); // Verify signature - if (!VerifySignature(coins, *this, i, fStrictPayToScriptHash, fStrictEncodings, 0)) + if (!VerifySignature(coins, *this, i, flags, 0)) return DoS(100,error("CheckInputs() : %s VerifySignature failed", GetHash().ToString().substr(0,10).c_str())); } } @@ -1415,7 +1415,7 @@ bool CTransaction::ClientCheckInputs() const return false; // Verify signature - if (!VerifySignature(CCoins(txPrev, -1), *this, i, true, false, 0)) + if (!VerifySignature(CCoins(txPrev, -1), *this, i, SCRIPT_VERIFY_P2SH, 0)) return error("ConnectInputs() : VerifySignature failed"); ///// this is redundant with the mempool.mapNextTx stuff, @@ -1598,7 +1598,7 @@ bool CBlock::ConnectBlock(CBlockIndex* pindex, CCoinsViewCache &view, bool fJust nFees += tx.GetValueIn(view)-tx.GetValueOut(); - if (!tx.CheckInputs(view, CS_AFTER_CHECKPOINT, fStrictPayToScriptHash, false)) + if (!tx.CheckInputs(view, CS_AFTER_CHECKPOINT, fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE)) return false; } @@ -3863,7 +3863,7 @@ CBlock* CreateNewBlock(CReserveKey& reservekey) if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS) continue; - if (!tx.CheckInputs(viewTemp, CS_ALWAYS, true, false)) + if (!tx.CheckInputs(viewTemp, CS_ALWAYS, SCRIPT_VERIFY_P2SH)) continue; CTxUndo txundo; |