From 299dcc2fad071d33e5492af381f74dfc630363ae Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 14 Mar 2014 19:22:42 +0000 Subject: [PATCH] PushDataN with a 0 length is valid, we were too tight here. Found by bitcoind positive tests. (but of course that is noncanonical anyway, it should be OP_0 ;). --- script.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script.go b/script.go index 9fa4a68d..b102abc6 100644 --- a/script.go +++ b/script.go @@ -864,7 +864,7 @@ func calcScriptHash(script []parsedOpcode, hashType byte, tx *btcwire.MsgTx, idx // scriptUInt8 return the number stored in the first byte of a slice. func scriptUInt8(script []byte) (uint, error) { - if len(script) <= 1 { + if len(script) < 1 { return 0, StackErrShortScript } return uint(script[0]), nil @@ -872,7 +872,7 @@ func scriptUInt8(script []byte) (uint, error) { // scriptUInt16 returns the number stored in the next 2 bytes of a slice. func scriptUInt16(script []byte) (uint, error) { - if len(script) <= 2 { + if len(script) < 2 { return 0, StackErrShortScript } // Yes this is little endian @@ -881,7 +881,7 @@ func scriptUInt16(script []byte) (uint, error) { // scriptUInt32 returns the number stored in the first 4 bytes of a slice. func scriptUInt32(script []byte) (uint, error) { - if len(script) <= 4 { + if len(script) < 4 { return 0, StackErrShortScript } // Yes this is little endian