From 6dd7785276d5537e16ae546e9d19f32edb7c3591 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sat, 15 Mar 2014 15:01:48 -0500 Subject: [PATCH] Export coinbase script length limits. This commit exports the MinCoinbaseScriptLen and MaxCoinbaseScriptLen constants. --- validate.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/validate.go b/validate.go index 71428570..92a73f19 100644 --- a/validate.go +++ b/validate.go @@ -28,11 +28,11 @@ const ( // the lock time is a uint32, the max is sometime around 2106. lockTimeThreshold uint32 = 5e8 // Tue Nov 5 00:53:20 1985 UTC - // minCoinbaseScriptLen is the minimum length a coinbase script can be. - minCoinbaseScriptLen = 2 + // MinCoinbaseScriptLen is the minimum length a coinbase script can be. + MinCoinbaseScriptLen = 2 - // maxCoinbaseScriptLen is the maximum length a coinbase script can be. - maxCoinbaseScriptLen = 100 + // MaxCoinbaseScriptLen is the maximum length a coinbase script can be. + MaxCoinbaseScriptLen = 100 // medianTimeBlocks is the number of previous blocks which should be // used to calculate the median time used to validate block timestamps. @@ -238,10 +238,10 @@ func CheckTransactionSanity(tx *btcutil.Tx) error { // Coinbase script length must be between min and max length. if IsCoinBase(tx) { slen := len(msgTx.TxIn[0].SignatureScript) - if slen < minCoinbaseScriptLen || slen > maxCoinbaseScriptLen { + if slen < MinCoinbaseScriptLen || slen > MaxCoinbaseScriptLen { str := fmt.Sprintf("coinbase transaction script length "+ "of %d is out of range (min: %d, max: %d)", - slen, minCoinbaseScriptLen, maxCoinbaseScriptLen) + slen, MinCoinbaseScriptLen, MaxCoinbaseScriptLen) return RuleError(str) } } else {