wallet: use btcec.PrivKeyFromBytes

This commit is contained in:
Owain G. Ainsworth 2014-04-17 23:02:33 +01:00
parent 49adb8312f
commit 58ecb31710

View file

@ -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, // 32-byte privkey. The returned pubkey is 33 bytes if compressed,
// or 65 bytes if uncompressed. // or 65 bytes if uncompressed.
func pubkeyFromPrivkey(privkey []byte, compress bool) (pubkey []byte) { func pubkeyFromPrivkey(privkey []byte, compress bool) (pubkey []byte) {
x, y := btcec.S256().ScalarBaseMult(privkey) _, pk := btcec.PrivKeyFromBytes(btcec.S256(), privkey)
pub := &btcec.PublicKey{
Curve: btcec.S256(),
X: x,
Y: y,
}
if compress { if compress {
return pub.SerializeCompressed() return pk.SerializeCompressed()
} }
return pub.SerializeUncompressed() return pk.SerializeUncompressed()
} }
func keyOneIter(passphrase, salt []byte, memReqts uint64) []byte { func keyOneIter(passphrase, salt []byte, memReqts uint64) []byte {