77using Blockcore . Features . BlockStore ;
88using Blockcore . Features . ColdStaking ;
99using Blockcore . Features . Consensus ;
10+ using Blockcore . Features . Dns ;
1011using Blockcore . Features . Diagnostic ;
1112using Blockcore . Features . MemoryPool ;
1213using Blockcore . Features . Miner ;
@@ -22,18 +23,21 @@ public static async Task Main(string[] args)
2223 {
2324 try
2425 {
25- var nodeSettings = new NodeSettings ( networksSelector : Networks . Networks . Rutanio , args : args , agent : "Blockcore-RUTA" ) ;
26+ var nodeSettings = new NodeSettings ( networksSelector : Networks . Networks . Rutanio , args : args ) ;
2627
2728 IFullNodeBuilder nodeBuilder = new FullNodeBuilder ( )
2829 . UseNodeSettings ( nodeSettings )
2930 . UseBlockStore ( )
30- . UseMempool ( )
31- . UseNodeHost ( )
32- . AddRPC ( )
33- . UseDiagnosticFeature ( )
3431 . UsePosConsensus ( )
32+ . UseMempool ( )
3533 . AddPowPosMining ( )
3634 . UseColdStakingWallet ( ) ;
35+ . UseDiagnosticFeature ( )
36+ . UseNodeHost ( )
37+ . AddRPC ( ) ;
38+
39+ // Build the Dns full node if enabled
40+ UseDnsFullNode ( nodeBuilder , nodeSettings ) ;
3741
3842 IFullNode node = nodeBuilder . Build ( ) ;
3943
@@ -45,5 +49,17 @@ public static async Task Main(string[] args)
4549 Console . WriteLine ( "There was a problem initializing the node. Details: '{0}'" , ex ) ;
4650 }
4751 }
52+ static void UseDnsFullNode ( IFullNodeBuilder nodeBuilder , NodeSettings nodeSettings )
53+ {
54+ if ( nodeSettings . ConfigReader . GetOrDefault ( "dnsfullnode" , false , nodeSettings . Logger ) )
55+ {
56+ var dnsSettings = new DnsSettings ( nodeSettings ) ;
57+
58+ if ( string . IsNullOrWhiteSpace ( dnsSettings . DnsHostName ) || string . IsNullOrWhiteSpace ( dnsSettings . DnsNameServer ) || string . IsNullOrWhiteSpace ( dnsSettings . DnsMailBox ) )
59+ throw new ConfigurationException ( "When running as a DNS Seed service, the -dnshostname, -dnsnameserver and -dnsmailbox arguments must be specified on the command line." ) ;
60+
61+ nodeBuilder . UseDns ( ) ;
62+ }
63+ }
4864 }
4965}
0 commit comments