Skip to content

Commit

Permalink
btcec/ecdsa: remove error return value for SignCompact (#2211)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiangxu authored Jul 10, 2024
1 parent d881c68 commit e5d15fd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion btcec/ecdsa/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func BenchmarkSignCompact(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = SignCompact(privKey, msgHash, true)
_ = SignCompact(privKey, msgHash, true)
}
}

Expand Down
4 changes: 2 additions & 2 deletions btcec/ecdsa/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ func ParseDERSignature(sigStr []byte) (*Signature, error) {
// <(byte of 27+public key solution)+4 if compressed >< padded bytes for signature R><padded bytes for signature S>
// where the R and S parameters are padde up to the bitlengh of the curve.
func SignCompact(key *btcec.PrivateKey, hash []byte,
isCompressedKey bool) ([]byte, error) {
isCompressedKey bool) []byte {

return secp_ecdsa.SignCompact(key, hash, isCompressedKey), nil
return secp_ecdsa.SignCompact(key, hash, isCompressedKey)
}

// RecoverCompact verifies the compact signature "signature" of "hash" for the
Expand Down
6 changes: 1 addition & 5 deletions btcec/ecdsa/signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,7 @@ func testSignCompact(t *testing.T, tag string, curve *btcec.KoblitzCurve,
priv, _ := btcec.NewPrivateKey()

hashed := []byte("testing")
sig, err := SignCompact(priv, hashed, isCompressed)
if err != nil {
t.Errorf("%s: error signing: %s", tag, err)
return
}
sig := SignCompact(priv, hashed, isCompressed)

pk, wasCompressed, err := RecoverCompact(sig, hashed)
if err != nil {
Expand Down

1 comment on commit e5d15fd

@rothcold
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are crazy. Why remove a return value for a exist function?

Please sign in to comment.