diff --git a/dcrec/secp256k1/ecdsa/signature_test.go b/dcrec/secp256k1/ecdsa/signature_test.go index 6ec3cffc12..6011aebfaf 100644 --- a/dcrec/secp256k1/ecdsa/signature_test.go +++ b/dcrec/secp256k1/ecdsa/signature_test.go @@ -1,5 +1,5 @@ // Copyright (c) 2013-2016 The btcsuite developers -// Copyright (c) 2015-2022 The Decred developers +// Copyright (c) 2015-2023 The Decred developers // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. @@ -548,6 +548,20 @@ func TestSignAndVerify(t *testing.T) { continue } + // Ensure the R method returns the expected value. + gotSigR := gotSig.R() + if !gotSigR.Equals(wantSigR) { + t.Errorf("%s: unexpected R component -- got %064x, want %064x", + test.name, gotSigR.Bytes(), wantSigR.Bytes()) + } + + // Ensure the S method returns the expected value. + gotSigS := gotSig.S() + if !gotSigS.Equals(wantSigS) { + t.Errorf("%s: unexpected S component -- got %064x, want %064x", + test.name, gotSigS.Bytes(), wantSigS.Bytes()) + } + // Ensure the produced signature verifies. pubKey := privKey.PubKey() if !gotSig.Verify(hash, pubKey) {