Пример #1
0
        public SpookOracle(Spook cli, Nexus nexus, Logger logger) : base(nexus)
        {
            this._cli = cli;
            nexus.Attach(this);
            platforms   = new KeyValueStore <string, string>(CreateKeyStoreAdapter(StorageConst.Platform.ToString()));
            this.logger = logger;

            logger.Message("Platform count: " + platforms.Count);

            var nexusPlatforms = (nexus as Nexus).GetPlatforms(nexus.RootStorage);

            foreach (var nexusPlatform in nexusPlatforms)
            {
                if (!platforms.ContainsKey(nexusPlatform))
                {
                    platforms.Set(nexusPlatform, nexusPlatform);
                }

                _keyValueStore.Add(nexusPlatform + StorageConst.Block, new KeyValueStore <string, InteropBlock>(CreateKeyStoreAdapter(nexusPlatform + StorageConst.Block)));
                _keyValueStore.Add(nexusPlatform + StorageConst.Transaction, new KeyValueStore <string, InteropTransaction>(CreateKeyStoreAdapter(nexusPlatform + StorageConst.Transaction)));
                _keyValueStore.Add(nexusPlatform + StorageConst.CurrentHeight, new KeyValueStore <string, string>(CreateKeyStoreAdapter(nexusPlatform + StorageConst.CurrentHeight)));
            }
        }