Skip to content

Commit

Permalink
Raise maxStandardSigScriptSize to 1650.
Browse files Browse the repository at this point in the history
This commit raises the maximum allowed size for a standard signature
script to cover a 15-of-15 multi-signature pay-to-script-hash with
compressed pubkeys.

This mirrors a recent change to remain compatible with Bitcoin Core.

ok @owinga who also helped verify and correct the script math.

Closes #128.
  • Loading branch information
davecgh committed May 23, 2014
1 parent bcc7856 commit 6d8b873
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,22 @@ const (

// maxStandardSigScriptSize is the maximum size allowed for a
// transaction input signature script to be considered standard. This
// value allows for a CHECKMULTISIG pay-to-sript-hash with 3 signatures
// since each signature is about 80-bytes, the 3 corresponding public
// keys are 65-bytes each if uncompressed, and the script opcodes take
// a few extra bytes. This value also adds a few extra bytes for
// prosperity. 3*80 + 3*65 + 65 = 500
maxStandardSigScriptSize = 500
// value allows for a 15-of-15 CHECKMULTISIG pay-to-script-hash with
// compressed keys.
//
// The form of the overall script is: OP_0 <15 signatures> OP_PUSHDATA2
// <2 bytes len> [OP_15 <15 pubkeys> OP_15 OP_CHECKMULTISIG]
//
// For the p2sh script portion, each of the 15 compressed pubkeys are
// 33 bytes (plus one for the OP_DATA_33 opcode), and the thus it totals
// to (15*34)+3 = 513 bytes. Next, each of the 15 signatures is a max
// of 73 bytes (plus one for the OP_DATA_73 opcode). Also, there is one
// extra byte for the initial extra OP_0 push and 3 bytes for the
// OP_PUSHDATA2 needed to specify the 513 bytes for the script push.
// That brings the total to 1+(15*74)+3+513 = 1627. This value also
// adds a few extra bytes to provide a little buffer.
// (1 + 15*74 + 3) + (15*34 + 3) + 23 = 1650
maxStandardSigScriptSize = 1650

// maxStandardMultiSigKeys is the maximum number of public keys allowed
// in a multi-signature transaction output script for it to be
Expand Down

0 comments on commit 6d8b873

Please sign in to comment.