Пример #1
0
        private static NodesGroup CreateGroup(NodeServerTester servers, int connections)
        {
            AddressManagerBehavior behavior = new AddressManagerBehavior(new AddressManager());

            if (connections == 1)
            {
                behavior.AddressManager.Add(new NetworkAddress(servers.Server1.ExternalEndpoint), IPAddress.Parse("127.0.0.1"));
            }
            if (connections > 1)
            {
                behavior.AddressManager.Add(new NetworkAddress(servers.Server2.ExternalEndpoint), IPAddress.Parse("127.0.0.1"));
            }
            NodeConnectionParameters parameters = new NodeConnectionParameters();

            parameters.TemplateBehaviors.Add(behavior);
            Wallet.ConfigureDefaultNodeConnectionParameters(parameters);
            NodesGroup connected = new NodesGroup(servers.Network, parameters);

            connected.AllowSameGroup        = true;
            connected.MaximumNodeConnection = connections;
            servers.AddDisposable(connected);
            return(connected);
        }