From 58ecb31710eccfdaf3ee4ed3086638b4381b4912 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Thu, 17 Apr 2014 23:02:33 +0100 Subject: [PATCH] wallet: use btcec.PrivKeyFromBytes --- wallet/wallet.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/wallet/wallet.go b/wallet/wallet.go index 0060ad9..f7a0b04 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -106,17 +106,12 @@ func binaryWrite(w io.Writer, order binary.ByteOrder, data interface{}) (n int64 // 32-byte privkey. The returned pubkey is 33 bytes if compressed, // or 65 bytes if uncompressed. func pubkeyFromPrivkey(privkey []byte, compress bool) (pubkey []byte) { - x, y := btcec.S256().ScalarBaseMult(privkey) - pub := &btcec.PublicKey{ - Curve: btcec.S256(), - X: x, - Y: y, - } + _, pk := btcec.PrivKeyFromBytes(btcec.S256(), privkey) if compress { - return pub.SerializeCompressed() + return pk.SerializeCompressed() } - return pub.SerializeUncompressed() + return pk.SerializeUncompressed() } func keyOneIter(passphrase, salt []byte, memReqts uint64) []byte {