keys: simplify end of buffer check

This commit is contained in:
Roman Khimov 2021-08-25 19:26:17 +03:00
parent 4803cc15c7
commit 61ea42c570

View file

@ -8,7 +8,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
gio "io"
"math/big" "math/big"
"github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/btcec"
@ -220,8 +219,7 @@ func (p *PublicKey) DecodeBytes(data []byte) error {
return b.Err return b.Err
} }
b.ReadB() if b.Len() != 0 {
if b.Err != gio.EOF {
return errors.New("extra data") return errors.New("extra data")
} }
return nil return nil