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.
This commit is contained in:
parent
61d270957e
commit
50173b865b
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue