From 50173b865bd352e1dd9c6308027127c750076196 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 20 Feb 2014 01:46:56 -0600 Subject: [PATCH] Allow push of 0 via new ScriptBuilder PushInt64. Nothing was being pushed for 0 to the new ScriptBuilder due to the fact Go big integers when set to 0 have no bytes. --- scriptbuilder.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scriptbuilder.go b/scriptbuilder.go index a029849b5..d7980621b 100644 --- a/scriptbuilder.go +++ b/scriptbuilder.go @@ -88,6 +88,10 @@ func (b *ScriptBuilder) PushData(data []byte) *ScriptBuilder { // PushInt64 pushes the passed integer to the end of the script. func (b *ScriptBuilder) PushInt64(val int64) *ScriptBuilder { // Fast path for small integers and OP_1NEGATE. + if val == 0 { + b.script = append(b.script, OP_0) + return b + } if val == -1 || (val >= 1 && val <= 16) { b.script = append(b.script, byte((OP_1-1)+val)) return b