diff --git a/neo-cli/Settings.cs b/neo-cli/Settings.cs index 9a62a74a8..c21fcfa78 100644 --- a/neo-cli/Settings.cs +++ b/neo-cli/Settings.cs @@ -69,6 +69,7 @@ public class UnlockWalletSettings { public string Path { get; } public string Password { get; } + public bool StartConsensus { get; } public bool IsActive { get; } public UnlockWalletSettings(IConfigurationSection section) @@ -77,6 +78,7 @@ public UnlockWalletSettings(IConfigurationSection section) { this.Path = section.GetSection("WalletPath").Value; this.Password = section.GetSection("WalletPassword").Value; + this.StartConsensus = bool.Parse(section.GetSection("StartConsensus").Value); this.IsActive = bool.Parse(section.GetSection("IsActive").Value); } } diff --git a/neo-cli/Shell/MainService.cs b/neo-cli/Shell/MainService.cs index 21c9a6c17..9898a5bda 100644 --- a/neo-cli/Shell/MainService.cs +++ b/neo-cli/Shell/MainService.cs @@ -908,6 +908,10 @@ protected internal override void OnStart(string[] args) { Console.WriteLine($"failed to open file \"{Settings.Default.UnlockWallet.Path}\""); } + if (Settings.Default.UnlockWallet.StartConsensus && Program.Wallet != null) + { + OnStartConsensusCommand(null); + } } if (useRPC) { diff --git a/neo-cli/config.json b/neo-cli/config.json index 2e10ebdc9..6edf3941f 100644 --- a/neo-cli/config.json +++ b/neo-cli/config.json @@ -16,7 +16,8 @@ "UnlockWallet": { "Path": "", "Password": "", - "IsActive": false + "StartConsensus": false, + "IsActive": false } } } diff --git a/neo-cli/config.mainnet.json b/neo-cli/config.mainnet.json index 02c0a2877..6edf3941f 100644 --- a/neo-cli/config.mainnet.json +++ b/neo-cli/config.mainnet.json @@ -16,6 +16,7 @@ "UnlockWallet": { "Path": "", "Password": "", + "StartConsensus": false, "IsActive": false } } diff --git a/neo-cli/config.testnet.json b/neo-cli/config.testnet.json index 4ac0fc1a7..dc835e63b 100644 --- a/neo-cli/config.testnet.json +++ b/neo-cli/config.testnet.json @@ -16,6 +16,7 @@ "UnlockWallet": { "Path": "", "Password": "", + "StartConsensus": false, "IsActive": false } }