From 501b7113011af5bb453c3f7f4baccb432984fdab Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Wed, 19 Jun 2013 00:50:18 +0100 Subject: [PATCH] int.Sign() in go will never return negative for zero. So remove the -0 handling in fromInt, only toInt needs it. --- stack.go | 5 ----- test_coverage.txt | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/stack.go b/stack.go index a1efa8f9..952d5bdb 100644 --- a/stack.go +++ b/stack.go @@ -51,11 +51,6 @@ func fromInt(v *big.Int) []byte { // Int.Bytes() trims leading zeros for us, so we don't have to. b := v.Bytes() if len(b) == 0 { - // negative 0 - if negative { - return []byte{0x80} - } - // normal 0 return []byte{} } arr := make([]byte, len(b)) diff --git a/test_coverage.txt b/test_coverage.txt index 3ccca669..4734c5c1 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -118,8 +118,8 @@ github.com/conformal/btcscript/opcode.go opcodeCheckSig 96.15% (25/26) github.com/conformal/btcscript/script.go NewScript 95.24% (20/21) github.com/conformal/btcscript/address.go ScriptToAddress 94.92% (56/59) github.com/conformal/btcscript/script.go parseScript 93.75% (30/32) +github.com/conformal/btcscript/stack.go fromInt 92.86% (13/14) github.com/conformal/btcscript/script.go Script.Step 89.19% (33/37) -github.com/conformal/btcscript/stack.go fromInt 87.50% (14/16) github.com/conformal/btcscript/script.go typeOfScript 83.33% (5/6) github.com/conformal/btcscript/opcode.go parsedOpcode.exec 80.00% (4/5) github.com/conformal/btcscript/script.go Script.DisasmScript 80.00% (4/5) @@ -135,5 +135,5 @@ github.com/conformal/btcscript/script.go Script.validPC 60.00% (3/5) github.com/conformal/btcscript/script.go Script.Execute 44.44% (8/18) github.com/conformal/btcscript/log.go SetLogWriter 0.00% (0/7) github.com/conformal/btcscript/log.go logClosure.String 0.00% (0/1) -github.com/conformal/btcscript -------------------------- 92.99% (836/899) +github.com/conformal/btcscript -------------------------- 93.09% (835/897)