fix: substrate-runner support several rpc endpoints (#1736)

* fix: support several rpc endpoints in substrate

Close #1735

* Update testing/substrate-runner/src/lib.rs

* Update testing/substrate-runner/src/lib.rs

* fix grumbles

* Update testing/substrate-runner/src/lib.rs
This commit is contained in:
Niklas Adolfsson
2024-08-29 17:39:32 +02:00
committed by GitHub
parent 374193ac31
commit 6e01451684
+4 -3
View File
@@ -197,9 +197,10 @@ fn try_find_substrate_port_from_output(
.or_else(|| line.rsplit_once("Running JSON-RPC server: addr=127.0.0.1:"))
.map(|(_, port_str)| port_str);
if let Some(line_port) = line_port {
// trim non-numeric chars from the end of the port part of the line.
let port_str = line_port.trim_end_matches(|b: char| !b.is_ascii_digit());
if let Some(ports) = line_port {
// If more than one rpc server is started the log will capture multiple ports
// such as `addr=127.0.0.1:9944,[::1]:9944`
let port_str: String = ports.chars().take_while(|c| c.is_numeric()).collect();
// expect to have a number here (the chars after '127.0.0.1:') and parse them into a u16.
let port_num = port_str