Пример #1
0
        public DbSnapshot(DB db)
        {
            this.db       = db;
            this.snapshot = db.GetSnapshot();
            this.batch    = new WriteBatch();
            ReadOptions options = new ReadOptions {
                FillCache = false, Snapshot = snapshot
            };

            Blocks             = new DbCache <UInt256, BlockState>(db, options, batch, Prefixes.DATA_Block);
            Transactions       = new DbCache <UInt256, TransactionState>(db, options, batch, Prefixes.DATA_Transaction);
            Accounts           = new DbCache <UInt160, AccountState>(db, options, batch, Prefixes.ST_Account);
            UnspentCoins       = new DbCache <UInt256, UnspentCoinState>(db, options, batch, Prefixes.ST_Coin);
            SpentCoins         = new DbCache <UInt256, SpentCoinState>(db, options, batch, Prefixes.ST_SpentCoin);
            Validators         = new DbCache <ECPoint, ValidatorState>(db, options, batch, Prefixes.ST_Validator);
            Assets             = new DbCache <UInt256, AssetState>(db, options, batch, Prefixes.ST_Asset);
            Contracts          = new DbCache <UInt160, ContractState>(db, options, batch, Prefixes.ST_Contract);
            Storages           = new DbCacheWithTrie <StorageKey, StorageItem>(db, options, batch, Prefixes.ST_Storage);
            StateRoots         = new DbCache <UInt32Wrapper, StateRootState>(db, options, batch, Prefixes.ST_StateRoot);
            HeaderHashList     = new DbCache <UInt32Wrapper, HeaderHashList>(db, options, batch, Prefixes.IX_HeaderHashList);
            ValidatorsCount    = new DbMetaDataCache <ValidatorsCountState>(db, options, batch, Prefixes.IX_ValidatorsCount);
            BlockHashIndex     = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentBlock);
            HeaderHashIndex    = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentHeader);
            StateRootHashIndex = new DbMetaDataCache <RootHashIndex>(db, options, batch, Prefixes.IX_CurrentStateRoot);
        }
Пример #2
0
        public DbSnapshot(DB db)
        {
            this.db       = db;
            this.snapshot = db.GetSnapshot();
            this.batch    = new WriteBatch();
            ReadOptions options = new ReadOptions {
                FillCache = false, Snapshot = snapshot
            };

            Blocks          = new DbCache <UInt256, TrimmedBlock>(db, options, batch, Prefixes.DATA_Block);
            Transactions    = new DbCache <UInt256, TransactionState>(db, options, batch, Prefixes.DATA_Transaction);
            Contracts       = new DbCache <UInt160, ContractState>(db, options, batch, Prefixes.ST_Contract);
            Storages        = new DbCache <StorageKey, StorageItem>(db, options, batch, Prefixes.ST_Storage);
            HeaderHashList  = new DbCache <UInt32Wrapper, HeaderHashList>(db, options, batch, Prefixes.IX_HeaderHashList);
            BlockHashIndex  = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentBlock);
            HeaderHashIndex = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentHeader);
        }