public void CanSpecifyRPCSettings() { var dir = CreateTestDir(this); NodeSettings nodeSettings = new NodeSettings().LoadArguments(new string[] { $"-datadir={dir}" }); var node = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseConsensus() .AddRPC(x => { x.RpcUser = "******"; x.RpcPassword = "******"; x.RPCPort = 91; }) .Build(); var settings = node.NodeService <RpcSettings>(); settings.Load(nodeSettings); Assert.Equal("abc", settings.RpcUser); Assert.Equal("def", settings.RpcPassword); Assert.Equal(91, settings.RPCPort); }
public void CanSpecifyStoreSettings() { string dir = CreateTestDir(this); NodeSettings nodeSettings = new NodeSettings(args: new string[] { $"-datadir={dir}" }, loadConfiguration: false); var node1 = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseBlockStore() .Build(); var settings1 = node1.NodeService <StoreSettings>(); settings1.Load(nodeSettings); Assert.False(settings1.ReIndex); var node2 = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseBlockStore(x => x.ReIndex = true) .Build(); var settings2 = node2.NodeService <StoreSettings>(); settings2.Load(nodeSettings); Assert.True(settings2.ReIndex); }
public void CanSpecifyRPCSettings() { var initialBlockSignature = Block.BlockSignature; try { Block.BlockSignature = false; var dir = CreateTestDir(this); NodeSettings nodeSettings = new NodeSettings(args: new string[] { $"-datadir={dir}" }); var node = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseConsensus() .AddRPC(x => { x.RpcUser = "******"; x.RpcPassword = "******"; x.RPCPort = 91; }) .Build(); var settings = node.NodeService <RpcSettings>(); settings.Load(nodeSettings); Assert.Equal("abc", settings.RpcUser); Assert.Equal("def", settings.RpcPassword); Assert.Equal(91, settings.RPCPort); } finally { Block.BlockSignature = initialBlockSignature; } }
public void CanSpecifyStoreSettings() { string dir = CreateTestDir(this); var nodeSettings = new NodeSettings(args: new string[] { $"-datadir={dir}" }); IFullNode node1 = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseBlockStore() .Build(); var settings1 = node1.NodeService <StoreSettings>(); Assert.False(settings1.ReIndex); nodeSettings = new NodeSettings(args: new string[] { $"-datadir={dir}", "-reindex=1" }); IFullNode node2 = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseBlockStore() .Build(); var settings2 = node2.NodeService <StoreSettings>(); Assert.True(settings2.ReIndex); }
public void CanSpecifyStoreSettings() { var dir = AssureEmptyDir("TestData/StoreSettingsTest/CanSpecifyStoreSettings"); NodeSettings nodeSettings = NodeSettings.FromArguments(new string[] { $"-datadir={dir}" }); var node1 = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseBlockStore() .Build(); var settings1 = node1.NodeService <StoreSettings>(); settings1.Load(nodeSettings); Assert.False(settings1.ReIndex); var node2 = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UseBlockStore(x => x.ReIndex = true) .Build(); var settings2 = node2.NodeService <StoreSettings>(); settings2.Load(nodeSettings); Assert.True(settings2.ReIndex); }
public void CanSpecifyRPCSettings() { string dir = CreateTestDir(this); var nodeSettings = new NodeSettings(this.Network, args: new string[] { $"-datadir={dir}", "-rpcuser=abc", "-rpcpassword=def", "-rpcport=91", "-server=1" }); IFullNode node = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .UsePowConsensus() .AddRPC() .Build(); var settings = node.NodeService <RpcSettings>(); Assert.Equal("abc", settings.RpcUser); Assert.Equal("def", settings.RpcPassword); Assert.Equal(91, settings.RPCPort); }
public void CanSpecifyRPCSettings() { var dir = AssureEmptyDir("TestData/StoreSettingsTest/CanSpecifyRPCSettings"); NodeSettings nodeSettings = NodeSettings.FromArguments(new string[] { $"-datadir={dir}" }); var node = new FullNodeBuilder() .UseNodeSettings(nodeSettings) .AddRPC(x => { x.RpcUser = "******"; x.RpcPassword = "******"; x.RPCPort = 91; }) .Build(); var settings = node.NodeService <RpcSettings>(); settings.Load(nodeSettings); Assert.Equal("abc", settings.RpcUser); Assert.Equal("def", settings.RpcPassword); Assert.Equal(91, settings.RPCPort); }