public BlockchainUnit(string path, IIndexedStorage <long> addressStorage) { disposed = false; blockStorage = new JsonDriveAccessor <Block>(path, addressStorage); merkleRootComputer = new MerkleTreeBuilder(); digest = new SHA3Managed(512); }
public BinaryDriveAccessor(string path, IIndexedStorage <long> storage) { disposed = false; if (!File.Exists(path)) { throw new ArgumentException($"File \"{path}\" doesn't exist."); } stream = File.Open(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None); addressStorage = storage; serializer = new BinaryFormatter(); }
public JsonDriveAccessor(string path, IIndexedStorage <long> storage) { disposed = false; if (!File.Exists(path)) { throw new ArgumentException($"File \"{path}\" doesn't exist."); } stream = File.Open(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None); addressStorage = storage; writer = new StreamWriter(stream); writer.AutoFlush = true; reader = new BinaryReader(stream); }