mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-26 03:59:52 +00:00
add new command line options: clique-period, engine-signer, and import-key
new command line options: --clique-period:<value> Enables clique support. value is block time in seconds --engine-signer:<value> Enables mining. value is EthAddress in hex --import-key:<path> Import unencrypted 32 bytes hex private key file fixes #771
This commit is contained in:
parent
e2b50d2339
commit
6015a4e029
@ -136,6 +136,8 @@ type
|
|||||||
importFile*: string
|
importFile*: string
|
||||||
verifyFromOk*: bool ## activate `verifyFrom` setting
|
verifyFromOk*: bool ## activate `verifyFrom` setting
|
||||||
verifyFrom*: uint64 ## verification start block, 0 for disable
|
verifyFrom*: uint64 ## verification start block, 0 for disable
|
||||||
|
cliquePeriod*: int ## Enables clique support, 0 for disable
|
||||||
|
engineSigner*: EthAddress ## Miner account
|
||||||
|
|
||||||
const
|
const
|
||||||
# these are public network id
|
# these are public network id
|
||||||
@ -374,6 +376,33 @@ proc processPruneList(v: string, flags: var PruneMode): ConfigStatus =
|
|||||||
warn "unknown prune flags", name = item
|
warn "unknown prune flags", name = item
|
||||||
result = ErrorIncorrectOption
|
result = ErrorIncorrectOption
|
||||||
|
|
||||||
|
proc processEthAddress(value: string, address: var EthAddress): ConfigStatus =
|
||||||
|
try:
|
||||||
|
address = hexToByteArray[20](value)
|
||||||
|
return Success
|
||||||
|
except CatchableError:
|
||||||
|
return ErrorParseOption
|
||||||
|
|
||||||
|
proc importPrivateKey(conf: NimbusConfiguration, fileName: string): ConfigStatus =
|
||||||
|
|
||||||
|
try:
|
||||||
|
let pkhex = readFile(fileName)
|
||||||
|
let res = PrivateKey.fromHex(pkhex)
|
||||||
|
if res.isErr:
|
||||||
|
error "not a valid private key, expect 32 bytes hex"
|
||||||
|
return ErrorParseOption
|
||||||
|
|
||||||
|
let seckey = res.get()
|
||||||
|
let acc = seckey.toPublicKey().toCanonicalAddress()
|
||||||
|
|
||||||
|
conf.accounts[acc] = NimbusAccount(
|
||||||
|
privateKey: seckey,
|
||||||
|
unlocked: true
|
||||||
|
)
|
||||||
|
|
||||||
|
except CatchableError:
|
||||||
|
return ErrorParseOption
|
||||||
|
|
||||||
proc processEthArguments(key, value: string): ConfigStatus =
|
proc processEthArguments(key, value: string): ConfigStatus =
|
||||||
result = Success
|
result = Success
|
||||||
let config = getConfiguration()
|
let config = getConfiguration()
|
||||||
@ -391,6 +420,12 @@ proc processEthArguments(key, value: string): ConfigStatus =
|
|||||||
result = processUInt64(value, res)
|
result = processUInt64(value, res)
|
||||||
config.verifyFrom = uint64(result)
|
config.verifyFrom = uint64(result)
|
||||||
config.verifyFromOk = true
|
config.verifyFromOk = true
|
||||||
|
of "clique-period":
|
||||||
|
result = processInteger(value, config.cliquePeriod)
|
||||||
|
of "engine-signer":
|
||||||
|
result = processEthAddress(value, config.engineSigner)
|
||||||
|
of "import-key":
|
||||||
|
result = config.importPrivateKey(value)
|
||||||
else:
|
else:
|
||||||
result = EmptyOption
|
result = EmptyOption
|
||||||
|
|
||||||
@ -692,6 +727,9 @@ ETHEREUM OPTIONS:
|
|||||||
--keystore:<value> Directory for the keystore (default: inside datadir)
|
--keystore:<value> Directory for the keystore (default: inside datadir)
|
||||||
--prune:<value> Blockchain prune mode (full or archive, default: full)
|
--prune:<value> Blockchain prune mode (full or archive, default: full)
|
||||||
--import:<path> Import RLP encoded block(s), validate, write to database and quit
|
--import:<path> Import RLP encoded block(s), validate, write to database and quit
|
||||||
|
--clique-period:<value> Enables clique support. value is block time in seconds
|
||||||
|
--engine-signer:<value> Enables mining. value is EthAddress in hex
|
||||||
|
--import-key:<path> Import unencrypted 32 bytes hex private key file
|
||||||
|
|
||||||
NETWORKING OPTIONS:
|
NETWORKING OPTIONS:
|
||||||
--bootnodes:<value> Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers)
|
--bootnodes:<value> Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user