internal bool Verify(ProtocolSettings settings, DataCache snapshot, HeaderCache headerCache) { Header prev = headerCache.Last; if (prev is null) { return(Verify(settings, snapshot)); } if (PrimaryIndex >= settings.ValidatorsCount) { return(false); } if (prev.Hash != PrevHash) { return(false); } if (prev.Index + 1 != Index) { return(false); } if (prev.Timestamp >= Timestamp) { return(false); } return(this.VerifyWitness(settings, snapshot, prev.NextConsensus, Witness, 1_00000000, out _)); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected sealed override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); if (!Directory.Exists("cfg")) { Directory.CreateDirectory("cfg"); } if (!Directory.Exists("addons")) { Directory.CreateDirectory("addons"); } ComponentCache.RegisterComponents(); HeaderCache.RegisterHeaders(); NetworkMethodCache.RegisterSendables(); TileTypeCache.RegisterTileTypes(); ServiceLocator.RegisterService(Content); ServiceLocator.RegisterService(spriteBatch); ServiceLocator.RegisterService(graphics); ServiceLocator.RegisterImplementations(); DefineImplementations(); ServiceLocator.RegisterServices(); GameState.RegisterStates(); ServiceLocator.Get <IPerformanceProfiler>().StartSession(false); for (var i = 0; i < 1000; i++) { //var world = new ObjectFactory<ThreeTierWorld>().Make(1, 1); } var time = ServiceLocator.Get <IPerformanceProfiler>().StopSession(); Debug.WriteLine(time.TotalTime.Milliseconds); ServiceLocator.Get <IPropertyService>().Load("app"); SteamCallback.Create(); LuaContext.LoadAddons(); Window.TextInput += ServiceLocator.Get <ITextInputService>().Execute; camera = ServiceLocator.Get <ICamera>(); input = ServiceLocator.Get <IInput>(); gameTimeService = ServiceLocator.Get <IGameTimeService>(); stateService = ServiceLocator.Get <IStateService>(); client = ServiceLocator.Get <IClient>(); LoadGameContent(); }
public void Dispose() { foreach (var p in Plugin.Plugins) { p.Dispose(); } EnsureStoped(LocalNode); // Dispose will call ActorSystem.Terminate() ActorSystem.Dispose(); ActorSystem.WhenTerminated.Wait(); HeaderCache.Dispose(); store.Dispose(); }
internal bool Verify(DataCache snapshot, HeaderCache headerCache) { Header prev = headerCache.Last; if (prev is null) { return(Verify(snapshot)); } if (prev.Hash != PrevHash) { return(false); } if (prev.Index + 1 != Index) { return(false); } if (prev.Timestamp >= Timestamp) { return(false); } return(this.VerifyWitness(snapshot, prev.NextConsensus, Witness, 1_00000000, out _)); }