Merge pull request #2540 from sipa/nodosnocan

Do not invoke DoS for non-canonical sigs
This commit is contained in:
Gavin Andresen 2013-04-19 10:29:37 -07:00
commit ce8de31fbf

View File

@ -1438,11 +1438,19 @@ bool CTransaction::CheckInputs(CValidationState &state, CCoinsViewCache &inputs,
if (pvChecks) { if (pvChecks) {
pvChecks->push_back(CScriptCheck()); pvChecks->push_back(CScriptCheck());
check.swap(pvChecks->back()); 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); return state.DoS(100,false);
} }
} }
} }
}
return true; return true;
} }