switch maxDataCarrierSize to public const

This commit is contained in:
Bruno 2015-07-20 14:26:05 +08:00
parent 8fcea82a56
commit 4335ce828c

View file

@ -10,9 +10,9 @@ import (
) )
const ( const (
// maxDataCarrierSize is the maximum number of bytes allowed in pushed // MaxDataCarrierSize is the maximum number of bytes allowed in pushed
// data to be considered a nulldata transaction // data to be considered a nulldata transaction
maxDataCarrierSize = 80 MaxDataCarrierSize = 80
// StandardVerifyFlags are the script flags which are used when // StandardVerifyFlags are the script flags which are used when
// executing transaction scripts to enforce additional checks which // executing transaction scripts to enforce additional checks which
@ -120,7 +120,7 @@ func isMultiSig(pops []parsedOpcode) bool {
func isNullData(pops []parsedOpcode) bool { func isNullData(pops []parsedOpcode) bool {
// A nulldata transaction is either a single OP_RETURN or an // A nulldata transaction is either a single OP_RETURN or an
// OP_RETURN SMALLDATA (where SMALLDATA is a data push up to // OP_RETURN SMALLDATA (where SMALLDATA is a data push up to
// maxDataCarrierSize bytes). // MaxDataCarrierSize bytes).
l := len(pops) l := len(pops)
if l == 1 && pops[0].opcode.value == OP_RETURN { if l == 1 && pops[0].opcode.value == OP_RETURN {
return true return true
@ -129,7 +129,7 @@ func isNullData(pops []parsedOpcode) bool {
return l == 2 && return l == 2 &&
pops[0].opcode.value == OP_RETURN && pops[0].opcode.value == OP_RETURN &&
pops[1].opcode.value <= OP_PUSHDATA4 && pops[1].opcode.value <= OP_PUSHDATA4 &&
len(pops[1].data) <= maxDataCarrierSize len(pops[1].data) <= MaxDataCarrierSize
} }
// scriptType returns the type of the script being inspected from the known // scriptType returns the type of the script being inspected from the known