public void Reset(Wallet wallet) { Snapshot?.Dispose(); Snapshot = Blockchain.Singleton.GetSnapshot(); State = ConsensusState.Initial; PrevHash = Snapshot.CurrentBlockHash; BlockIndex = Snapshot.Height + 1; ViewNumber = 0; Validators = Snapshot.GetValidators(); MyIndex = -1; PrimaryIndex = BlockIndex % (uint)Validators.Length; TransactionHashes = null; Signatures = new byte[Validators.Length][]; ExpectedView = new byte[Validators.Length]; KeyPair = null; for (int i = 0; i < Validators.Length; i++) { WalletAccount account = wallet.GetAccount(Validators[i]); if (account?.HasKey == true) { MyIndex = i; KeyPair = account.GetKey(); break; } } _header = null; }
private bool Blockchain_GetValidators(ExecutionEngine engine) { ECPoint[] validators = Snapshot.GetValidators(); engine.CurrentContext.EvaluationStack.Push(validators.Select(p => (StackItem)p.EncodePoint(true)).ToArray()); return(true); }