diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 2980260d6..605d64dda 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -21,7 +21,9 @@ jobs: dotnet tool install --tool-path ./ dotnet-format ./dotnet-format --check --dry-run -v diagnostic - name: Build - run: dotnet publish -o ./out -c Release + run: | + dotnet publish -o ./out -c Release + find ./out -name 'config.json' | xargs perl -pi -e 's|LevelDBStore|MemoryStore|g' - name: Install dependencies run: sudo apt-get install libleveldb-dev expect - name: Run tests with expect diff --git a/neo-cli/Settings.cs b/neo-cli/Settings.cs index 912587d75..1cbe5aec0 100644 --- a/neo-cli/Settings.cs +++ b/neo-cli/Settings.cs @@ -8,6 +8,7 @@ namespace Neo { internal class Settings { + public StorageSettings Storage { get; } public P2PSettings P2P { get; } public RPCSettings RPC { get; } public UnlockWalletSettings UnlockWallet { get; } @@ -41,6 +42,7 @@ public static Settings Default public Settings(IConfigurationSection section) { + this.Storage = new StorageSettings(section.GetSection("Storage")); this.P2P = new P2PSettings(section.GetSection("P2P")); this.RPC = new RPCSettings(section.GetSection("RPC")); this.UnlockWallet = new UnlockWalletSettings(section.GetSection("UnlockWallet")); @@ -48,6 +50,16 @@ public Settings(IConfigurationSection section) } } + internal class StorageSettings + { + public string Engine { get; } + + public StorageSettings(IConfigurationSection section) + { + this.Engine = section.GetSection("Engine").Value; + } + } + internal class P2PSettings { public ushort Port { get; } diff --git a/neo-cli/Shell/MainService.cs b/neo-cli/Shell/MainService.cs index 559281b9a..49c1b7c70 100644 --- a/neo-cli/Shell/MainService.cs +++ b/neo-cli/Shell/MainService.cs @@ -1110,7 +1110,7 @@ protected internal override void OnStart(string[] args) Settings.Initialize(new ConfigurationBuilder().AddJsonFile("config.mainnet.json").Build()); break; } - system = new NeoSystem(); + system = new NeoSystem(Settings.Default.Storage.Engine); system.StartNode(new ChannelsConfig { Tcp = new IPEndPoint(IPAddress.Any, Settings.Default.P2P.Port), diff --git a/neo-cli/config.json b/neo-cli/config.json index 1fabc1da6..c3d6adec9 100644 --- a/neo-cli/config.json +++ b/neo-cli/config.json @@ -1,5 +1,8 @@ { "ApplicationConfiguration": { + "Storage": { + "Engine": "LevelDBStore" + }, "P2P": { "Port": 10333, "WsPort": 10334 diff --git a/neo-cli/config.mainnet.json b/neo-cli/config.mainnet.json index 1fabc1da6..c3d6adec9 100644 --- a/neo-cli/config.mainnet.json +++ b/neo-cli/config.mainnet.json @@ -1,5 +1,8 @@ { "ApplicationConfiguration": { + "Storage": { + "Engine": "LevelDBStore" + }, "P2P": { "Port": 10333, "WsPort": 10334 diff --git a/neo-cli/config.testnet.json b/neo-cli/config.testnet.json index 8d85198d0..63e21ddfc 100644 --- a/neo-cli/config.testnet.json +++ b/neo-cli/config.testnet.json @@ -1,5 +1,8 @@ { "ApplicationConfiguration": { + "Storage": { + "Engine": "LevelDBStore" + }, "P2P": { "Port": 20333, "WsPort": 20334 diff --git a/neo-cli/neo-cli.csproj b/neo-cli/neo-cli.csproj index 81cc9aec8..ea5d9c46c 100644 --- a/neo-cli/neo-cli.csproj +++ b/neo-cli/neo-cli.csproj @@ -28,7 +28,7 @@ - +