protected override void BeforeTest()
 {
     KnownNetworks.RegTest.Consensus.CoinbaseMaturity = 1;
     this.CoinBaseMaturity = (int)KnownNetworks.RegTest.Consensus.CoinbaseMaturity;
     this.sharedSteps      = new SharedSteps();
     this.nodeGroupBuilder = new NodeGroupBuilder(Path.Combine(this.GetType().Name, this.CurrentTest.DisplayName), KnownNetworks.RegTest);
 }
        protected override void BeforeTest()
        {
            this.sharedSteps      = new SharedSteps();
            this.nodeGroupBuilder = new NodeGroupBuilder();

            Transaction.TimeStamp = true;
            Block.BlockSignature  = true;
        }
        protected override void BeforeTest()
        {
            this.sharedSteps = new SharedSteps();
            this.httpClient  = new HttpClient();
            this.httpClient.DefaultRequestHeaders.Accept.Clear();
            this.httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(JsonContentType));

            this.nodeGroupBuilder = new NodeGroupBuilder(Path.Combine(this.GetType().Name, this.CurrentTest.DisplayName));
        }
        protected override void BeforeTest()
        {
            this.sharedSteps = new SharedSteps();
            this.httpHandler = new HttpClientHandler() { ServerCertificateCustomValidationCallback = (request, cert, chain, errors) => true };
            this.httpClient = new HttpClient(this.httpHandler);
            this.httpClient.DefaultRequestHeaders.Accept.Clear();
            this.httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(JsonContentType));

            this.powNodeGroupBuilder = new NodeGroupBuilder(Path.Combine(this.GetType().Name, this.CurrentTest.DisplayName), KnownNetworks.RegTest);
            this.posNodeGroupBuilder = new NodeGroupBuilder(Path.Combine(this.GetType().Name, this.CurrentTest.DisplayName), KnownNetworks.StratisRegTest);
        }
 protected override void BeforeTest()
 {
     this.sharedSteps      = new SharedSteps();
     this.nodeGroupBuilder = new NodeGroupBuilder(Path.Combine(this.GetType().Name, this.CurrentTest.DisplayName));
 }
 protected override void BeforeTest()
 {
     this.nodeGroupBuilder = new NodeGroupBuilder();
     this.sharedSteps      = new SharedSteps();
 }
        public void MiningNodeWithOneConnectionAlwaysSynced()
        {
            const string miner          = "miner";
            const string connector      = "connector";
            const string node1          = "networkNode1";
            const string node2          = "networkNode2";
            const string walletName     = "dummyWallet";
            const string walletPassword = "******";

            var    sharedSteps    = new SharedSteps();
            string testFolderPath = Path.Combine(this.GetType().Name, nameof(MiningNodeWithOneConnectionAlwaysSynced));

            using (var builder = new NodeGroupBuilder(testFolderPath))
            {
                var nodes = builder.StratisPowNode(miner).Start().NotInIBD().WithWallet(walletName, walletPassword)
                            .StratisPowNode(connector).Start().NotInIBD().WithWallet(walletName, walletPassword)
                            .StratisPowNode(node1).Start().NotInIBD().WithWallet(walletName, walletPassword)
                            .StratisPowNode(node2).Start().NotInIBD().WithWallet(walletName, walletPassword)
                            .WithConnections()
                            .Connect(miner, connector)
                            .Connect(connector, node1).Connect(connector, node2)
                            .Connect(node1, node2)
                            .AndNoMoreConnections().Build();

                nodes.Values.ToList().ForEach(n =>
                {
                    sharedSteps.MineBlocks(1, n, "account 0", walletName, walletPassword);
                    sharedSteps.WaitForNodeToSync(nodes.Values.ToArray());
                });

                int networkHeight = nodes[miner].FullNode.Chain.Height;
                Assert.Equal(networkHeight, nodes.Count);

                // Random node on network generates a block.
                nodes[node1].GenerateStratisWithMiner(1);

                // Wait until connector get the hash of network's block.
                while ((nodes[connector].FullNode.ChainBehaviorState.ConsensusTip.HashBlock != nodes[node1].FullNode.ChainBehaviorState.ConsensusTip.HashBlock) ||
                       (nodes[node1].FullNode.ChainBehaviorState.ConsensusTip.Height == networkHeight))
                {
                    Thread.Sleep(1);
                }

                Assert.Equal(nodes[connector].FullNode.Chain.Tip.HashBlock, nodes[node1].FullNode.Chain.Tip.HashBlock);
                Assert.Equal(nodes[miner].FullNode.Chain.Tip.Height, networkHeight);
                Assert.Equal(nodes[connector].FullNode.Chain.Tip.Height, networkHeight + 1);

                // Miner mines the block.
                nodes[miner].GenerateStratisWithMiner(1);
                TestHelper.WaitLoop(() => TestHelper.IsNodeSynced(nodes[miner]));

                networkHeight++;

                Assert.Equal(nodes[connector].FullNode.Chain.Tip.HashBlock, nodes[node1].FullNode.Chain.Tip.HashBlock);
                Assert.Equal(nodes[miner].FullNode.Chain.Tip.Height, networkHeight);
                Assert.Equal(nodes[connector].FullNode.Chain.Tip.Height, networkHeight);

                nodes[connector].GenerateStratisWithMiner(1);
                networkHeight++;

                sharedSteps.WaitForNodeToSync(nodes.Values.ToArray());

                nodes.Values.All(n => n.FullNode.Chain.Height == networkHeight).Should()
                .BeTrue(because: "all nodes have synced to chain height");

                Assert.Equal(nodes[node1].FullNode.Chain.Tip.HashBlock, nodes[miner].FullNode.Chain.Tip.HashBlock);
            }
        }
 public ProofOfStakeSteps(string displayName)
 {
     this.sharedSteps      = new SharedSteps();
     this.NodeGroupBuilder = new NodeGroupBuilder(Path.Combine(this.GetType().Name, displayName), KnownNetworks.StratisRegTest);
 }
 protected override void BeforeTest()
 {
     this.sharedSteps      = new SharedSteps();
     this.nodeGroupBuilder = new NodeGroupBuilder(this.CurrentTest.DisplayName);
 }
Exemple #10
0
 protected override void BeforeTest()
 {
     this.httpClient       = new HttpClient();
     this.nodeGroupBuilder = new NodeGroupBuilder(this.CurrentTest.DisplayName);
 }
Exemple #11
0
 protected override void BeforeTest()
 {
     this.proofOfStakeSteps = new ProofOfStakeSteps(this.CurrentTest.DisplayName);
     this.nodeGroupBuilder  = new NodeGroupBuilder(this.CurrentTest.DisplayName);
 }
Exemple #12
0
 public ProofOfStakeSteps(string displayName)
 {
     this.sharedSteps      = new SharedSteps();
     this.NodeGroupBuilder = new NodeGroupBuilder(Path.Combine(this.GetType().Name, displayName));
 }
 public ProofOfStakeSteps(string displayName)
 {
     this.sharedSteps      = new SharedSteps();
     this.nodeGroupBuilder = new NodeGroupBuilder(displayName);
 }
Exemple #14
0
 protected override void BeforeTest()
 {
     this.httpClient       = new HttpClient();
     this.nodeGroupBuilder = new NodeGroupBuilder();
 }
 protected override void BeforeTest()
 {
     this.httpClient       = new HttpClient();
     this.nodeGroupBuilder = new NodeGroupBuilder(Path.Combine(this.GetType().Name, this.CurrentTest.DisplayName));
 }