Exemplo n.º 1
0
        public DbSnapshot(DB db, Blockchain blockchain)
            : base(blockchain)
        {
            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);
            AppChains       = new DbCache <UInt160, AppChainState>(db, options, batch, Prefixes.ST_Appchain);
            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 DbCache <StorageKey, StorageItem>(db, options, batch, Prefixes.ST_Storage);
            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);
        }
Exemplo n.º 2
0
        public DbSnapshot(DB db, Blockchain blockchain)
            : base(blockchain)
        {
            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);
            AppChains       = new DbCache <UInt160, AppChainState>(db, options, batch, Prefixes.ST_Appchain);
            NativeNEP5s     = new DbCache <UInt160, NativeNEP5State>(db, options, batch, Prefixes.ST_NativeNEP5);
            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);
            AppChainState   = new DbMetaDataCache <AppChainState>(db, options, batch, Prefixes.IX_AppChainState);
        }