Skip to content

Commit

Permalink
chore(SPV-000): bump go-sdk to v1.1.10 (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-4chain authored Oct 29, 2024
1 parent aa64c8d commit 45681a8
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion engine/model_access_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type AccessKey struct {
// newAccessKey will start a new model
func newAccessKey(xPubID string, opts ...ModelOps) *AccessKey {
privateKey, _ := primitives.NewPrivateKey()
publicKey := hex.EncodeToString(privateKey.PubKey().SerializeCompressed())
publicKey := hex.EncodeToString(privateKey.PubKey().Compressed())
id := utils.Hash(publicKey)

return &AccessKey{
Expand Down
2 changes: 1 addition & 1 deletion engine/model_access_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Test_newAccessKey(t *testing.T) {
assert.IsType(t, ec.PrivateKey{}, *privateKey)
publicKey := privateKey.PubKey()
assert.IsType(t, ec.PublicKey{}, *publicKey)
id := utils.Hash(hex.EncodeToString(publicKey.SerializeCompressed()))
id := utils.Hash(hex.EncodeToString(publicKey.Compressed()))
assert.Equal(t, id, key.ID)
})

Expand Down
2 changes: 1 addition & 1 deletion engine/model_draft_transactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ func TestDraftTransaction_SignInputs(t *testing.T) {
unlocker := input.UnlockingScript.ToASM()
require.NoError(t, err)
scriptParts := strings.Split(unlocker, " ")
pubKey := hex.EncodeToString(privateKey.PubKey().SerializeCompressed())
pubKey := hex.EncodeToString(privateKey.PubKey().Compressed())

var hash []byte
hash, err = tx.CalcInputSignatureHash(0, sighash.AllForkID)
Expand Down
2 changes: 1 addition & 1 deletion engine/model_paymail_addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (m *PaymailAddress) GetPubKey() (string, error) {
return "", spverrors.Wrapf(err, "failed to get public key")
}

return hex.EncodeToString(pubKey.SerializeCompressed()), nil
return hex.EncodeToString(pubKey.Compressed()), nil
}

// GetNextXpub will get the next child xPub for external operations.
Expand Down
4 changes: 2 additions & 2 deletions engine/model_paymail_addresses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestNewPaymail(t *testing.T) {
expectedPubKey, err := expectedHdPubKey.ECPubKey()
require.NoError(t, err)

require.Equal(t, hex.EncodeToString(expectedPubKey.SerializeCompressed()), firstPubKey)
require.Equal(t, hex.EncodeToString(expectedPubKey.Compressed()), firstPubKey)
})

t.Run("RotatePubKey() test", func(t *testing.T) {
Expand Down Expand Up @@ -247,7 +247,7 @@ func TestNewPaymail(t *testing.T) {
expectedPubKey, err := expectedExternalXpub.ECPubKey()
require.NoError(t, err)

require.Equal(t, hex.EncodeToString(expectedPubKey.SerializeCompressed()), secondPubKey)
require.Equal(t, hex.EncodeToString(expectedPubKey.Compressed()), secondPubKey)
})

t.Run("ExternalXPub and PubKey rotation test", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion engine/script/template/evaluate.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func Evaluate(scriptBytes []byte, pubKey *ec.PublicKey) ([]byte, error) {
}

// Serialize the public key to compressed format
dPKBytes := pubKey.SerializeCompressed()
dPKBytes := pubKey.Compressed()

// Apply Hash160 (SHA-256 followed by RIPEMD-160) to the compressed public key
dPKHash, err := utils.Hash160(dPKBytes)
Expand Down
2 changes: 1 addition & 1 deletion engine/script/template/p2pkh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestEvaluate(t *testing.T) {
assert.NoError(t, err)
mockPublicKey, err := ec.ParsePubKey(pubKeyBytes)
assert.NoError(t, err)
mockPubKeyHash := crypto.Hash160(mockPublicKey.SerializeCompressed())
mockPubKeyHash := crypto.Hash160(mockPublicKey.Compressed())

t.Run("Valid Cases", func(t *testing.T) {
validTests := []struct {
Expand Down
2 changes: 1 addition & 1 deletion engine/types/type42/linking_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func DeriveLinkedKey(source *ec.PublicKey, linkPubKey *ec.PublicKey, invoiceNumb
}

// Compute the shared secret
publicKeyBytes := source.SerializeCompressed()
publicKeyBytes := source.Compressed()

// Compute the HMAC result
hmacResult, err := calculateHMAC(publicKeyBytes, invoiceNumber)
Expand Down
2 changes: 1 addition & 1 deletion engine/types/type42/linking_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestDeriveLinkedKey(t *testing.T) {
linkPubKey, err := ec.ParsePubKey(linkPubKeyBytes)
assert.NoError(t, err)

validHMAC, err := calculateHMAC(sourcePubKey.SerializeCompressed(), "valid-invoice")
validHMAC, err := calculateHMAC(sourcePubKey.Compressed(), "valid-invoice")
assert.NoError(t, err)
validDerivedKey, err := calculateLinkedPublicKey(validHMAC, linkPubKey)
assert.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions engine/utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ func TestDerivePublicKey(t *testing.T) {
require.NoError(t, err)
assert.Equal(t,
"03d406421c2733d69a76147c67f8c2194857a2f088299ebf8f1c3790396aa70b4e",
hex.EncodeToString(pubKey.SerializeCompressed()),
hex.EncodeToString(pubKey.Compressed()),
)

pubKey, err = DerivePublicKey(hdKey, 1, 1)
require.NoError(t, err)
assert.Equal(t,
"0263e4a3696fe4e5136536988169bc3fbec730b912ade7988c57098a47a81a0ae1",
hex.EncodeToString(pubKey.SerializeCompressed()),
hex.EncodeToString(pubKey.Compressed()),
)
})
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 45681a8

Please sign in to comment.