Description
Setting the DOWNSTREAM_HASHRATE environment variable causes the proxy to panic immediately on startup with:
Root Cause
I think there is a copy-paste error in src/config.rs where the listening_addr field incorrectly reads from DOWNSTREAM_HASHRATE instead of a dedicated env var.
let listening_addr = args.listening_addr.or(config.listening_addr).or_else(|| {
std::env::var("DOWNSTREAM_HASHRATE") // should be a dedicated env var, e.g. LISTENING_ADDR
.ok()
.and_then(|s| s.parse().ok())
});
Since the return type is Option<String>, parsing a hashrate string like "100T" always succeeds. The value is then passed to TcpListener::bind, which fails to parse it as a SocketAddr and panics.
This also means there is currently no working environment variable to configure the downstream listening address.
Steps to Reproduce
DOWNSTREAM_HASHRATE=100T ./dmnd-client
Expected Behaviour
Setting DOWNSTREAM_HASHRATE should only affect the hashrate configuration and have no impact on the listening address.
Proposed Fix
Replace "DOWNSTREAM_HASHRATE" with an appropriate env var name (e.g. "LISTENING_ADDR") in the listening_addr resolution block.
Description
Setting the
DOWNSTREAM_HASHRATEenvironment variable causes the proxy to panic immediately on startup with:Root Cause
I think there is a copy-paste error in
src/config.rswhere thelistening_addrfield incorrectly reads fromDOWNSTREAM_HASHRATEinstead of a dedicated env var.Since the return type is
Option<String>, parsing a hashrate string like"100T"always succeeds. The value is then passed toTcpListener::bind, which fails to parse it as aSocketAddrand panics.This also means there is currently no working environment variable to configure the downstream listening address.
Steps to Reproduce
Expected Behaviour
Setting
DOWNSTREAM_HASHRATEshould only affect the hashrate configuration and have no impact on the listening address.Proposed Fix
Replace
"DOWNSTREAM_HASHRATE"with an appropriate env var name (e.g."LISTENING_ADDR") in thelistening_addrresolution block.