mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 18:10:34 +01:00
d926ad1f84
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
36 lines
643 B
Go
36 lines
643 B
Go
package keychain
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/btcsuite/btcd/btcec/v2"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func BenchmarkDerivePrivKey(t *testing.B) {
|
|
wallet, err := createTestBtcWallet(t, CoinTypeBitcoin)
|
|
require.NoError(t, err, "unable to create wallet")
|
|
|
|
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)
|
|
}
|