Skip to content

Commit

Permalink
refactoring(spv-790) added one more check for nil
Browse files Browse the repository at this point in the history
  • Loading branch information
augustync committed May 24, 2024
1 parent 576f639 commit 42d6ecb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion engine/types/type42/linking_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ func calculateDedicatedPublicKey(hmacResult []byte, receiverPubKey *bec.PublicKe
// with use of invoiceNumber as reference of this derivation.
func DeriveLinkedKey(source bec.PublicKey, linkPubKey bec.PublicKey, invoiceNumber string) (*bec.PublicKey, error) {
// Check for nil receiver public key
if source.X == nil || source.Y == nil {
return nil, errors.New("source public key is nil")
}
if linkPubKey.X == nil || linkPubKey.Y == nil {
return nil, fmt.Errorf("receiver public key is nil")
return nil, errors.New("receiver public key is nil")
}

// Compute the shared secret
Expand Down

0 comments on commit 42d6ecb

Please sign in to comment.