Assert CPubKey::ValidLength to the pubkey's header-relevent size

Previously this was an inline test where the specificity was probably judged
overly specific. As a class method it makes sense to maintain consistency.

And replace some magic values with their constant equivalents.
This commit is contained in:
Ben Woosley
2018-02-16 20:28:03 +00:00
parent 4a62ddd018
commit f8c249ab91
4 changed files with 12 additions and 7 deletions
+2 -2
View File
@@ -132,7 +132,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::v
// Template matching opcodes:
if (opcode2 == OP_PUBKEYS)
{
while (vch1.size() >= 33 && vch1.size() <= 65)
while (CPubKey::ValidSize(vch1))
{
vSolutionsRet.push_back(vch1);
if (!script1.GetOp(pc1, opcode1, vch1))
@@ -146,7 +146,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::v
if (opcode2 == OP_PUBKEY)
{
if (vch1.size() < 33 || vch1.size() > 65)
if (!CPubKey::ValidSize(vch1))
break;
vSolutionsRet.push_back(vch1);
}