Beispiel #1
0
        private bool AppChain_ChangeSeedList(ExecutionEngine engine)
        {
            if (Trigger != TriggerType.Application)
            {
                return(false);
            }

            UInt160 hash = new UInt160(engine.CurrentContext.EvaluationStack.Pop().GetByteArray());

            AppChainState state = Snapshot.AppChains.TryGet(hash);

            if (state == null)
            {
                return(false);
            }

            int validatorCount = (int)engine.CurrentContext.EvaluationStack.Pop().GetBigInteger();

            ECPoint[] validators = new ECPoint[validatorCount];
            for (int i = 0; i < validatorCount; i++)
            {
                validators[i] = ECPoint.DecodePoint(engine.CurrentContext.EvaluationStack.Pop().GetByteArray(), ECCurve.Secp256r1);
            }

            state.StandbyValidators = validators;

            Blockchain appchain = Blockchain.GetBlockchain(hash);

            if (appchain != null)
            {
                appchain.StandbyValidators = (ECPoint[])validators.Clone();
            }

            return(true);
        }