From e570fb8d7512d87aac7873cf0e7069bcb36f985c Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sat, 30 Mar 2019 22:32:59 -0500 Subject: [PATCH] txscript: Remove checks for impossible conditions. This removes a couple of checks for impossible conditions found by the staticcheck linter. In the case of executeOpcode, bytes are always >= 0 and, similarly for SigCache.Add, uint are always >= 0. --- txscript/engine.go | 2 +- txscript/sigcache.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/txscript/engine.go b/txscript/engine.go index bf738a6c..48ec9483 100644 --- a/txscript/engine.go +++ b/txscript/engine.go @@ -296,7 +296,7 @@ func (vm *Engine) executeOpcode(op *opcode, data []byte) error { } // Ensure all executed data push opcodes use the minimal encoding. - if vm.isBranchExecuting() && op.value >= 0 && op.value <= OP_PUSHDATA4 { + if vm.isBranchExecuting() && op.value <= OP_PUSHDATA4 { if err := checkMinimalDataPush(op, data); err != nil { return err } diff --git a/txscript/sigcache.go b/txscript/sigcache.go index 1d38a340..d0008c9e 100644 --- a/txscript/sigcache.go +++ b/txscript/sigcache.go @@ -79,7 +79,7 @@ func (s *SigCache) Add(sigHash chainhash.Hash, sig chainec.Signature, pubKey cha s.Lock() defer s.Unlock() - if s.maxEntries <= 0 { + if s.maxEntries == 0 { return }