@ -360,35 +360,43 @@ func (c *Config) parsePersistentNodes(path string) []*discover.Node {
return nodes
}
func makeAccountManager ( conf * Config ) ( * accounts . Manager , string , error ) {
// AccountConfig determines the settings for scrypt and keydirectory
func ( c * Config ) AccountConfig ( ) ( int , int , string , error ) {
scryptN := keystore . StandardScryptN
scryptP := keystore . StandardScryptP
if conf . UseLightweightKDF {
if c . UseLightweightKDF {
scryptN = keystore . LightScryptN
scryptP = keystore . LightScryptP
}
var (
keydir string
ephemeral string
err error
keydir string
err error
)
switch {
case filepath . IsAbs ( conf . KeyStoreDir ) :
keydir = conf . KeyStoreDir
case conf . DataDir != "" :
if conf . KeyStoreDir == "" {
keydir = filepath . Join ( conf . DataDir , datadirDefaultKeyStore )
case filepath . IsAbs ( c . KeyStoreDir ) :
keydir = c . KeyStoreDir
case c . DataDir != "" :
if c . KeyStoreDir == "" {
keydir = filepath . Join ( c . DataDir , datadirDefaultKeyStore )
} else {
keydir , err = filepath . Abs ( conf . KeyStoreDir )
keydir , err = filepath . Abs ( c . KeyStoreDir )
}
case conf . KeyStoreDir != "" :
keydir , err = filepath . Abs ( conf . KeyStoreDir )
default :
case c . KeyStoreDir != "" :
keydir , err = filepath . Abs ( c . KeyStoreDir )
}
return scryptN , scryptP , keydir , err
}
func makeAccountManager ( conf * Config ) ( * accounts . Manager , string , error ) {
scryptN , scryptP , keydir , err := conf . AccountConfig ( )
var ephemeral string
if keydir == "" {
// There is no datadir.
keydir , err = ioutil . TempDir ( "" , "go-ethereum-keystore" )
ephemeral = keydir
}
if err != nil {
return nil , "" , err
}