Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Neo cli start consensus config json (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiz-sharp authored and erikzhang committed May 15, 2018
1 parent fba9874 commit 95e25ce
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions neo-cli/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
}
Expand Down
4 changes: 4 additions & 0 deletions neo-cli/Shell/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion neo-cli/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"UnlockWallet": {
"Path": "",
"Password": "",
"IsActive": false
"StartConsensus": false,
"IsActive": false
}
}
}
1 change: 1 addition & 0 deletions neo-cli/config.mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"UnlockWallet": {
"Path": "",
"Password": "",
"StartConsensus": false,
"IsActive": false
}
}
Expand Down
1 change: 1 addition & 0 deletions neo-cli/config.testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"UnlockWallet": {
"Path": "",
"Password": "",
"StartConsensus": false,
"IsActive": false
}
}
Expand Down

0 comments on commit 95e25ce

Please sign in to comment.