Exemplo n.º 1
0
        public void InitialTesters()
        {
            for (var i = 0; i < MinersCount; i++)
            {
                var keyPair = CryptoHelpers.GenerateKeyPair();
                MinersKeyPairs.Add(keyPair);
                var tester = new ContractTester <DPoSSideChainTestAElfModule>(ChainId, keyPair);

                AsyncHelper.RunSync(
                    () => tester.InitialSideChainAsync());
                Testers.Add(tester);
            }

            DPoSSideChainContractAddress = Testers[0].GetConsensusContractAddress();
        }
Exemplo n.º 2
0
        public void InitialTesters(Timestamp blockchainStartTime)
        {
            for (var i = 0; i < MinersCount; i++)
            {
                var keyPair = CryptoHelpers.GenerateKeyPair();
                MinersKeyPairs.Add(keyPair);
            }

            foreach (var minersKeyPair in MinersKeyPairs)
            {
                var tester = new ContractTester <DPoSContractTestAElfModule>(ChainId, minersKeyPair);
                AsyncHelper.RunSync(() =>
                                    tester.InitialCustomizedChainAsync(MinersKeyPairs.Select(m => m.PublicKey.ToHex()).ToList(), 4000,
                                                                       blockchainStartTime));
                Testers.Add(tester);
            }

            AsyncHelper.RunSync(() => Testers.RunConsensusAsync(2));

            ConsensusContractAddress = Testers[0].GetConsensusContractAddress();
        }