Author

Topic: Why is the maximum length of pubkey 120,not 100 or other? (Read 497 times)

newbie
Activity: 6
Merit: 0
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?

Code:
Solver() function in script.cpp in v0.3.18 has the following code: 
bool Solver(const CScript& scriptPubKey, vector >& 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;
}

full member
Activity: 144
Merit: 100
That was changed in a Feb 21 git commit (595b6d8); in the next release the maximum pubkey size will be 65. (Pubkeys are exactly 33 or 65 bytes, depending on whether they're "compressed").
newbie
Activity: 6
Merit: 0
 IsStandard() function in script.cpp has the following code:

Code:
            // Template matching opcodes:
            if (opcode2 == OP_PUBKEYS)
            {
                while (vch1.size() >= 33 && vch1.size() <= 120)
                {

there,Why is the maximum size of pubkey 120,not 100 or other?

Jump to: