diff --git a/src/Networks/Rutanio/Rutanio.Node/Program.cs b/src/Networks/Rutanio/Rutanio.Node/Program.cs index edd897264..41c958b04 100644 --- a/src/Networks/Rutanio/Rutanio.Node/Program.cs +++ b/src/Networks/Rutanio/Rutanio.Node/Program.cs @@ -7,6 +7,7 @@ using Blockcore.Features.BlockStore; using Blockcore.Features.ColdStaking; using Blockcore.Features.Consensus; +using Blockcore.Features.Dns; using Blockcore.Features.Diagnostic; using Blockcore.Features.MemoryPool; using Blockcore.Features.Miner; @@ -22,18 +23,21 @@ public static async Task Main(string[] args) { try { - var nodeSettings = new NodeSettings(networksSelector: Networks.Networks.Rutanio, args: args, agent: "Blockcore-RUTA"); + var nodeSettings = new NodeSettings(networksSelector: Networks.Networks.Rutanio, args: args); IFullNodeBuilder nodeBuilder = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseBlockStore() - .UseMempool() - .UseNodeHost() - .AddRPC() - .UseDiagnosticFeature() .UsePosConsensus() + .UseMempool() .AddPowPosMining() .UseColdStakingWallet(); + .UseDiagnosticFeature() + .UseNodeHost() + .AddRPC(); + + // Build the Dns full node if enabled + UseDnsFullNode(nodeBuilder, nodeSettings); IFullNode node = nodeBuilder.Build(); @@ -45,5 +49,17 @@ public static async Task Main(string[] args) Console.WriteLine("There was a problem initializing the node. Details: '{0}'", ex); } } + static void UseDnsFullNode(IFullNodeBuilder nodeBuilder, NodeSettings nodeSettings) + { + if (nodeSettings.ConfigReader.GetOrDefault("dnsfullnode", false, nodeSettings.Logger)) + { + var dnsSettings = new DnsSettings(nodeSettings); + + if (string.IsNullOrWhiteSpace(dnsSettings.DnsHostName) || string.IsNullOrWhiteSpace(dnsSettings.DnsNameServer) || string.IsNullOrWhiteSpace(dnsSettings.DnsMailBox)) + throw new ConfigurationException("When running as a DNS Seed service, the -dnshostname, -dnsnameserver and -dnsmailbox arguments must be specified on the command line."); + + nodeBuilder.UseDns(); + } + } } } \ No newline at end of file diff --git a/src/Networks/Rutanio/Rutanio.Node/Rutanio.Node.csproj b/src/Networks/Rutanio/Rutanio.Node/Rutanio.Node.csproj index b2af3f188..bc0815638 100644 --- a/src/Networks/Rutanio/Rutanio.Node/Rutanio.Node.csproj +++ b/src/Networks/Rutanio/Rutanio.Node/Rutanio.Node.csproj @@ -12,6 +12,7 @@ +