Exemplo n.º 1
0
        public TrackDB()
        {
            _magic = CliSettings.Default.Protocol.Network;
            _sqldb = new SQLiteContext(Path.Combine($"Data_Track", $"track.{_magic}.db"));
            _leveldb = new LevelDbContext(Path.Combine("Data_Track", $"TransactionLog_LevelDB_{_magic}"));

            if (!_hasConsistencyCheck)
            {
                _hasConsistencyCheck = true;
                InitConsistencyCheck();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// read asset info from backup db
        /// </summary>
        /// <param name="assetId"></param>
        /// <returns></returns>
        public static AssetInfo GetAssetInfoFromDb(UInt160 assetId)
        {
            using var db = new LevelDbContext();
            var oldAsset = db.GetAssetInfo(assetId);

            if (oldAsset != null)
            {
                var asset = new AssetInfo()
                {
                    Asset    = assetId,
                    Decimals = oldAsset.Decimals,
                    Name     = oldAsset.Name,
                    Symbol   = oldAsset.Symbol,
                    //TotalSupply = oldAsset.TotalSupply,
                };
                _assets[assetId] = asset;
                return(asset);
            }
            return(null);
        }
Exemplo n.º 3
0
        public TrackDB()
        {
            _magic = ProtocolSettings.Default.Magic;
            if (!Directory.Exists("Data_Track"))
            {
                Directory.CreateDirectory("Data_Track");
            }
            _sqldb = new SQLiteContext(Path.Combine($"Data_Track", $"track.{_magic}.db"));

            var levelDbPath = Path.Combine("Data_Track", $"TransactionLog_LevelDB_{_magic}");

            if (!Directory.Exists(levelDbPath))
            {
                Directory.CreateDirectory(levelDbPath);
            }
            _leveldb = new LevelDbContext(levelDbPath);

            if (!_hasConsistencyCheck)
            {
                _hasConsistencyCheck = true;
                InitConsistencyCheck();
            }
        }