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.
This commit is contained in:
Dave Collins 2019-03-30 22:32:59 -05:00
parent 51852570e2
commit e570fb8d75
No known key found for this signature in database
GPG Key ID: B8904D9D9C93D1F2
2 changed files with 2 additions and 2 deletions

View File

@ -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
}

View File

@ -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
}