mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-11 21:04:11 +00:00
fix default --key-store location if --data-dir is custom
This commit is contained in:
parent
d98b3bb32d
commit
e36d2f432a
@ -23,7 +23,7 @@ import
|
||||
],
|
||||
stew/shims/net as stewNet,
|
||||
eth/[common, net/nat, p2p/bootnodes, p2p/enode],
|
||||
"."/[db/select_backend,
|
||||
"."/[db/select_backend,
|
||||
constants, vm_compile_info, version
|
||||
],
|
||||
common/chain_config
|
||||
@ -733,6 +733,11 @@ proc makeConfig*(cmdLine = commandLineParams()): NimbusConf =
|
||||
result.rpcEnabled = result.rpcEnabled or rpcMustEnabled
|
||||
result.wsEnabled = result.wsEnabled or wsMustEnabled
|
||||
|
||||
# see issue #1346
|
||||
if result.keyStore.string == defaultKeystoreDir() and
|
||||
result.dataDir.string != defaultDataDir():
|
||||
result.keyStore = OutDir(result.dataDir.string / "keystore")
|
||||
|
||||
when isMainModule:
|
||||
# for testing purpose
|
||||
discard makeConfig()
|
||||
|
@ -257,5 +257,24 @@ proc configurationMain*() =
|
||||
let pkhex2 = rc2.get.seckey.toRaw.to0xHex
|
||||
check pkhex1 == pkhex2
|
||||
|
||||
test "default key-store and default data-dir":
|
||||
let conf = makeTestConfig()
|
||||
check conf.keyStore.string == conf.dataDir.string / "keystore"
|
||||
|
||||
test "custom key-store and custom data-dir":
|
||||
let conf = makeConfig(@["--key-store:banana", "--data-dir:apple"])
|
||||
check conf.keyStore.string == "banana"
|
||||
check conf.dataDir.string == "apple"
|
||||
|
||||
test "default key-store and custom data-dir":
|
||||
let conf = makeConfig(@["--data-dir:apple"])
|
||||
check conf.dataDir.string == "apple"
|
||||
check conf.keyStore.string == "apple" / "keystore"
|
||||
|
||||
test "custom key-store and default data-dir":
|
||||
let conf = makeConfig(@["--key-store:banana"])
|
||||
check conf.dataDir.string == defaultDataDir()
|
||||
check conf.keyStore.string == "banana"
|
||||
|
||||
when isMainModule:
|
||||
configurationMain()
|
||||
|
Loading…
x
Reference in New Issue
Block a user