aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index bf13e7915..aace382d8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -768,7 +768,7 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn
// Check against previous transactions
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
- if (!tx.CheckInputs(state, view, true, SCRIPT_VERIFY_P2SH))
+ if (!tx.CheckInputs(state, view, true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC))
{
return error("CTxMemPool::accept() : ConnectInputs failed %s", hash.ToString().c_str());
}
@@ -1438,8 +1438,16 @@ bool CTransaction::CheckInputs(CValidationState &state, CCoinsViewCache &inputs,
if (pvChecks) {
pvChecks->push_back(CScriptCheck());
check.swap(pvChecks->back());
- } else if (!check())
+ } else if (!check()) {
+ if (flags & SCRIPT_VERIFY_STRICTENC) {
+ // For now, check whether the failure was caused by non-canonical
+ // encodings or not; if so, don't trigger DoS protection.
+ CScriptCheck check(coins, *this, i, flags & (~SCRIPT_VERIFY_STRICTENC), 0);
+ if (check())
+ return state.Invalid();
+ }
return state.DoS(100,false);
+ }
}
}
}