Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mempool: use secp256k1 functions directly. #1213

Merged
merged 1 commit into from
May 23, 2018

Conversation

dnldd
Copy link
Member

@dnldd dnldd commented May 18, 2018

This PR replaces chainec function calls within the mempool package
with the underlining secp256k1 functions. This is in preparation for
removing the chainec package.

This is work towards #1191

pubKeys = append(pubKeys, chainec.Secp256k1.NewPublicKey(pk.Public()).SerializeCompressed())
pk := secp256k1.NewPrivateKey(big.NewInt(int64(chainec.ECTypeSecp256k1)))
pubKeys = append(pubKeys,
secp256k1.NewPublicKey(pk.Public()).SerializeCompressed())
Copy link
Member

Choose a reason for hiding this comment

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

Recall from the previous PR that there is no need to decompose it into X and Y and create a new public key from it. Plus, .Public() is going to be removed. Just cast it.

@@ -101,8 +102,9 @@ func TestCalcMinRequiredTxRelayFee(t *testing.T) {
func TestCheckPkScriptStandard(t *testing.T) {
var pubKeys [][]byte
for i := 0; i < 4; i++ {
pk := chainec.Secp256k1.NewPrivateKey(big.NewInt(int64(chainec.ECTypeSecp256k1)))
pubKeys = append(pubKeys, chainec.Secp256k1.NewPublicKey(pk.Public()).SerializeCompressed())
pk := secp256k1.NewPrivateKey(big.NewInt(int64(chainec.ECTypeSecp256k1)))
Copy link
Member

Choose a reason for hiding this comment

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

I don't see any reason to retain the reference to chainec here. It's just generating a new private key from a fixed value for testing purposes. You can replace it with big.NewInt(0).

This PR replaces chainec function calls within the mempool packagewith the underlining secp256k1 functions. This is in preparation forremoving the chainec package.
@dnldd dnldd force-pushed the remove_mempool_chainecrefs branch from 1375025 to 3c94b98 Compare May 18, 2018 13:12
@davecgh davecgh merged commit 02558ca into decred:master May 23, 2018
@dnldd dnldd deleted the remove_mempool_chainecrefs branch June 4, 2018 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants