Skip to content

Commit

Permalink
move Settings paramter to dbft plugin ctor (neo-project#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
devhawk authored and joeqian10 committed Apr 7, 2021
1 parent 002565f commit d18db08
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/DBFTPlugin/DBFTPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ public class DBFTPlugin : Plugin, IP2PPlugin
private NeoSystem neoSystem;
private Settings settings;

public DBFTPlugin() { }

public DBFTPlugin(Settings settings)
{
this.settings = settings;
}

public override string Description => "Consensus plugin with dBFT algorithm.";

protected override void Configure()
{
settings = new Settings(GetConfiguration());
if (settings == null) settings = new Settings(GetConfiguration());
}

protected override void OnSystemLoaded(NeoSystem system)
Expand Down Expand Up @@ -53,12 +60,11 @@ private void OnStart()
Start(walletProvider.GetWallet());
}

public void Start(Wallet wallet, Settings settings = null)
public void Start(Wallet wallet)
{
if (started) return;
started = true;
if (settings != null) this.settings = settings;
consensus = neoSystem.ActorSystem.ActorOf(ConsensusService.Props(neoSystem, this.settings, wallet));
consensus = neoSystem.ActorSystem.ActorOf(ConsensusService.Props(neoSystem, settings, wallet));
consensus.Tell(new ConsensusService.Start());
}

Expand Down

0 comments on commit d18db08

Please sign in to comment.