2021-08-14 01:40:35 +02:00
|
|
|
package keychain
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-02-23 14:48:00 +01:00
|
|
|
"github.com/btcsuite/btcd/btcec/v2"
|
2021-08-14 01:40:35 +02:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkDerivePrivKey(t *testing.B) {
|
2022-08-15 15:06:56 +02:00
|
|
|
wallet, err := createTestBtcWallet(t, CoinTypeBitcoin)
|
2022-05-05 22:11:50 +02:00
|
|
|
require.NoError(t, err, "unable to create wallet")
|
2021-08-14 01:40:35 +02:00
|
|
|
|
|
|
|
keyRing := NewBtcWalletKeyRing(wallet, CoinTypeBitcoin)
|
|
|
|
|
|
|
|
var (
|
|
|
|
privKey *btcec.PrivateKey
|
|
|
|
)
|
|
|
|
|
|
|
|
keyDesc := KeyDescriptor{
|
|
|
|
KeyLocator: KeyLocator{
|
|
|
|
Family: KeyFamilyMultiSig,
|
|
|
|
Index: 1,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
t.ReportAllocs()
|
|
|
|
t.ResetTimer()
|
|
|
|
|
|
|
|
for i := 0; i < t.N; i++ {
|
|
|
|
privKey, err = keyRing.DerivePrivKey(keyDesc)
|
|
|
|
}
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.NotNil(t, privKey)
|
|
|
|
}
|