From v0.3.18 to v0.9.0rc2, this value has been 120. The length of pubkey is 33 or 65, that is common sense, the developer is impossible not to know, but why take the 120? at that time must have their reasons, what is the reasons?
Solver() function in script.cpp in v0.3.18 has the following code:
bool Solver(const CScript& scriptPubKey, vector<pair<opcodetype, valtype> >& vSolutionRet)
{
......
// Scan templates
const CScript& script1 = scriptPubKey;
foreach(const CScript& script2, vTemplates)
{
......
loop
{
......
if (opcode2 == OP_PUBKEY)
{
if (vch1.size() < 33 || vch1.size() > 120
break;
vSolutionRet.push_back(make_pair(opcode2, vch1));
}
else if (opcode2 == OP_PUBKEYHASH)
{
if (vch1.size() != sizeof(uint160))
break;
vSolutionRet.push_back(make_pair(opcode2, vch1));
}
else if (opcode1 != opcode2 || vch1 != vch2)
{
break;
}
}
}
vSolutionRet.clear();
return false;
}