public async Task StartAsync() { NodeConfigParameters config = new NodeConfigParameters(); config.Add("regtest", "1"); config.Add("rest", "1"); config.Add("server", "1"); config.Add("txindex", "1"); if (!CookieAuth) { config.Add("rpcuser", creds.UserName); config.Add("rpcpassword", creds.Password); } if (!WhiteBind) { config.Add("port", ports[0].ToString()); } else { config.Add("whitebind", "127.0.0.1:" + ports[0].ToString()); } config.Add("rpcport", ports[1].ToString()); config.Add("printtoconsole", "1"); config.Add("keypool", "10"); config.Import(ConfigParameters, true); File.WriteAllText(_Config, config.ToString()); await Run(); }
public void Import(NodeConfigParameters configParameters) { foreach(var kv in configParameters) { if(!ContainsKey(kv.Key)) Add(kv.Key, kv.Value); } }
public async Task StartAsync() { NodeConfigParameters config = new NodeConfigParameters(); StringBuilder configStr = new StringBuilder(); if (String.IsNullOrEmpty(NodeImplementation.Chain)) { configStr.AppendLine("regtest=1"); } else { configStr.AppendLine($"chain={NodeImplementation.Chain}"); } if (NodeImplementation.UseSectionInConfigFile) { if (String.IsNullOrEmpty(NodeImplementation.Chain)) { configStr.AppendLine("[regtest]"); } else { configStr.AppendLine($"[{NodeImplementation.Chain}]"); } } config.Add("rest", "1"); config.Add("server", "1"); config.Add("txindex", "1"); config.Add("peerbloomfilters", "1"); // Somehow got problems on windows with it time to time... //config.Add("blockfilterindex", "1"); if (!CookieAuth) { config.Add("rpcuser", creds.UserName); config.Add("rpcpassword", creds.Password); } if (!WhiteBind) { config.Add("port", ports[0].ToString()); } else { config.Add("whitebind", "127.0.0.1:" + ports[0].ToString()); } config.Add("rpcport", ports[1].ToString()); config.Add("printtoconsole", _Builder.ShowNodeConsole ? "1" : "0"); config.Add("keypool", "10"); config.Add("fallbackfee", "0.0002"); // https://github.com/bitcoin/bitcoin/pull/16524 config.Import(ConfigParameters, true); configStr.AppendLine(config.ToString()); if (NodeImplementation.AdditionalRegtestConfig != null) { configStr.AppendLine(NodeImplementation.AdditionalRegtestConfig); } File.WriteAllText(_Config, configStr.ToString()); await Run(); }
public async Task StartAsync() { NodeConfigParameters config = new NodeConfigParameters(); StringBuilder configStr = new StringBuilder(); if (String.IsNullOrEmpty(NodeImplementation.Chain)) { configStr.AppendLine("regtest=1"); } else { configStr.AppendLine($"chain={NodeImplementation.Chain}"); } if (NodeImplementation.UseSectionInConfigFile) { if (String.IsNullOrEmpty(NodeImplementation.Chain)) { configStr.AppendLine("[regtest]"); } else { configStr.AppendLine($"[{NodeImplementation.Chain}]"); } } config.Add("rest", "1"); config.Add("server", "1"); config.Add("txindex", "1"); if (!CookieAuth) { config.Add("rpcuser", creds.UserName); config.Add("rpcpassword", creds.Password); } if (!WhiteBind) { config.Add("port", ports[0].ToString()); } else { config.Add("whitebind", "127.0.0.1:" + ports[0].ToString()); } config.Add("rpcport", ports[1].ToString()); config.Add("printtoconsole", _Builder.ShowNodeConsole ? "1" : "0"); config.Add("keypool", "10"); config.Import(ConfigParameters, true); configStr.AppendLine(config.ToString()); if (NodeImplementation.AdditionalRegtestConfig != null) { configStr.AppendLine(NodeImplementation.AdditionalRegtestConfig); } File.WriteAllText(_Config, configStr.ToString()); await Run(); }
public void Import(NodeConfigParameters configParameters, bool overrides) { foreach (var kv in configParameters) { if (!ContainsKey(kv.Key)) { Add(kv.Key, kv.Value); } else if (overrides) { Remove(kv.Key); Add(kv.Key, kv.Value); } } }
public void Import(NodeConfigParameters configParameters) { var toAdd = new List <KeyValuePair <string, string> >(); foreach (var kv in configParameters) { if (!ContainsKey(kv.Key)) { toAdd.Add(new KeyValuePair <string, string>(kv.Key, kv.Value)); } } foreach (var add in toAdd) { Add(add.Key, add.Value); } }
public async Task StartAsync() { NodeConfigParameters config = new NodeConfigParameters(); config.Add("regtest", "1"); config.Add("rest", "1"); config.Add("server", "1"); config.Add("txindex", "1"); config.Add("rpcuser", creds.UserName); config.Add("rpcpassword", creds.Password); if (!WhiteBind) { config.Add("port", ports[0].ToString()); } else { config.Add("whitebind", "127.0.0.1:" + ports[0].ToString()); } config.Add("rpcport", ports[1].ToString()); config.Add("printtoconsole", "1"); config.Add("keypool", "10"); config.Import(ConfigParameters, true); File.WriteAllText(_Config, config.ToString()); lock (l) { _Process = Process.Start(new FileInfo(this._Builder.BitcoinD).FullName, "-conf=bitcoin.conf" + " -datadir=" + dataDir + " -debug=net"); _State = CoreNodeState.Starting; } while (true) { try { await CreateRPCClient().GetBlockHashAsync(0).ConfigureAwait(false); _State = CoreNodeState.Running; break; } catch { } if (_Process == null || _Process.HasExited) { break; } } }