Skip to content

Commit 97e7901

Browse files
committed
Do not invoke DoS for non-canonical sigs
1 parent 72782f3 commit 97e7901

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,8 +1438,16 @@ bool CTransaction::CheckInputs(CValidationState &state, CCoinsViewCache &inputs,
14381438
if (pvChecks) {
14391439
pvChecks->push_back(CScriptCheck());
14401440
check.swap(pvChecks->back());
1441-
} else if (!check())
1441+
} else if (!check()) {
1442+
if (flags & SCRIPT_VERIFY_STRICTENC) {
1443+
// For now, check whether the failure was caused by non-canonical
1444+
// encodings or not; if so, don't trigger DoS protection.
1445+
CScriptCheck check(coins, *this, i, flags & (~SCRIPT_VERIFY_STRICTENC), 0);
1446+
if (check())
1447+
return state.Invalid();
1448+
}
14421449
return state.DoS(100,false);
1450+
}
14431451
}
14441452
}
14451453
}

0 commit comments

Comments
 (0)