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