Skip to content

Commit

Permalink
panic when sign is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickstar619 committed Apr 16, 2019
1 parent 33816fc commit 86e6941
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions types/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ var (
ErrInvalidchainID = errors.New("invalid chain id for signer")
//ErrSigUnprotected signature is considered unprotected
ErrSigUnprotected = errors.New("signature is considered unprotected")
//ErrSignEmpty signature is considered unprotected
ErrSignEmpty = errors.New("signature is nil")
)

// sigCache is used to cache the derived sender and contains the signer used to derive it.
Expand Down Expand Up @@ -127,6 +129,9 @@ func (s Signer) Equal(s2 Signer) bool {
var big8 = big.NewInt(8)

func (s Signer) PubKeys(a *Action, tx *Transaction) ([]common.PubKey, error) {
if len(a.GetSign()) == 0 {
return nil, ErrSignEmpty
}
if a.ChainID().Cmp(s.chainID) != 0 {
return nil, ErrInvalidchainID
}
Expand Down

0 comments on commit 86e6941

Please sign in to comment.