diff --git a/src/neo/NeoSystem.cs b/src/neo/NeoSystem.cs index 88cc93ebcd..76980ca319 100644 --- a/src/neo/NeoSystem.cs +++ b/src/neo/NeoSystem.cs @@ -22,6 +22,7 @@ public class NeoSystem : IDisposable internal IActorRef TaskManager { get; } public IActorRef Consensus { get; private set; } + private readonly string storage_engine; private readonly IStore store; private ChannelsConfig start_message = null; private bool suspend = false; @@ -32,12 +33,11 @@ static NeoSystem() AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; } - public NeoSystem(string storageEngine = null) + public NeoSystem(string storageEngine = null, string storagePath = null) { Plugin.LoadPlugins(this); - this.store = string.IsNullOrEmpty(storageEngine) || storageEngine == nameof(MemoryStore) - ? new MemoryStore() - : Plugin.Storages[storageEngine].GetStore(); + this.storage_engine = storageEngine; + this.store = LoadStore(storagePath); this.Blockchain = ActorSystem.ActorOf(Ledger.Blockchain.Props(this, store)); this.LocalNode = ActorSystem.ActorOf(Network.P2P.LocalNode.Props(this)); this.TaskManager = ActorSystem.ActorOf(Network.P2P.TaskManager.Props(this)); @@ -69,6 +69,13 @@ public void EnsureStoped(IActorRef actor) inbox.Receive(TimeSpan.FromMinutes(5)); } + public IStore LoadStore(string path) + { + return string.IsNullOrEmpty(storage_engine) || storage_engine == nameof(MemoryStore) + ? new MemoryStore() + : Plugin.Storages[storage_engine].GetStore(path); + } + internal void ResumeNodeStartup() { suspend = false; diff --git a/src/neo/Plugins/IStorageProvider.cs b/src/neo/Plugins/IStorageProvider.cs index 5ef2d9f098..b8b7197b6c 100644 --- a/src/neo/Plugins/IStorageProvider.cs +++ b/src/neo/Plugins/IStorageProvider.cs @@ -4,6 +4,6 @@ namespace Neo.Plugins { public interface IStorageProvider { - IStore GetStore(); + IStore GetStore(string path); } }