diff --git a/neo/IO/Data/LevelDB/WriteOptions.cs b/neo/IO/Data/LevelDB/WriteOptions.cs index 8a74fb5340..c386b271c4 100644 --- a/neo/IO/Data/LevelDB/WriteOptions.cs +++ b/neo/IO/Data/LevelDB/WriteOptions.cs @@ -5,6 +5,7 @@ namespace Neo.IO.Data.LevelDB public class WriteOptions { public static readonly WriteOptions Default = new WriteOptions(); + public static readonly WriteOptions DefaultSync = new WriteOptions { Sync = true }; internal readonly IntPtr handle = Native.leveldb_writeoptions_create(); public bool Sync diff --git a/neo/NeoSystem.cs b/neo/NeoSystem.cs index 1e157486e2..9a0359b423 100644 --- a/neo/NeoSystem.cs +++ b/neo/NeoSystem.cs @@ -20,7 +20,8 @@ public class NeoSystem : IDisposable $"task-manager-mailbox {{ mailbox-type: \"{typeof(TaskManagerMailbox).AssemblyQualifiedName}\" }}" + $"remote-node-mailbox {{ mailbox-type: \"{typeof(RemoteNodeMailbox).AssemblyQualifiedName}\" }}" + $"protocol-handler-mailbox {{ mailbox-type: \"{typeof(ProtocolHandlerMailbox).AssemblyQualifiedName}\" }}" + - $"consensus-service-mailbox {{ mailbox-type: \"{typeof(ConsensusServiceMailbox).AssemblyQualifiedName}\" }}"); + $"consensus-service-mailbox {{ mailbox-type: \"{typeof(ConsensusServiceMailbox).AssemblyQualifiedName}\" }}" + + $"blockchain-dispatcher {{ type = PinnedDispatcher }}"); public IActorRef Blockchain { get; } public IActorRef LocalNode { get; } internal IActorRef TaskManager { get; } @@ -35,7 +36,7 @@ public NeoSystem(Store store) { this.store = store; Plugin.LoadPlugins(this); - this.Blockchain = ActorSystem.ActorOf(Ledger.Blockchain.Props(this, store)); + this.Blockchain = ActorSystem.ActorOf(Ledger.Blockchain.Props(this, store).WithDispatcher("blockchain-dispatcher")); this.LocalNode = ActorSystem.ActorOf(Network.P2P.LocalNode.Props(this)); this.TaskManager = ActorSystem.ActorOf(Network.P2P.TaskManager.Props(this)); Plugin.NotifyPluginsLoadedAfterSystemConstructed(); diff --git a/neo/Persistence/LevelDB/DbSnapshot.cs b/neo/Persistence/LevelDB/DbSnapshot.cs index b8391315b8..59e6537b5f 100644 --- a/neo/Persistence/LevelDB/DbSnapshot.cs +++ b/neo/Persistence/LevelDB/DbSnapshot.cs @@ -51,7 +51,7 @@ public DbSnapshot(DB db) public override void Commit() { base.Commit(); - db.Write(WriteOptions.Default, batch); + db.Write(WriteOptions.DefaultSync, batch); } public override void Dispose() diff --git a/neo/Persistence/LevelDB/LevelDBStore.cs b/neo/Persistence/LevelDB/LevelDBStore.cs index b74034f1ca..d7759e110a 100644 --- a/neo/Persistence/LevelDB/LevelDBStore.cs +++ b/neo/Persistence/LevelDB/LevelDBStore.cs @@ -119,7 +119,7 @@ public override void Put(byte prefix, byte[] key, byte[] value) public override void PutSync(byte prefix, byte[] key, byte[] value) { - db.Put(new WriteOptions { Sync = true }, SliceBuilder.Begin(prefix).Add(key), value); + db.Put(WriteOptions.DefaultSync, SliceBuilder.Begin(prefix).Add(key), value); } } }