Пример #1
0
        public static CheckpointStorageProvider Open(string checkpointPath, uint?network = null, byte?addressVersion = null, UInt160?scriptHash = null)
        {
            var checkpointTempPath = RocksDbUtility.GetTempPath();
            var metadata           = RocksDbUtility.RestoreCheckpoint(checkpointPath, checkpointTempPath, network, addressVersion, scriptHash);

            var db = RocksDbUtility.OpenReadOnlyDb(checkpointTempPath);
            var rocksDbStorageProvider = new RocksDbStorageProvider(db, readOnly: true);

            return(new CheckpointStorageProvider(rocksDbStorageProvider, checkpointTempPath));
        }
Пример #2
0
        public CheckpointStore(string checkpointPath, uint?network = null, byte?addressVersion = null, UInt160?scriptHash = null)
        {
            checkpointTempPath = RocksDbUtility.GetTempPath();
            var metadata = RocksDbUtility.RestoreCheckpoint(checkpointPath, checkpointTempPath, network, addressVersion, scriptHash);

            Settings = ProtocolSettings.Default with
            {
                Network        = metadata.network,
                AddressVersion = metadata.addressVersion,
            };

            var db = RocksDbUtility.OpenReadOnlyDb(checkpointTempPath);

            this.store = new RocksDbStore(db, readOnly: true);
        }
        public static IStorageProvider OpenForDiscard(string path)
        {
            if (!string.IsNullOrEmpty(path) && Directory.Exists(path))
            {
                try
                {
                    var db = RocksDbUtility.OpenReadOnlyDb(path);
                    var storageProvider = new RocksDbStorageProvider(db, readOnly: true);
                    return(new CheckpointStorageProvider(storageProvider));
                }
                catch { }
            }

            return(new CheckpointStorageProvider(null));
        }
 public void CreateCheckpoint(string checkPointFileName, uint network, byte addressVersion, UInt160 scriptHash)
 => RocksDbUtility.CreateCheckpoint(db, checkPointFileName, network, addressVersion, scriptHash);
        public static RocksDbStorageProvider Open(string path)
        {
            var db = RocksDbUtility.OpenDb(path);

            return(new RocksDbStorageProvider(db, readOnly: false));
        }