Debugging geth bootnode setup

This commit is contained in:
benbierens 2023-04-21 09:11:45 +02:00
parent 4efc0d9fa4
commit dc9577613f
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
2 changed files with 23 additions and 8 deletions

View File

@ -97,7 +97,8 @@ namespace DistTestCore.Marketplace
public class PubKeyFinder : LogHandler, ILogHandler public class PubKeyFinder : LogHandler, ILogHandler
{ {
private const string openTag = "self=\"enode://"; private const string openTag = "self=enode://";
private const string openTagQuote = "self=\"enode://";
private string pubKey = string.Empty; private string pubKey = string.Empty;
public string GetPubKey() public string GetPubKey()
@ -109,13 +110,17 @@ namespace DistTestCore.Marketplace
{ {
if (line.Contains(openTag)) if (line.Contains(openTag))
{ {
ExtractPubKey(line); ExtractPubKey(openTag, line);
}
else if (line.Contains(openTagQuote))
{
ExtractPubKey(openTagQuote, line);
} }
} }
private void ExtractPubKey(string line) private void ExtractPubKey(string tag, string line)
{ {
var openIndex = line.IndexOf(openTag) + openTag.Length; var openIndex = line.IndexOf(tag) + tag.Length;
var closeIndex = line.IndexOf("@"); var closeIndex = line.IndexOf("@");
pubKey = line.Substring( pubKey = line.Substring(

View File

@ -28,11 +28,21 @@ namespace DistTestCore.Marketplace
if (config.IsBootstrapNode) if (config.IsBootstrapNode)
{ {
AddEnvVar("IS_BOOTSTRAP", "1"); return CreateBootstapArgs(discovery);
var exposedPort = AddExposedPort(tag: HttpPortTag);
return $"--http.port {exposedPort.Number} --discovery.port {discovery.Number} --nodiscover";
} }
return CreateCompanionArgs(discovery, config);
}
private string CreateBootstapArgs(Port discovery)
{
AddEnvVar("IS_BOOTSTRAP", "1");
var exposedPort = AddExposedPort(tag: HttpPortTag);
return $"--http.port {exposedPort.Number} --port {discovery.Number} --discovery.port {discovery.Number}";
}
private string CreateCompanionArgs(Port discovery, GethStartupConfig config)
{
var port = AddInternalPort(); var port = AddInternalPort();
var authRpc = AddInternalPort(); var authRpc = AddInternalPort();
var httpPort = AddInternalPort(tag: HttpPortTag); var httpPort = AddInternalPort(tag: HttpPortTag);
@ -43,7 +53,7 @@ namespace DistTestCore.Marketplace
var bootPort = config.BootstrapNode.DiscoveryPort.Number; var bootPort = config.BootstrapNode.DiscoveryPort.Number;
var bootstrapArg = $"--bootnodes enode://{bootPubKey}@{bootIp}:{bootPort}"; var bootstrapArg = $"--bootnodes enode://{bootPubKey}@{bootIp}:{bootPort}";
return $"--port {port.Number} --discovery.port {discovery.Number} --authrpc.port {authRpc.Number} --http.port {httpPort.Number} --ws --ws.addr 0.0.0.0 --ws.port {wsPort.Number} --nodiscover {bootstrapArg}"; return $"--port {port.Number} --discovery.port {discovery.Number} --authrpc.port {authRpc.Number} --http.port {httpPort.Number} --ws --ws.addr 0.0.0.0 --ws.port {wsPort.Number} {bootstrapArg}";
} }
} }
} }