keychain: use fast scrypt options for unit tests
This commit is contained in:
parent
1cb52491a3
commit
29ece5fe24
@ -11,6 +11,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcwallet/snacl"
|
||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||
"github.com/btcsuite/btcwallet/wallet"
|
||||
"github.com/btcsuite/btcwallet/walletdb"
|
||||
@ -41,6 +42,19 @@ var (
|
||||
)
|
||||
|
||||
func createTestBtcWallet(coinType uint32) (func(), *wallet.Wallet, error) {
|
||||
// Instruct waddrmgr to use the cranked down scrypt parameters when
|
||||
// creating new wallet encryption keys.
|
||||
fastScrypt := waddrmgr.FastScryptOptions
|
||||
keyGen := func(passphrase *[]byte, config *waddrmgr.ScryptOptions) (
|
||||
*snacl.SecretKey, error) {
|
||||
|
||||
return snacl.NewSecretKey(
|
||||
passphrase, fastScrypt.N, fastScrypt.R, fastScrypt.P,
|
||||
)
|
||||
}
|
||||
waddrmgr.SetSecretKeyGen(keyGen)
|
||||
|
||||
// Create a new test wallet that uses fast scrypt as KDF.
|
||||
tempDir, err := ioutil.TempDir("", "keyring-lnwallet")
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user