Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }